Merge branch 'master' of https://github.com/Microsoft/TypeScript into for-ofES6

Conflicts:
	src/compiler/checker.ts
	tests/baselines/reference/constDeclarations-errors.errors.txt
This commit is contained in:
Jason Freeman
2015-02-28 16:30:10 -08:00
123 changed files with 3127 additions and 341 deletions

View File

@@ -940,6 +940,7 @@ declare module "typescript" {
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
@@ -1044,6 +1045,7 @@ declare module "typescript" {
SuperStatic = 32,
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
}
interface NodeLinks {
resolvedType?: Type;

View File

@@ -3059,6 +3059,11 @@ declare module "typescript" {
>ModuleElement : ModuleElement
endOfFileToken: Node;
>endOfFileToken : Node
>Node : Node
fileName: string;
>fileName : string
@@ -3370,6 +3375,9 @@ declare module "typescript" {
>getPropertiesOfType : (type: Type) => Symbol[]
>type : Type
>Type : Type
>Symbol : Symbol
getPropertyOfType(type: Type, propertyName: string): Symbol;
>getPropertyOfType : (type: Type, propertyName: string) => Symbol
>type : Type

View File

@@ -971,6 +971,7 @@ declare module "typescript" {
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
@@ -1075,6 +1076,7 @@ declare module "typescript" {
SuperStatic = 32,
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
}
interface NodeLinks {
resolvedType?: Type;

View File

@@ -3205,6 +3205,11 @@ declare module "typescript" {
>ModuleElement : ModuleElement
endOfFileToken: Node;
>endOfFileToken : Node
>Node : Node
fileName: string;
>fileName : string
@@ -3516,6 +3521,9 @@ declare module "typescript" {
>getPropertiesOfType : (type: Type) => Symbol[]
>type : Type
>Type : Type
>Symbol : Symbol
getPropertyOfType(type: Type, propertyName: string): Symbol;
>getPropertyOfType : (type: Type, propertyName: string) => Symbol
>type : Type

View File

@@ -972,6 +972,7 @@ declare module "typescript" {
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
@@ -1076,6 +1077,7 @@ declare module "typescript" {
SuperStatic = 32,
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
}
interface NodeLinks {
resolvedType?: Type;

View File

@@ -3155,6 +3155,11 @@ declare module "typescript" {
>ModuleElement : ModuleElement
endOfFileToken: Node;
>endOfFileToken : Node
>Node : Node
fileName: string;
>fileName : string
@@ -3466,6 +3471,9 @@ declare module "typescript" {
>getPropertiesOfType : (type: Type) => Symbol[]
>type : Type
>Type : Type
>Symbol : Symbol
getPropertyOfType(type: Type, propertyName: string): Symbol;
>getPropertyOfType : (type: Type, propertyName: string) => Symbol
>type : Type

View File

@@ -1009,6 +1009,7 @@ declare module "typescript" {
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isUnknownIdentifier(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
@@ -1113,6 +1114,7 @@ declare module "typescript" {
SuperStatic = 32,
ContextChecked = 64,
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
}
interface NodeLinks {
resolvedType?: Type;

View File

@@ -3328,6 +3328,11 @@ declare module "typescript" {
>ModuleElement : ModuleElement
endOfFileToken: Node;
>endOfFileToken : Node
>Node : Node
fileName: string;
>fileName : string
@@ -3639,6 +3644,9 @@ declare module "typescript" {
>getPropertiesOfType : (type: Type) => Symbol[]
>type : Type
>Type : Type
>Symbol : Symbol
getPropertyOfType(type: Type, propertyName: string): Symbol;
>getPropertyOfType : (type: Type, propertyName: string) => Symbol
>type : Type

View File

@@ -1,7 +0,0 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts (1 errors) ====
let a: number = 1
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts ===
let a: number = 1
>a : number

View File

@@ -1,10 +1,7 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,7): error TS1155: 'const' declarations must be initialized
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (1 errors) ====
const a
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
~
!!! error TS1155: 'const' declarations must be initialized

View File

@@ -1,7 +0,0 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts (1 errors) ====
const a = 1
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts ===
const a = 1
>a : number

View File

@@ -1,10 +1,7 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,7): error TS1155: 'const' declarations must be initialized
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (1 errors) ====
const a: number
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
~
!!! error TS1155: 'const' declarations must be initialized

View File

@@ -1,7 +0,0 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts (1 errors) ====
const a: number = 1
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts ===
const a: number = 1
>a : number

View File

@@ -1,7 +0,0 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts (1 errors) ====
let a
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts ===
let a
>a : any

View File

@@ -1,7 +0,0 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts (1 errors) ====
let a = 1
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts ===
let a = 1
>a : number

View File

@@ -1,7 +0,0 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts (1 errors) ====
let a: number
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts ===
let a: number
>a : number

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA;IACA,EAAA,CACK,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IAJD,EAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CAAA,EAAA,GAAA,EAAA;IAAA,EAAA,CAEA,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,EAAA"}

View File

@@ -27,24 +27,24 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
5 >
6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1)
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
6 >
7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1)
7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
7 >
8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
8 >
9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
9 >
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0)
6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0)
7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0)
6 >Emitted(1, 10) Source(0, NaN) + SourceIndex(0)
7 >Emitted(1, 12) Source(0, NaN) + SourceIndex(0)
8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0)
9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0)
---
@@ -56,26 +56,25 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
5 > ^
6 > ^^^
1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
1->
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
2 >
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1)
3 > var v = {
> [
4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1)
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1)
3 >
4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1)
4 > "hello"
5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
5 >
6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 8) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 19) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 19) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
6 >
1->Emitted(2, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(2, 7) Source(1, 1) + SourceIndex(0)
1->Emitted(2, 5) Source(0, NaN) + SourceIndex(0)
2 >Emitted(2, 7) Source(0, NaN) + SourceIndex(0)
3 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
4 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
5 >Emitted(2, 16) Source(0, NaN) + SourceIndex(0)
@@ -85,14 +84,14 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
1 >^^^^^^^^
2 > ^^^^^^^^
3 > ^
1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 15) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1)
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1)
1 >
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 17) Source(3, 17) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 17) Source(3, 17) + SourceIndex(0) nameIndex (-1)
2 > debugger
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 18) Source(3, 18) + SourceIndex(0) nameIndex (-1)
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 18) Source(3, 18) + SourceIndex(0) nameIndex (-1)
3 > ;
1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0)
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0)
@@ -103,15 +102,15 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
2 > ^
3 >
4 > ^^^^->
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(4, 5) + SourceIndex(0) nameIndex (-1)
1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 8) Source(2, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(4, 5) + SourceIndex(0) nameIndex (-1)
1 >
>
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 15) Source(2, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + SourceIndex(0) nameIndex (-1)
2 > }
3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 9) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
3 >
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
@@ -122,17 +121,17 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
2 > ^^
3 > ^
4 > ^
1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 17) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
1->
2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 18) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
2 >
3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 5) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1)
3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1)
3 >
4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1)
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 9) Source(3, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1)
4 >
1->Emitted(5, 5) Source(0, NaN) + SourceIndex(0)
2 >Emitted(5, 7) Source(0, NaN) + SourceIndex(0)
@@ -143,15 +142,15 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
1 >^^^^
2 > ^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 17) Source(3, 24) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
1 >
2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 18) Source(3, 25) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
2 >
1 >Emitted(6, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(6, 7) Source(1, 1) + SourceIndex(0)
1 >Emitted(6, 5) Source(0, NaN) + SourceIndex(0)
2 >Emitted(6, 7) Source(0, NaN) + SourceIndex(0)
---
!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded
!!!! **** Remaining decoded string: ;IAAA,EAAA,CAKA,CAAA;IAJD,EAAA
!!!! **** Remaining decoded string: ;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,EAAA
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map

View File

@@ -4,9 +4,9 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec
tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-errors.ts(14,11): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized
tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized
==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ====
@@ -28,7 +28,6 @@ tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' d
~~
!!! error TS1155: 'const' declarations must be initialized
// error, can not be unintalized
for(const c in {}) { }
// error, assigning to a const

View File

@@ -5,7 +5,6 @@ const c1;
const c2: number;
const c3, c4, c5 :string, c6; // error, missing initialicer
// error, can not be unintalized
for(const c in {}) { }
// error, assigning to a const
@@ -22,8 +21,7 @@ for(const c10 = 0, c11; c10 < 1;) { }
const c1;
const c2;
const c3, c4, c5, c6; // error, missing initialicer
// error, can not be unintalized
for (var c in {}) { }
for (const c in {}) { }
// error, assigning to a const
for (const c8 = 0; c8 < 1; c8++) { }
// error, can not be unintalized

View File

@@ -1,17 +0,0 @@
tests/cases/compiler/constDeclarations-es5.ts(2,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/constDeclarations-es5.ts(3,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/constDeclarations-es5.ts(4,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/compiler/constDeclarations-es5.ts (3 errors) ====
const z7 = false;
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
const z8: number = 23;
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.
const z9 = 0, z10 :string = "", z11 = null;
~~~~~
!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -6,6 +6,6 @@ const z9 = 0, z10 :string = "", z11 = null;
//// [constDeclarations-es5.js]
const z7 = false;
const z8 = 23;
const z9 = 0, z10 = "", z11 = null;
var z7 = false;
var z8 = 23;
var z9 = 0, z10 = "", z11 = null;

View File

@@ -0,0 +1,13 @@
=== tests/cases/compiler/constDeclarations-es5.ts ===
const z7 = false;
>z7 : boolean
const z8: number = 23;
>z8 : number
const z9 = 0, z10 :string = "", z11 = null;
>z9 : number
>z10 : string
>z11 : any

View File

@@ -0,0 +1,7 @@
tests/cases/compiler/downlevelLetConst1.ts(1,6): error TS1123: Variable declaration list cannot be empty.
==== tests/cases/compiler/downlevelLetConst1.ts (1 errors) ====
const
!!! error TS1123: Variable declaration list cannot be empty.

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst1.ts]
const
//// [downlevelLetConst1.js]
var ;

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst10.ts]
let a: number = 1
//// [downlevelLetConst10.js]
var a = 1;

View File

@@ -0,0 +1,4 @@
=== tests/cases/compiler/downlevelLetConst10.ts ===
let a: number = 1
>a : number

View File

@@ -0,0 +1,8 @@
tests/cases/compiler/downlevelLetConst11.ts(2,4): error TS1123: Variable declaration list cannot be empty.
==== tests/cases/compiler/downlevelLetConst11.ts (1 errors) ====
"use strict";
let
!!! error TS1123: Variable declaration list cannot be empty.

View File

@@ -0,0 +1,7 @@
//// [downlevelLetConst11.ts]
"use strict";
let
//// [downlevelLetConst11.js]
"use strict";
var ;

View File

@@ -0,0 +1,22 @@
//// [downlevelLetConst12.ts]
'use strict'
// top level let\const should not be renamed
let foo;
const bar = 1;
let [baz] = [];
let {a: baz2} = { a: 1 };
const [baz3] = []
const {a: baz4} = { a: 1 };
//// [downlevelLetConst12.js]
'use strict';
// top level let\const should not be renamed
var foo;
var bar = 1;
var baz = ([])[0];
var baz2 = ({ a: 1 }).a;
var baz3 = ([])[0];
var baz4 = ({ a: 1 }).a;

View File

@@ -0,0 +1,30 @@
=== tests/cases/compiler/downlevelLetConst12.ts ===
'use strict'
// top level let\const should not be renamed
let foo;
>foo : any
const bar = 1;
>bar : number
let [baz] = [];
>baz : any
>[] : undefined[]
let {a: baz2} = { a: 1 };
>a : unknown
>baz2 : number
>{ a: 1 } : { a: number; }
>a : number
const [baz3] = []
>baz3 : any
>[] : undefined[]
const {a: baz4} = { a: 1 };
>a : unknown
>baz4 : number
>{ a: 1 } : { a: number; }
>a : number

View File

@@ -0,0 +1,39 @@
//// [downlevelLetConst13.ts]
'use strict'
// exported let\const bindings should not be renamed
export let foo = 10;
export const bar = "123"
export let [bar1] = [1];
export const [bar2] = [2];
export let {a: bar3} = { a: 1 };
export const {a: bar4} = { a: 1 };
export module M {
export let baz = 100;
export const baz2 = true;
export let [bar5] = [1];
export const [bar6] = [2];
export let {a: bar7} = { a: 1 };
export const {a: bar8} = { a: 1 };
}
//// [downlevelLetConst13.js]
'use strict';
// exported let\const bindings should not be renamed
exports.foo = 10;
exports.bar = "123";
exports.bar1 = ([1])[0];
exports.bar2 = ([2])[0];
exports.bar3 = ({ a: 1 }).a;
exports.bar4 = ({ a: 1 }).a;
var M;
(function (M) {
M.baz = 100;
M.baz2 = true;
M.bar5 = ([1])[0];
M.bar6 = ([2])[0];
M.bar7 = ({ a: 1 }).a;
M.bar8 = ({ a: 1 }).a;
})(M = exports.M || (exports.M = {}));

View File

@@ -0,0 +1,60 @@
=== tests/cases/compiler/downlevelLetConst13.ts ===
'use strict'
// exported let\const bindings should not be renamed
export let foo = 10;
>foo : number
export const bar = "123"
>bar : string
export let [bar1] = [1];
>bar1 : number
>[1] : [number]
export const [bar2] = [2];
>bar2 : number
>[2] : [number]
export let {a: bar3} = { a: 1 };
>a : unknown
>bar3 : number
>{ a: 1 } : { a: number; }
>a : number
export const {a: bar4} = { a: 1 };
>a : unknown
>bar4 : number
>{ a: 1 } : { a: number; }
>a : number
export module M {
>M : typeof M
export let baz = 100;
>baz : number
export const baz2 = true;
>baz2 : boolean
export let [bar5] = [1];
>bar5 : number
>[1] : [number]
export const [bar6] = [2];
>bar6 : number
>[2] : [number]
export let {a: bar7} = { a: 1 };
>a : unknown
>bar7 : number
>{ a: 1 } : { a: number; }
>a : number
export const {a: bar8} = { a: 1 };
>a : unknown
>bar8 : number
>{ a: 1 } : { a: number; }
>a : number
}

View File

@@ -0,0 +1,107 @@
//// [downlevelLetConst14.ts]
'use strict'
declare function use(a: any);
var x = 10;
var z0, z1, z2, z3;
{
let x = 20;
use(x);
let [z0] = [1];
use(z0);
let [z1] = [1]
use(z1);
let {a: z2} = { a: 1 };
use(z2);
let {a: z3} = { a: 1 };
use(z3);
}
use(x);
use(z0);
use(z1);
use(z2);
use(z3);
var z6;
var y = true;
{
let y = "";
let [z6] = [true]
{
let y = 1;
let {a: z6} = {a: 1}
use(y);
use(z6);
}
use(y);
use(z6);
}
use(y);
use(z6);
var z = false;
var z5 = 1;
{
let z = "";
let [z5] = [5];
{
let _z = 1;
let {a: _z5} = { a: 1 };
// try to step on generated name
use(_z);
}
use(z);
}
use(y);
//// [downlevelLetConst14.js]
'use strict';
var x = 10;
var z0, z1, z2, z3;
{
var _x = 20;
use(_x);
var _z0 = ([1])[0];
use(_z0);
var _z1 = ([1])[0];
use(_z1);
var _z2 = ({ a: 1 }).a;
use(_z2);
var _z3 = ({ a: 1 }).a;
use(_z3);
}
use(x);
use(z0);
use(z1);
use(z2);
use(z3);
var z6;
var y = true;
{
var _y = "";
var _z6 = ([true])[0];
{
var _y_1 = 1;
var _z6_1 = ({ a: 1 }).a;
use(_y_1);
use(_z6_1);
}
use(_y);
use(_z6);
}
use(y);
use(z6);
var z = false;
var z5 = 1;
{
var _z = "";
var _z5 = ([5])[0];
{
var _z_1 = 1;
var _z5_1 = ({ a: 1 }).a;
// try to step on generated name
use(_z_1);
}
use(_z);
}
use(y);

View File

@@ -0,0 +1,178 @@
=== tests/cases/compiler/downlevelLetConst14.ts ===
'use strict'
declare function use(a: any);
>use : (a: any) => any
>a : any
var x = 10;
>x : number
var z0, z1, z2, z3;
>z0 : any
>z1 : any
>z2 : any
>z3 : any
{
let x = 20;
>x : number
use(x);
>use(x) : any
>use : (a: any) => any
>x : number
let [z0] = [1];
>z0 : number
>[1] : [number]
use(z0);
>use(z0) : any
>use : (a: any) => any
>z0 : number
let [z1] = [1]
>z1 : number
>[1] : [number]
use(z1);
>use(z1) : any
>use : (a: any) => any
>z1 : number
let {a: z2} = { a: 1 };
>a : unknown
>z2 : number
>{ a: 1 } : { a: number; }
>a : number
use(z2);
>use(z2) : any
>use : (a: any) => any
>z2 : number
let {a: z3} = { a: 1 };
>a : unknown
>z3 : number
>{ a: 1 } : { a: number; }
>a : number
use(z3);
>use(z3) : any
>use : (a: any) => any
>z3 : number
}
use(x);
>use(x) : any
>use : (a: any) => any
>x : number
use(z0);
>use(z0) : any
>use : (a: any) => any
>z0 : any
use(z1);
>use(z1) : any
>use : (a: any) => any
>z1 : any
use(z2);
>use(z2) : any
>use : (a: any) => any
>z2 : any
use(z3);
>use(z3) : any
>use : (a: any) => any
>z3 : any
var z6;
>z6 : any
var y = true;
>y : boolean
{
let y = "";
>y : string
let [z6] = [true]
>z6 : boolean
>[true] : [boolean]
{
let y = 1;
>y : number
let {a: z6} = {a: 1}
>a : unknown
>z6 : number
>{a: 1} : { a: number; }
>a : number
use(y);
>use(y) : any
>use : (a: any) => any
>y : number
use(z6);
>use(z6) : any
>use : (a: any) => any
>z6 : number
}
use(y);
>use(y) : any
>use : (a: any) => any
>y : string
use(z6);
>use(z6) : any
>use : (a: any) => any
>z6 : boolean
}
use(y);
>use(y) : any
>use : (a: any) => any
>y : boolean
use(z6);
>use(z6) : any
>use : (a: any) => any
>z6 : any
var z = false;
>z : boolean
var z5 = 1;
>z5 : number
{
let z = "";
>z : string
let [z5] = [5];
>z5 : number
>[5] : [number]
{
let _z = 1;
>_z : number
let {a: _z5} = { a: 1 };
>a : unknown
>_z5 : number
>{ a: 1 } : { a: number; }
>a : number
// try to step on generated name
use(_z);
>use(_z) : any
>use : (a: any) => any
>_z : number
}
use(z);
>use(z) : any
>use : (a: any) => any
>z : string
}
use(y);
>use(y) : any
>use : (a: any) => any
>y : boolean

View File

@@ -0,0 +1,107 @@
//// [downlevelLetConst15.ts]
'use strict'
declare function use(a: any);
var x = 10;
var z0, z1, z2, z3;
{
const x = 20;
use(x);
const [z0] = [1];
use(z0);
const [{a: z1}] = [{a: 1}]
use(z1);
const {a: z2} = { a: 1 };
use(z2);
const {a: {b: z3}} = { a: {b: 1} };
use(z3);
}
use(x);
use(z0);
use(z1);
use(z2);
use(z3);
var z6;
var y = true;
{
const y = "";
const [z6] = [true]
{
const y = 1;
const {a: z6} = { a: 1 }
use(y);
use(z6);
}
use(y);
use(z6);
}
use(y);
use(z6);
var z = false;
var z5 = 1;
{
const z = "";
const [z5] = [5];
{
const _z = 1;
const {a: _z5} = { a: 1 };
// try to step on generated name
use(_z);
}
use(z);
}
use(y);
//// [downlevelLetConst15.js]
'use strict';
var x = 10;
var z0, z1, z2, z3;
{
var _x = 20;
use(_x);
var _z0 = ([1])[0];
use(_z0);
var _z1 = ([{ a: 1 }])[0].a;
use(_z1);
var _z2 = ({ a: 1 }).a;
use(_z2);
var _z3 = ({ a: { b: 1 } }).a.b;
use(_z3);
}
use(x);
use(z0);
use(z1);
use(z2);
use(z3);
var z6;
var y = true;
{
var _y = "";
var _z6 = ([true])[0];
{
var _y_1 = 1;
var _z6_1 = ({ a: 1 }).a;
use(_y_1);
use(_z6_1);
}
use(_y);
use(_z6);
}
use(y);
use(z6);
var z = false;
var z5 = 1;
{
var _z = "";
var _z5 = ([5])[0];
{
var _z_1 = 1;
var _z5_1 = ({ a: 1 }).a;
// try to step on generated name
use(_z_1);
}
use(_z);
}
use(y);

View File

@@ -0,0 +1,184 @@
=== tests/cases/compiler/downlevelLetConst15.ts ===
'use strict'
declare function use(a: any);
>use : (a: any) => any
>a : any
var x = 10;
>x : number
var z0, z1, z2, z3;
>z0 : any
>z1 : any
>z2 : any
>z3 : any
{
const x = 20;
>x : number
use(x);
>use(x) : any
>use : (a: any) => any
>x : number
const [z0] = [1];
>z0 : number
>[1] : [number]
use(z0);
>use(z0) : any
>use : (a: any) => any
>z0 : number
const [{a: z1}] = [{a: 1}]
>a : unknown
>z1 : number
>[{a: 1}] : [{ a: number; }]
>{a: 1} : { a: number; }
>a : number
use(z1);
>use(z1) : any
>use : (a: any) => any
>z1 : number
const {a: z2} = { a: 1 };
>a : unknown
>z2 : number
>{ a: 1 } : { a: number; }
>a : number
use(z2);
>use(z2) : any
>use : (a: any) => any
>z2 : number
const {a: {b: z3}} = { a: {b: 1} };
>a : unknown
>b : unknown
>z3 : number
>{ a: {b: 1} } : { a: { b: number; }; }
>a : { b: number; }
>{b: 1} : { b: number; }
>b : number
use(z3);
>use(z3) : any
>use : (a: any) => any
>z3 : number
}
use(x);
>use(x) : any
>use : (a: any) => any
>x : number
use(z0);
>use(z0) : any
>use : (a: any) => any
>z0 : any
use(z1);
>use(z1) : any
>use : (a: any) => any
>z1 : any
use(z2);
>use(z2) : any
>use : (a: any) => any
>z2 : any
use(z3);
>use(z3) : any
>use : (a: any) => any
>z3 : any
var z6;
>z6 : any
var y = true;
>y : boolean
{
const y = "";
>y : string
const [z6] = [true]
>z6 : boolean
>[true] : [boolean]
{
const y = 1;
>y : number
const {a: z6} = { a: 1 }
>a : unknown
>z6 : number
>{ a: 1 } : { a: number; }
>a : number
use(y);
>use(y) : any
>use : (a: any) => any
>y : number
use(z6);
>use(z6) : any
>use : (a: any) => any
>z6 : number
}
use(y);
>use(y) : any
>use : (a: any) => any
>y : string
use(z6);
>use(z6) : any
>use : (a: any) => any
>z6 : boolean
}
use(y);
>use(y) : any
>use : (a: any) => any
>y : boolean
use(z6);
>use(z6) : any
>use : (a: any) => any
>z6 : any
var z = false;
>z : boolean
var z5 = 1;
>z5 : number
{
const z = "";
>z : string
const [z5] = [5];
>z5 : number
>[5] : [number]
{
const _z = 1;
>_z : number
const {a: _z5} = { a: 1 };
>a : unknown
>_z5 : number
>{ a: 1 } : { a: number; }
>a : number
// try to step on generated name
use(_z);
>use(_z) : any
>use : (a: any) => any
>_z : number
}
use(z);
>use(z) : any
>use : (a: any) => any
>z : string
}
use(y);
>use(y) : any
>use : (a: any) => any
>y : boolean

View File

@@ -0,0 +1,249 @@
tests/cases/compiler/downlevelLetConst16.ts(189,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst16.ts(196,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst16.ts(203,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst16.ts(210,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst16.ts(217,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst16.ts(224,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ====
'use strict'
declare function use(a: any);
var x = 10;
var y;
var z;
use(x);
use(y);
use(z);
function foo1() {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = {a: 1};
use(z);
}
function foo2() {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
class A {
m1() {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
m2() {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
}
class B {
m1() {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
m2() {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
}
}
function bar1() {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
function bar2() {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
}
module M1 {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
module M2 {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
module M3 {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
module M4 {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
use(y);
use(z);
}
function foo3() {
for (let x; ;) {
use(x);
}
for (let [y] = []; ;) {
use(y);
}
for (let {a: z} = {a: 1}; ;) {
use(z);
}
use(x);
}
function foo4() {
for (const x = 1; ;) {
use(x);
}
for (const [y] = []; ;) {
use(y);
}
for (const {a: z} = { a: 1 }; ;) {
use(z);
}
use(x);
}
function foo5() {
for (let x in []) {
use(x);
}
use(x);
}
function foo6() {
for (const x in []) {
use(x);
}
use(x);
}
// TODO: once for-of is supported downlevel
function foo7() {
for (let x of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}
use(x);
}
function foo8() {
for (let [x] of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}
use(x);
}
function foo9() {
for (let {a: x} of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}
use(x);
}
function foo10() {
for (const x of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}
use(x);
}
function foo11() {
for (const [x] of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}
use(x);
}
function foo12() {
for (const {a: x} of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}
use(x);
}

View File

@@ -0,0 +1,441 @@
//// [downlevelLetConst16.ts]
'use strict'
declare function use(a: any);
var x = 10;
var y;
var z;
use(x);
use(y);
use(z);
function foo1() {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = {a: 1};
use(z);
}
function foo2() {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
class A {
m1() {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
m2() {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
}
class B {
m1() {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
m2() {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
}
}
function bar1() {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
function bar2() {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
}
module M1 {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
module M2 {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
module M3 {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
module M4 {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
use(y);
use(z);
}
function foo3() {
for (let x; ;) {
use(x);
}
for (let [y] = []; ;) {
use(y);
}
for (let {a: z} = {a: 1}; ;) {
use(z);
}
use(x);
}
function foo4() {
for (const x = 1; ;) {
use(x);
}
for (const [y] = []; ;) {
use(y);
}
for (const {a: z} = { a: 1 }; ;) {
use(z);
}
use(x);
}
function foo5() {
for (let x in []) {
use(x);
}
use(x);
}
function foo6() {
for (const x in []) {
use(x);
}
use(x);
}
// TODO: once for-of is supported downlevel
function foo7() {
for (let x of []) {
use(x);
}
use(x);
}
function foo8() {
for (let [x] of []) {
use(x);
}
use(x);
}
function foo9() {
for (let {a: x} of []) {
use(x);
}
use(x);
}
function foo10() {
for (const x of []) {
use(x);
}
use(x);
}
function foo11() {
for (const [x] of []) {
use(x);
}
use(x);
}
function foo12() {
for (const {a: x} of []) {
use(x);
}
use(x);
}
//// [downlevelLetConst16.js]
'use strict';
var x = 10;
var y;
var z;
use(x);
use(y);
use(z);
function foo1() {
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
function foo2() {
{
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
use(x);
}
var A = (function () {
function A() {
}
A.prototype.m1 = function () {
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
};
A.prototype.m2 = function () {
{
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
use(x);
};
return A;
})();
var B = (function () {
function B() {
}
B.prototype.m1 = function () {
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
};
B.prototype.m2 = function () {
{
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
use(x);
};
return B;
})();
function bar1() {
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
function bar2() {
{
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
use(x);
}
var M1;
(function (M1) {
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
})(M1 || (M1 = {}));
var M2;
(function (M2) {
{
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
use(x);
})(M2 || (M2 = {}));
var M3;
(function (M3) {
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
})(M3 || (M3 = {}));
var M4;
(function (M4) {
{
var _x = 1;
use(_x);
var _y = ([1])[0];
use(_y);
var _z = ({ a: 1 }).a;
use(_z);
}
use(x);
use(y);
use(z);
})(M4 || (M4 = {}));
function foo3() {
for (var _x = void 0;;) {
use(_x);
}
for (var _y = ([])[0];;) {
use(_y);
}
for (var _z = ({ a: 1 }).a;;) {
use(_z);
}
use(x);
}
function foo4() {
for (var _x = 1;;) {
use(_x);
}
for (var _y = ([])[0];;) {
use(_y);
}
for (var _z = ({ a: 1 }).a;;) {
use(_z);
}
use(x);
}
function foo5() {
for (var _x in []) {
use(_x);
}
use(x);
}
function foo6() {
for (var _x in []) {
use(_x);
}
use(x);
}
// TODO: once for-of is supported downlevel
function foo7() {
for (var _x of []) {
use(_x);
}
use(x);
}
function foo8() {
for (var _x = (void 0)[0] of []) {
use(_x);
}
use(x);
}
function foo9() {
for (var _x = (void 0).a of []) {
use(_x);
}
use(x);
}
function foo10() {
for (var _x of []) {
use(_x);
}
use(x);
}
function foo11() {
for (var _x = (void 0)[0] of []) {
use(_x);
}
use(x);
}
function foo12() {
for (var _x = (void 0).a of []) {
use(_x);
}
use(x);
}

View File

@@ -0,0 +1,74 @@
tests/cases/compiler/downlevelLetConst17.ts(66,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
==== tests/cases/compiler/downlevelLetConst17.ts (1 errors) ====
'use strict'
declare function use(a: any);
var x;
for (let x = 10; ;) {
use(x);
}
use(x);
for (const x = 10; ;) {
use(x);
}
for (; ;) {
let x = 10;
use(x);
x = 1;
}
for (; ;) {
const x = 10;
use(x);
}
for (let x; ;) {
use(x);
x = 1;
}
for (; ;) {
let x;
use(x);
x = 1;
}
while (true) {
let x;
use(x);
}
while (true) {
const x = true;
use(x);
}
do {
let x;
use(x);
} while (true);
do {
let x;
use(x);
} while (true);
for (let x in []) {
use(x);
}
for (const x in []) {
use(x);
}
// TODO: update once for-of statements are supported downlevel
for (const x of []) {
~~~
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
use(x);
}

View File

@@ -0,0 +1,124 @@
//// [downlevelLetConst17.ts]
'use strict'
declare function use(a: any);
var x;
for (let x = 10; ;) {
use(x);
}
use(x);
for (const x = 10; ;) {
use(x);
}
for (; ;) {
let x = 10;
use(x);
x = 1;
}
for (; ;) {
const x = 10;
use(x);
}
for (let x; ;) {
use(x);
x = 1;
}
for (; ;) {
let x;
use(x);
x = 1;
}
while (true) {
let x;
use(x);
}
while (true) {
const x = true;
use(x);
}
do {
let x;
use(x);
} while (true);
do {
let x;
use(x);
} while (true);
for (let x in []) {
use(x);
}
for (const x in []) {
use(x);
}
// TODO: update once for-of statements are supported downlevel
for (const x of []) {
use(x);
}
//// [downlevelLetConst17.js]
'use strict';
var x;
for (var _x = 10;;) {
use(_x);
}
use(x);
for (var _x_1 = 10;;) {
use(_x_1);
}
for (;;) {
var _x_2 = 10;
use(_x_2);
_x_2 = 1;
}
for (;;) {
var _x_3 = 10;
use(_x_3);
}
for (var _x_4 = void 0;;) {
use(_x_4);
_x_4 = 1;
}
for (;;) {
var _x_5 = void 0;
use(_x_5);
_x_5 = 1;
}
while (true) {
var _x_6 = void 0;
use(_x_6);
}
while (true) {
var _x_7 = true;
use(_x_7);
}
do {
var _x_8 = void 0;
use(_x_8);
} while (true);
do {
var _x_9 = void 0;
use(_x_9);
} while (true);
for (var _x_10 in []) {
use(_x_10);
}
for (var _x_11 in []) {
use(_x_11);
}
// TODO: update once for-of statements are supported downlevel
for (var _x_12 of []) {
use(_x_12);
}

View File

@@ -0,0 +1,60 @@
tests/cases/compiler/downlevelLetConst18.ts(3,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst18.ts(4,14): error TS2393: Duplicate function implementation.
tests/cases/compiler/downlevelLetConst18.ts(7,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst18.ts(8,14): error TS2393: Duplicate function implementation.
tests/cases/compiler/downlevelLetConst18.ts(11,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst18.ts(15,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst18.ts(19,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst18.ts(23,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
tests/cases/compiler/downlevelLetConst18.ts(27,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
==== tests/cases/compiler/downlevelLetConst18.ts (9 errors) ====
'use strict'
for (let x; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
function foo() { x };
~~~
!!! error TS2393: Duplicate function implementation.
}
for (let x; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
function foo() { x };
~~~
!!! error TS2393: Duplicate function implementation.
}
for (let x; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
(() => { x })();
}
for (const x = 1; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
(() => { x })();
}
for (let x; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
({ foo() { x }})
}
for (let x; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
({ get foo() { return x } })
}
for (let x; ;) {
~~~
!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.
({ set foo(v) { x } })
}

View File

@@ -0,0 +1,57 @@
//// [downlevelLetConst18.ts]
'use strict'
for (let x; ;) {
function foo() { x };
}
for (let x; ;) {
function foo() { x };
}
for (let x; ;) {
(() => { x })();
}
for (const x = 1; ;) {
(() => { x })();
}
for (let x; ;) {
({ foo() { x }})
}
for (let x; ;) {
({ get foo() { return x } })
}
for (let x; ;) {
({ set foo(v) { x } })
}
//// [downlevelLetConst18.js]
'use strict';
for (var x = void 0;;) {
function foo() { x; }
;
}
for (var _x = void 0;;) {
function foo() { _x; }
;
}
for (var _x_1 = void 0;;) {
(function () { _x_1; })();
}
for (var _x_2 = 1;;) {
(function () { _x_2; })();
}
for (var _x_3 = void 0;;) {
({ foo: function () { _x_3; } });
}
for (var _x_4 = void 0;;) {
({ get foo() { return _x_4; } });
}
for (var _x_5 = void 0;;) {
({ set foo(v) { _x_5; } });
}

View File

@@ -0,0 +1,7 @@
tests/cases/compiler/downlevelLetConst2.ts(1,7): error TS1155: 'const' declarations must be initialized
==== tests/cases/compiler/downlevelLetConst2.ts (1 errors) ====
const a
~
!!! error TS1155: 'const' declarations must be initialized

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst2.ts]
const a
//// [downlevelLetConst2.js]
var a;

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst3.ts]
const a = 1
//// [downlevelLetConst3.js]
var a = 1;

View File

@@ -0,0 +1,4 @@
=== tests/cases/compiler/downlevelLetConst3.ts ===
const a = 1
>a : number

View File

@@ -0,0 +1,7 @@
tests/cases/compiler/downlevelLetConst4.ts(1,7): error TS1155: 'const' declarations must be initialized
==== tests/cases/compiler/downlevelLetConst4.ts (1 errors) ====
const a: number
~
!!! error TS1155: 'const' declarations must be initialized

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst4.ts]
const a: number
//// [downlevelLetConst4.js]
var a;

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst5.ts]
const a: number = 1
//// [downlevelLetConst5.js]
var a = 1;

View File

@@ -0,0 +1,4 @@
=== tests/cases/compiler/downlevelLetConst5.ts ===
const a: number = 1
>a : number

View File

@@ -0,0 +1,7 @@
tests/cases/compiler/downlevelLetConst6.ts(1,1): error TS2304: Cannot find name 'let'.
==== tests/cases/compiler/downlevelLetConst6.ts (1 errors) ====
let
~~~
!!! error TS2304: Cannot find name 'let'.

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst6.ts]
let
//// [downlevelLetConst6.js]
let;

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst7.ts]
let a
//// [downlevelLetConst7.js]
var a;

View File

@@ -0,0 +1,4 @@
=== tests/cases/compiler/downlevelLetConst7.ts ===
let a
>a : any

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst8.ts]
let a = 1
//// [downlevelLetConst8.js]
var a = 1;

View File

@@ -0,0 +1,4 @@
=== tests/cases/compiler/downlevelLetConst8.ts ===
let a = 1
>a : number

View File

@@ -0,0 +1,5 @@
//// [downlevelLetConst9.ts]
let a: number
//// [downlevelLetConst9.js]
var a;

View File

@@ -0,0 +1,4 @@
=== tests/cases/compiler/downlevelLetConst9.ts ===
let a: number
>a : number

View File

@@ -17,7 +17,7 @@ class FooIterator {
}
//// [for-of21.js]
for (var v of new FooIterator) {
for (const v of new FooIterator) {
v;
}
var Foo = (function () {

View File

@@ -17,7 +17,7 @@ class FooIterator {
}
//// [for-of23.js]
for (var v of new FooIterator) {
for (const v of new FooIterator) {
const v = 0; // new scope
}
var Foo = (function () {

View File

@@ -7,7 +7,7 @@ for (const [k, v] of map) {
//// [for-of50.js]
var map = new Map([["", true]]);
for (var [k, v] of map) {
for (const [k, v] of map) {
k;
v;
}

View File

@@ -1,5 +1,5 @@
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile1.js
// File contains early errors. All outputs should be skipped.
const uninitialized_const_error;
var uninitialized_const_error;

View File

@@ -9,9 +9,9 @@ a;
//// [letAsIdentifierInStrictMode.js]
"use strict";
var ;
let ;
var ;
10;
var a = 10;
let ;
var ;
30;
let a;
var a;

View File

@@ -1,27 +0,0 @@
tests/cases/compiler/letDeclarations-es5-1.ts(1,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5-1.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5-1.ts(3,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5-1.ts(4,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5-1.ts(5,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5-1.ts(6,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/compiler/letDeclarations-es5-1.ts (6 errors) ====
let l1;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l2: number;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l3, l4, l5 :string, l6;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l7 = false;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l8: number = 23;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l9 = 0, l10 :string = "", l11 = null;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -7,9 +7,9 @@
let l9 = 0, l10 :string = "", l11 = null;
//// [letDeclarations-es5-1.js]
let l1;
let l2;
let l3, l4, l5, l6;
let l7 = false;
let l8 = 23;
let l9 = 0, l10 = "", l11 = null;
var l1;
var l2;
var l3, l4, l5, l6;
var l7 = false;
var l8 = 23;
var l9 = 0, l10 = "", l11 = null;

View File

@@ -0,0 +1,24 @@
=== tests/cases/compiler/letDeclarations-es5-1.ts ===
let l1;
>l1 : any
let l2: number;
>l2 : number
let l3, l4, l5 :string, l6;
>l3 : any
>l4 : any
>l5 : string
>l6 : any
let l7 = false;
>l7 : boolean
let l8: number = 23;
>l8 : number
let l9 = 0, l10 :string = "", l11 = null;
>l9 : number
>l10 : string
>l11 : any

View File

@@ -1,40 +0,0 @@
tests/cases/compiler/letDeclarations-es5.ts(2,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(3,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(4,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(6,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(7,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(8,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(10,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/letDeclarations-es5.ts(12,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
==== tests/cases/compiler/letDeclarations-es5.ts (8 errors) ====
let l1;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l2: number;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l3, l4, l5 :string, l6;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l7 = false;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l8: number = 23;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
let l9 = 0, l10 :string = "", l11 = null;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
for(let l11 in {}) { }
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
for(let l12 = 0; l12 < 9; l12++) { }
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.

View File

@@ -14,11 +14,11 @@ for(let l12 = 0; l12 < 9; l12++) { }
//// [letDeclarations-es5.js]
let l1;
let l2;
let l3, l4, l5, l6;
let l7 = false;
let l8 = 23;
let l9 = 0, l10 = "", l11 = null;
for (let l11 in {}) { }
for (let l12 = 0; l12 < 9; l12++) { }
var l1;
var l2;
var l3, l4, l5, l6;
var l7 = false;
var l8 = 23;
var l9 = 0, l10 = "", l11 = null;
for (var _l11 in {}) { }
for (var l12 = 0; l12 < 9; l12++) { }

View File

@@ -0,0 +1,36 @@
=== tests/cases/compiler/letDeclarations-es5.ts ===
let l1;
>l1 : any
let l2: number;
>l2 : number
let l3, l4, l5 :string, l6;
>l3 : any
>l4 : any
>l5 : string
>l6 : any
let l7 = false;
>l7 : boolean
let l8: number = 23;
>l8 : number
let l9 = 0, l10 :string = "", l11 = null;
>l9 : number
>l10 : string
>l11 : any
for(let l11 in {}) { }
>l11 : any
>{} : {}
for(let l12 = 0; l12 < 9; l12++) { }
>l12 : number
>l12 < 9 : boolean
>l12 : number
>l12++ : number
>l12 : number

View File

@@ -3,5 +3,5 @@ for (let {a, b} of X) {
}
//// [parserES5ForOfStatement13.js]
for (let _a = void 0, a = _a.a, b = _a.b of X) {
for (var _a = void 0, a = _a.a, b = _a.b of X) {
}

View File

@@ -3,5 +3,5 @@ for (let [a, b] of X) {
}
//// [parserES5ForOfStatement14.js]
for (let _a = void 0, a = _a[0], b = _a[1] of X) {
for (var _a = void 0, a = _a[0], b = _a[1] of X) {
}

View File

@@ -3,5 +3,5 @@ for (let v of X) {
}
//// [parserES5ForOfStatement9.js]
for (let v of X) {
for (var v of X) {
}

View File

@@ -3,5 +3,5 @@ for (const v of X) {
}
//// [parserForOfStatement10.js]
for (var v of X) {
for (const v of X) {
}

View File

@@ -3,5 +3,5 @@ for (const [a, b] of X) {
}
//// [parserForOfStatement11.js]
for (var [a, b] of X) {
for (const [a, b] of X) {
}

View File

@@ -3,5 +3,5 @@ for (const {a, b} of X) {
}
//// [parserForOfStatement12.js]
for (var { a, b } of X) {
for (const { a, b } of X) {
}

View File

@@ -1,14 +1,10 @@
tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'.
tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'.
==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ====
==== tests/cases/compiler/shadowingViaLocalValue.ts (2 errors) ====
{
let x;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
{
var x = 1;
~
@@ -18,8 +14,6 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot init
{
let x1;
~~~
!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
{
for (var x1 = 0; ;);
~~

View File

@@ -17,13 +17,13 @@
//// [shadowingViaLocalValue.js]
{
let x;
var _x;
{
var x = 1;
}
}
{
let x1;
var _x1;
{
for (var x1 = 0;;)
;

View File

@@ -5,7 +5,6 @@ const c1;
const c2: number;
const c3, c4, c5 :string, c6; // error, missing initialicer
// error, can not be unintalized
for(const c in {}) { }
// error, assigning to a const

View File

@@ -0,0 +1 @@
const

View File

@@ -0,0 +1 @@
let a: number = 1

View File

@@ -0,0 +1,2 @@
"use strict";
let

View File

@@ -0,0 +1,12 @@
// @target:es5
'use strict'
// top level let\const should not be renamed
let foo;
const bar = 1;
let [baz] = [];
let {a: baz2} = { a: 1 };
const [baz3] = []
const {a: baz4} = { a: 1 };

View File

@@ -0,0 +1,21 @@
// @target:es5
// @module: commonjs
'use strict'
// exported let\const bindings should not be renamed
export let foo = 10;
export const bar = "123"
export let [bar1] = [1];
export const [bar2] = [2];
export let {a: bar3} = { a: 1 };
export const {a: bar4} = { a: 1 };
export module M {
export let baz = 100;
export const baz2 = true;
export let [bar5] = [1];
export const [bar6] = [2];
export let {a: bar7} = { a: 1 };
export const {a: bar8} = { a: 1 };
}

View File

@@ -0,0 +1,55 @@
// @target:es5
'use strict'
declare function use(a: any);
var x = 10;
var z0, z1, z2, z3;
{
let x = 20;
use(x);
let [z0] = [1];
use(z0);
let [z1] = [1]
use(z1);
let {a: z2} = { a: 1 };
use(z2);
let {a: z3} = { a: 1 };
use(z3);
}
use(x);
use(z0);
use(z1);
use(z2);
use(z3);
var z6;
var y = true;
{
let y = "";
let [z6] = [true]
{
let y = 1;
let {a: z6} = {a: 1}
use(y);
use(z6);
}
use(y);
use(z6);
}
use(y);
use(z6);
var z = false;
var z5 = 1;
{
let z = "";
let [z5] = [5];
{
let _z = 1;
let {a: _z5} = { a: 1 };
// try to step on generated name
use(_z);
}
use(z);
}
use(y);

View File

@@ -0,0 +1,55 @@
// @target:es5
'use strict'
declare function use(a: any);
var x = 10;
var z0, z1, z2, z3;
{
const x = 20;
use(x);
const [z0] = [1];
use(z0);
const [{a: z1}] = [{a: 1}]
use(z1);
const {a: z2} = { a: 1 };
use(z2);
const {a: {b: z3}} = { a: {b: 1} };
use(z3);
}
use(x);
use(z0);
use(z1);
use(z2);
use(z3);
var z6;
var y = true;
{
const y = "";
const [z6] = [true]
{
const y = 1;
const {a: z6} = { a: 1 }
use(y);
use(z6);
}
use(y);
use(z6);
}
use(y);
use(z6);
var z = false;
var z5 = 1;
{
const z = "";
const [z5] = [5];
{
const _z = 1;
const {a: _z5} = { a: 1 };
// try to step on generated name
use(_z);
}
use(z);
}
use(y);

View File

@@ -0,0 +1,229 @@
// @target:es5
'use strict'
declare function use(a: any);
var x = 10;
var y;
var z;
use(x);
use(y);
use(z);
function foo1() {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = {a: 1};
use(z);
}
function foo2() {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
class A {
m1() {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
m2() {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
}
class B {
m1() {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
m2() {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
}
}
function bar1() {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
function bar2() {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
}
module M1 {
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
module M2 {
{
let x = 1;
use(x);
let [y] = [1];
use(y);
let {a: z} = { a: 1 };
use(z);
}
use(x);
}
module M3 {
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
module M4 {
{
const x = 1;
use(x);
const [y] = [1];
use(y);
const {a: z} = { a: 1 };
use(z);
}
use(x);
use(y);
use(z);
}
function foo3() {
for (let x; ;) {
use(x);
}
for (let [y] = []; ;) {
use(y);
}
for (let {a: z} = {a: 1}; ;) {
use(z);
}
use(x);
}
function foo4() {
for (const x = 1; ;) {
use(x);
}
for (const [y] = []; ;) {
use(y);
}
for (const {a: z} = { a: 1 }; ;) {
use(z);
}
use(x);
}
function foo5() {
for (let x in []) {
use(x);
}
use(x);
}
function foo6() {
for (const x in []) {
use(x);
}
use(x);
}
// TODO: once for-of is supported downlevel
function foo7() {
for (let x of []) {
use(x);
}
use(x);
}
function foo8() {
for (let [x] of []) {
use(x);
}
use(x);
}
function foo9() {
for (let {a: x} of []) {
use(x);
}
use(x);
}
function foo10() {
for (const x of []) {
use(x);
}
use(x);
}
function foo11() {
for (const [x] of []) {
use(x);
}
use(x);
}
function foo12() {
for (const {a: x} of []) {
use(x);
}
use(x);
}

View File

@@ -0,0 +1,69 @@
// @target:es5
'use strict'
declare function use(a: any);
var x;
for (let x = 10; ;) {
use(x);
}
use(x);
for (const x = 10; ;) {
use(x);
}
for (; ;) {
let x = 10;
use(x);
x = 1;
}
for (; ;) {
const x = 10;
use(x);
}
for (let x; ;) {
use(x);
x = 1;
}
for (; ;) {
let x;
use(x);
x = 1;
}
while (true) {
let x;
use(x);
}
while (true) {
const x = true;
use(x);
}
do {
let x;
use(x);
} while (true);
do {
let x;
use(x);
} while (true);
for (let x in []) {
use(x);
}
for (const x in []) {
use(x);
}
// TODO: update once for-of statements are supported downlevel
for (const x of []) {
use(x);
}

View File

@@ -0,0 +1,30 @@
// @target:es5
'use strict'
for (let x; ;) {
function foo() { x };
}
for (let x; ;) {
function foo() { x };
}
for (let x; ;) {
(() => { x })();
}
for (const x = 1; ;) {
(() => { x })();
}
for (let x; ;) {
({ foo() { x }})
}
for (let x; ;) {
({ get foo() { return x } })
}
for (let x; ;) {
({ set foo(v) { x } })
}

View File

@@ -0,0 +1 @@
const a

View File

@@ -0,0 +1 @@
const a = 1

View File

@@ -0,0 +1 @@
const a: number

View File

@@ -0,0 +1 @@
const a: number = 1

View File

@@ -0,0 +1 @@
let

Some files were not shown because too many files have changed in this diff Show More