1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(2,5): error TS2451: Cannot redeclare block-scoped variable 'var1'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(3,5): error TS2451: Cannot redeclare block-scoped variable 'var1'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(5,5): error TS2451: Cannot redeclare block-scoped variable 'var2'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(6,7): error TS2451: Cannot redeclare block-scoped variable 'var2'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(8,7): error TS2451: Cannot redeclare block-scoped variable 'var3'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(9,5): error TS2451: Cannot redeclare block-scoped variable 'var3'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(11,7): error TS2451: Cannot redeclare block-scoped variable 'var4'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(12,7): error TS2451: Cannot redeclare block-scoped variable 'var4'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(14,5): error TS2300: Duplicate identifier 'var5'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(15,5): error TS2300: Duplicate identifier 'var5'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(17,5): error TS2451: Cannot redeclare block-scoped variable 'var6'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(18,5): error TS2451: Cannot redeclare block-scoped variable 'var6'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(21,9): error TS2451: Cannot redeclare block-scoped variable 'var7'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(22,9): error TS2451: Cannot redeclare block-scoped variable 'var7'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(24,13): error TS2451: Cannot redeclare block-scoped variable 'var8'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(25,15): error TS2451: Cannot redeclare block-scoped variable 'var8'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(31,13): error TS2451: Cannot redeclare block-scoped variable 'var9'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(32,13): error TS2451: Cannot redeclare block-scoped variable 'var9'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(36,11): error TS2451: Cannot redeclare block-scoped variable 'var10'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(37,11): error TS2451: Cannot redeclare block-scoped variable 'var10'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(40,9): error TS2451: Cannot redeclare block-scoped variable 'var11'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(41,9): error TS2451: Cannot redeclare block-scoped variable 'var11'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(45,9): error TS2451: Cannot redeclare block-scoped variable 'var12'.
tests/cases/compiler/letDeclarations-scopes-duplicates.ts(46,9): error TS2451: Cannot redeclare block-scoped variable 'var12'.
==== tests/cases/compiler/letDeclarations-scopes-duplicates.ts (24 errors) ====
// Errors: redeclaration
let var1 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var1'.
let var1 = 0; // error
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var1'.
let var2 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var2'.
const var2 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var2'.
const var3 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var3'.
let var3 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var3'.
const var4 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var4'.
const var4 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var4'.
var var5 = 0;
~~~~
!!! error TS2300: Duplicate identifier 'var5'.
let var5 = 0;
~~~~
!!! error TS2300: Duplicate identifier 'var5'.
let var6 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var6'.
var var6 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var6'.
{
let var7 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var7'.
let var7 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var7'.
{
let var8 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var8'.
const var8 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var8'.
}
}
switch (0) {
default:
let var9 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var9'.
let var9 = 0;
~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var9'.
}
try {
const var10 = 0;
~~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var10'.
const var10 = 0;
~~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var10'.
}
catch (e) {
let var11 = 0;
~~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var11'.
let var11 = 0;
~~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var11'.
}
function F1() {
let var12;
~~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var12'.
let var12;
~~~~~
!!! error TS2451: Cannot redeclare block-scoped variable 'var12'.
}
// OK
var var20 = 0;
var var20 = 0
{
let var20 = 0;
{
let var20 = 0;
}
}
switch (0) {
default:
let var20 = 0;
}
try {
let var20 = 0;
}
catch (e) {
let var20 = 0;
}
function F() {
let var20;
}
|