diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b581ca315b4..e8c96c75398 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1068,9 +1068,10 @@ namespace ts { // block-scoped variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, // we want to check for block-scoped - if (meaning & SymbolFlags.BlockScopedVariable) { + if (meaning & SymbolFlags.BlockScopedVariable || + ((meaning & SymbolFlags.Class || meaning & SymbolFlags.Enum) && (meaning & SymbolFlags.Value) === SymbolFlags.Value)) { const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); - if (exportOrLocalSymbol.flags & SymbolFlags.BlockScopedVariable) { + if (exportOrLocalSymbol.flags & SymbolFlags.BlockScopedVariable || exportOrLocalSymbol.flags & SymbolFlags.Class || exportOrLocalSymbol.flags & SymbolFlags.Enum) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); } } @@ -1183,14 +1184,22 @@ namespace ts { } function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { - Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0); + Debug.assert(!!(result.flags & SymbolFlags.BlockScopedVariable || result.flags & SymbolFlags.Class || result.flags & SymbolFlags.Enum)); // Block-scoped variables cannot be used before their definition - const declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); + const declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) || isClassLike(d) || (d.kind === SyntaxKind.EnumDeclaration) ? d : undefined); - Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + Debug.assert(declaration !== undefined, "Declaration to checkResolvedBlockScopedVariable is undefined"); if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { - error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); + if (result.flags & SymbolFlags.BlockScopedVariable) { + error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } + else if (result.flags & SymbolFlags.Class) { + error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } + else if (result.flags & SymbolFlags.Enum) { + error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } } } @@ -13322,10 +13331,17 @@ namespace ts { } return unknownType; } - if (prop.valueDeclaration && - isInPropertyInitializer(node) && - !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { - error(right, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + if (prop.valueDeclaration) { + if (isInPropertyInitializer(node) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + } + if (prop.valueDeclaration.kind === SyntaxKind.ClassDeclaration && + node.parent && node.parent.kind !== SyntaxKind.TypeReference && + !isInAmbientContext(prop.valueDeclaration) && + !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { + error(right, Diagnostics.Class_0_used_before_its_declaration, right.text); + } } markPropertyAsReferenced(prop); @@ -19572,14 +19588,6 @@ namespace ts { error(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } - if (baseType.symbol && baseType.symbol.valueDeclaration && - !isInAmbientContext(baseType.symbol.valueDeclaration) && - baseType.symbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration) { - if (!isBlockScopedNameDeclaredBeforeUse(baseType.symbol.valueDeclaration, node)) { - error(baseTypeNode, Diagnostics.A_class_must_be_declared_after_its_base_class); - } - } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & SymbolFlags.Class) && !(baseConstructorType.flags & TypeFlags.TypeVariable)) { // When the static base type is a "class-like" constructor function (but not actually a class), we verify // that all instantiated base constructor signatures return the same type. We can simply compare the type diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 919158645a4..df18dba4b47 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1435,6 +1435,14 @@ "category": "Error", "code": 2448 }, + "Class '{0}' used before its declaration.": { + "category": "Error", + "code": 2449 + }, + "Enum '{0}' used before its declaration.": { + "category": "Error", + "code": 2450 + }, "Cannot redeclare block-scoped variable '{0}'.": { "category": "Error", "code": 2451 @@ -2019,10 +2027,6 @@ "category": "Error", "code": 2689 }, - "A class must be declared after its base class.": { - "category": "Error", - "code": 2690 - }, "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.": { "category": "Error", "code": 2691 diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt index b762db8a04b..7839958ba54 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2495: Type 'StringIterator' is not an array type or a string type. -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(10,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(15,15): error TS2495: Type 'StringIterator' is not an array type or a string type. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS2495: Type 'StringIterator' is not an array type or a string type. // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { @@ -20,4 +17,8 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6 !!! error TS2304: Cannot find name 'Symbol'. return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2495: Type 'StringIterator' is not an array type or a string type. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.js b/tests/baselines/reference/ES5For-ofTypeCheck10.js index 0fe92e289a6..9b197c2d206 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck10.js +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.js @@ -1,5 +1,4 @@ //// [ES5For-ofTypeCheck10.ts] -for (var v of new StringIterator) { } // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { @@ -12,12 +11,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [ES5For-ofTypeCheck10.js] -for (var _i = 0, _a = new StringIterator; _i < _a.length; _i++) { - var v = _a[_i]; -} // In ES3/5, you cannot for...of over an arbitrary iterable. var StringIterator = (function () { function StringIterator() { @@ -33,3 +31,6 @@ var StringIterator = (function () { }; return StringIterator; }()); +for (var _i = 0, _a = new StringIterator; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt index 2a464e88268..0da61368eee 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(2,31): error TS2449: Class 'A' used before its declaration. ==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ==== @@ -24,11 +25,13 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error } } -==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ==== +==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (2 errors) ==== module A { ~ !!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged. export var Instance = new A(); + ~ +!!! error TS2449: Class 'A' used before its declaration. } // duplicate identifier diff --git a/tests/baselines/reference/circularImportAlias.errors.txt b/tests/baselines/reference/circularImportAlias.errors.txt index 82c9205ae54..13ff1d8c7c9 100644 --- a/tests/baselines/reference/circularImportAlias.errors.txt +++ b/tests/baselines/reference/circularImportAlias.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts(5,28): error TS2690: A class must be declared after its base class. +tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts(5,30): error TS2449: Class 'C' used before its declaration. ==== tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts (1 errors) ==== @@ -7,8 +7,8 @@ tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.t module B { export import a = A; export class D extends a.C { - ~~~ -!!! error TS2690: A class must be declared after its base class. + ~ +!!! error TS2449: Class 'C' used before its declaration. id: number; } } diff --git a/tests/baselines/reference/classAbstractInstantiations2.errors.txt b/tests/baselines/reference/classAbstractInstantiations2.errors.txt index bf4cd851fb3..15b63a6d3e8 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.errors.txt +++ b/tests/baselines/reference/classAbstractInstantiations2.errors.txt @@ -3,13 +3,14 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst Cannot assign an abstract constructor type to a non-abstract constructor type. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(17,5): error TS2511: Cannot create an instance of the abstract class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(23,15): error TS2449: Class 'C' used before its declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or non-abstract. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1244: Abstract methods can only appear within an abstract class. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (8 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (9 errors) ==== class A { // ... } @@ -42,6 +43,8 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst !!! error TS2511: Cannot create an instance of the abstract class 'B'. var x : any = C; + ~ +!!! error TS2449: Class 'C' used before its declaration. new x; // okay -- undefined behavior at runtime class C extends B { } // error -- not declared abstract diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js new file mode 100644 index 00000000000..195cd78f359 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js @@ -0,0 +1,15 @@ +//// [classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts] +function f() { + new C2(); // OK +} +class C2 { } + +//// [classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.js] +function f() { + new C2(); // OK +} +var C2 = (function () { + function C2() { + } + return C2; +}()); diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.symbols b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.symbols new file mode 100644 index 00000000000..19e4620b5cf --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts === +function f() { +>f : Symbol(f, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 0, 0)) + + new C2(); // OK +>C2 : Symbol(C2, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 2, 1)) +} +class C2 { } +>C2 : Symbol(C2, Decl(classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts, 2, 1)) + diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.types b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.types new file mode 100644 index 00000000000..62550065239 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts === +function f() { +>f : () => void + + new C2(); // OK +>new C2() : C2 +>C2 : typeof C2 +} +class C2 { } +>C2 : C2 + diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js new file mode 100644 index 00000000000..b3a3d25a819 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.js @@ -0,0 +1,9 @@ +//// [classDeclarationCheckUsedBeforeDefinitionInItself.ts] +class C3 { + static intance = new C3(); // ok +} + +//// [classDeclarationCheckUsedBeforeDefinitionInItself.js] +class C3 { +} +C3.intance = new C3(); // ok diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.symbols b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.symbols new file mode 100644 index 00000000000..f0e6f2a5a71 --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts === +class C3 { +>C3 : Symbol(C3, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 0)) + + static intance = new C3(); // ok +>intance : Symbol(C3.intance, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 10)) +>C3 : Symbol(C3, Decl(classDeclarationCheckUsedBeforeDefinitionInItself.ts, 0, 0)) +} diff --git a/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.types b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.types new file mode 100644 index 00000000000..e4f36dda38c --- /dev/null +++ b/tests/baselines/reference/classDeclarationCheckUsedBeforeDefinitionInItself.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts === +class C3 { +>C3 : C3 + + static intance = new C3(); // ok +>intance : C3 +>new C3() : C3 +>C3 : typeof C3 +} diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index c1642125fe9..5b9892b9ab8 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -1,16 +1,16 @@ //// [classDoesNotDependOnBaseTypes.ts] -var x: StringTree; -if (typeof x !== "string") { - x[0] = ""; - x[0] = new StringTreeCollection; -} - type StringTree = string | StringTreeCollection; class StringTreeCollectionBase { [n: number]: StringTree; } -class StringTreeCollection extends StringTreeCollectionBase { } +class StringTreeCollection extends StringTreeCollectionBase { } + +var x: StringTree; +if (typeof x !== "string") { + x[0] = ""; + x[0] = new StringTreeCollection; +} //// [classDoesNotDependOnBaseTypes.js] var __extends = (this && this.__extends) || (function () { @@ -23,11 +23,6 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var x; -if (typeof x !== "string") { - x[0] = ""; - x[0] = new StringTreeCollection; -} var StringTreeCollectionBase = (function () { function StringTreeCollectionBase() { } @@ -40,3 +35,8 @@ var StringTreeCollection = (function (_super) { } return StringTreeCollection; }(StringTreeCollectionBase)); +var x; +if (typeof x !== "string") { + x[0] = ""; + x[0] = new StringTreeCollection; +} diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols b/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols index e45b00f1e8a..a7a421ebf55 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.symbols @@ -1,32 +1,31 @@ === tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts === -var x: StringTree; ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) ->StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 4, 1)) - -if (typeof x !== "string") { ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) - - x[0] = ""; ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) - - x[0] = new StringTreeCollection; ->x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 0, 3)) ->StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 9, 1)) -} - type StringTree = string | StringTreeCollection; ->StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 4, 1)) ->StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 9, 1)) +>StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 0, 0)) +>StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 3, 1)) class StringTreeCollectionBase { ->StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 6, 48)) +>StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 0, 48)) [n: number]: StringTree; ->n : Symbol(n, Decl(classDoesNotDependOnBaseTypes.ts, 8, 5)) ->StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 4, 1)) +>n : Symbol(n, Decl(classDoesNotDependOnBaseTypes.ts, 2, 5)) +>StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 0, 0)) } class StringTreeCollection extends StringTreeCollectionBase { } ->StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 9, 1)) ->StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 6, 48)) +>StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 3, 1)) +>StringTreeCollectionBase : Symbol(StringTreeCollectionBase, Decl(classDoesNotDependOnBaseTypes.ts, 0, 48)) +var x: StringTree; +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) +>StringTree : Symbol(StringTree, Decl(classDoesNotDependOnBaseTypes.ts, 0, 0)) + +if (typeof x !== "string") { +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) + + x[0] = ""; +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) + + x[0] = new StringTreeCollection; +>x : Symbol(x, Decl(classDoesNotDependOnBaseTypes.ts, 7, 3)) +>StringTreeCollection : Symbol(StringTreeCollection, Decl(classDoesNotDependOnBaseTypes.ts, 3, 1)) +} diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.types b/tests/baselines/reference/classDoesNotDependOnBaseTypes.types index 54b67dfd6a7..16dc984dc8c 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.types +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.types @@ -1,4 +1,20 @@ === tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts === +type StringTree = string | StringTreeCollection; +>StringTree : StringTree +>StringTreeCollection : StringTreeCollection + +class StringTreeCollectionBase { +>StringTreeCollectionBase : StringTreeCollectionBase + + [n: number]: StringTree; +>n : number +>StringTree : StringTree +} + +class StringTreeCollection extends StringTreeCollectionBase { } +>StringTreeCollection : StringTreeCollection +>StringTreeCollectionBase : StringTreeCollectionBase + var x: StringTree; >x : StringTree >StringTree : StringTree @@ -24,20 +40,3 @@ if (typeof x !== "string") { >new StringTreeCollection : StringTreeCollection >StringTreeCollection : typeof StringTreeCollection } - -type StringTree = string | StringTreeCollection; ->StringTree : StringTree ->StringTreeCollection : StringTreeCollection - -class StringTreeCollectionBase { ->StringTreeCollectionBase : StringTreeCollectionBase - - [n: number]: StringTree; ->n : number ->StringTree : StringTree -} - -class StringTreeCollection extends StringTreeCollectionBase { } ->StringTreeCollection : StringTreeCollection ->StringTreeCollectionBase : StringTreeCollectionBase - diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt index c0f35f0388f..8f54ef18051 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt @@ -1,15 +1,19 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(1,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(1,17): error TS2449: Class 'E' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(3,7): error TS2506: 'D' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(5,7): error TS2506: 'E' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(7,7): error TS2506: 'C2' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(7,21): error TS2449: Class 'E2' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(9,7): error TS2506: 'D2' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts(11,7): error TS2506: 'E2' is referenced directly or indirectly in its own base expression. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts (8 errors) ==== class C extends E { foo: string; } // error ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'E' used before its declaration. class D extends C { bar: string; } ~ @@ -22,6 +26,8 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla class C2 extends E2 { foo: T; } // error ~~ !!! error TS2506: 'C2' is referenced directly or indirectly in its own base expression. + ~~ +!!! error TS2449: Class 'E2' used before its declaration. class D2 extends C2 { bar: T; } ~~ diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt index 061770f9b79..48c787b54d9 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt @@ -1,15 +1,19 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(1,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(1,19): error TS2449: Class 'E' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(4,18): error TS2506: 'D' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(9,18): error TS2506: 'E' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(13,11): error TS2506: 'C2' is referenced directly or indirectly in its own base expression. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(13,27): error TS2449: Class 'E2' used before its declaration. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(16,22): error TS2506: 'D2' is referenced directly or indirectly in its own base expression. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts(20,22): error TS2506: 'E2' is referenced directly or indirectly in its own base expression. -==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts (6 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts (8 errors) ==== class C extends N.E { foo: string; } // error ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'E' used before its declaration. module M { export class D extends C { bar: string; } @@ -28,6 +32,8 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla class C2 extends Q.E2 { foo: T; } // error ~~ !!! error TS2506: 'C2' is referenced directly or indirectly in its own base expression. + ~~ +!!! error TS2449: Class 'E2' used before its declaration. module P { export class D2 extends C2 { bar: T; } diff --git a/tests/baselines/reference/classInheritence.errors.txt b/tests/baselines/reference/classInheritence.errors.txt index cd95dedbfcf..3bad3caf3d2 100644 --- a/tests/baselines/reference/classInheritence.errors.txt +++ b/tests/baselines/reference/classInheritence.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/classInheritence.ts(1,17): error TS2690: A class must be declared after its base class. +tests/cases/compiler/classInheritence.ts(1,17): error TS2449: Class 'A' used before its declaration. tests/cases/compiler/classInheritence.ts(2,7): error TS2506: 'A' is referenced directly or indirectly in its own base expression. ==== tests/cases/compiler/classInheritence.ts (2 errors) ==== class B extends A { } ~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'A' used before its declaration. class A extends A { } ~ !!! error TS2506: 'A' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/classOrder2.errors.txt b/tests/baselines/reference/classOrder2.errors.txt index a1b8dc6346e..59184e6a5e6 100644 --- a/tests/baselines/reference/classOrder2.errors.txt +++ b/tests/baselines/reference/classOrder2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/classOrder2.ts(2,17): error TS2690: A class must be declared after its base class. +tests/cases/compiler/classOrder2.ts(2,17): error TS2449: Class 'B' used before its declaration. ==== tests/cases/compiler/classOrder2.ts (1 errors) ==== class A extends B { ~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'B' used before its declaration. foo() { this.bar(); } diff --git a/tests/baselines/reference/classSideInheritance2.errors.txt b/tests/baselines/reference/classSideInheritance2.errors.txt index e286594ec2d..7b27ee7c0f9 100644 --- a/tests/baselines/reference/classSideInheritance2.errors.txt +++ b/tests/baselines/reference/classSideInheritance2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2690: A class must be declared after its base class. +tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2449: Class 'TextBase' used before its declaration. ==== tests/cases/compiler/classSideInheritance2.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2690: A class must class SubText extends TextBase { ~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'TextBase' used before its declaration. constructor(text: IText, span: TextSpan) { super(); diff --git a/tests/baselines/reference/complexClassRelationships.errors.txt b/tests/baselines/reference/complexClassRelationships.errors.txt index 33413e496d4..c978a36c036 100644 --- a/tests/baselines/reference/complexClassRelationships.errors.txt +++ b/tests/baselines/reference/complexClassRelationships.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/complexClassRelationships.ts(2,23): error TS2690: A class must be declared after its base class. +tests/cases/compiler/complexClassRelationships.ts(2,23): error TS2449: Class 'Base' used before its declaration. ==== tests/cases/compiler/complexClassRelationships.ts (1 errors) ==== // There should be no errors in this file class Derived extends Base { ~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'Base' used before its declaration. public static createEmpty(): Derived { var item = new Derived(); return item; diff --git a/tests/baselines/reference/derivedClasses.errors.txt b/tests/baselines/reference/derivedClasses.errors.txt index fdd38d8c060..ff6946df2ca 100644 --- a/tests/baselines/reference/derivedClasses.errors.txt +++ b/tests/baselines/reference/derivedClasses.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/derivedClasses.ts(1,19): error TS2690: A class must be declared after its base class. +tests/cases/compiler/derivedClasses.ts(1,19): error TS2449: Class 'Color' used before its declaration. ==== tests/cases/compiler/derivedClasses.ts (1 errors) ==== class Red extends Color { ~~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'Color' used before its declaration. public shade() { var getHue = () => { return this.hue(); }; return getHue() + " red"; diff --git a/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt b/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt new file mode 100644 index 00000000000..aea5366389b --- /dev/null +++ b/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/enumUsedBeforeDeclaration.ts(1,18): error TS2450: Enum 'Color' used before its declaration. +tests/cases/compiler/enumUsedBeforeDeclaration.ts(2,24): error TS2450: Enum 'ConstColor' used before its declaration. + + +==== tests/cases/compiler/enumUsedBeforeDeclaration.ts (2 errors) ==== + const v: Color = Color.Green; + ~~~~~ +!!! error TS2450: Enum 'Color' used before its declaration. + const v2: ConstColor = ConstColor.Green; + ~~~~~~~~~~ +!!! error TS2450: Enum 'ConstColor' used before its declaration. + enum Color { Red, Green, Blue } + const enum ConstColor { Red, Green, Blue } + + \ No newline at end of file diff --git a/tests/baselines/reference/enumUsedBeforeDeclaration.js b/tests/baselines/reference/enumUsedBeforeDeclaration.js new file mode 100644 index 00000000000..63fc38471b2 --- /dev/null +++ b/tests/baselines/reference/enumUsedBeforeDeclaration.js @@ -0,0 +1,17 @@ +//// [enumUsedBeforeDeclaration.ts] +const v: Color = Color.Green; +const v2: ConstColor = ConstColor.Green; +enum Color { Red, Green, Blue } +const enum ConstColor { Red, Green, Blue } + + + +//// [enumUsedBeforeDeclaration.js] +var v = Color.Green; +var v2 = 1 /* Green */; +var Color; +(function (Color) { + Color[Color["Red"] = 0] = "Red"; + Color[Color["Green"] = 1] = "Green"; + Color[Color["Blue"] = 2] = "Blue"; +})(Color || (Color = {})); diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt new file mode 100644 index 00000000000..951e8bbffd1 --- /dev/null +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts(2,21): error TS2449: Class 'C' used before its declaration. + + +==== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts (1 errors) ==== + + var before: C = new C(); + ~ +!!! error TS2449: Class 'C' used before its declaration. + + export default class C { + method(): C { + return new C(); + } + } + + var after: C = new C(); + + var t: typeof C = C; + + \ No newline at end of file diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols deleted file mode 100644 index d5c8243161b..00000000000 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.symbols +++ /dev/null @@ -1,30 +0,0 @@ -=== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts === - -var before: C = new C(); ->before : Symbol(before, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 3)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - -export default class C { ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - - method(): C { ->method : Symbol(C.method, Decl(es5ExportDefaultClassDeclaration3.ts, 3, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - - return new C(); ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - } -} - -var after: C = new C(); ->after : Symbol(after, Decl(es5ExportDefaultClassDeclaration3.ts, 9, 3)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - -var t: typeof C = C; ->t : Symbol(t, Decl(es5ExportDefaultClassDeclaration3.ts, 11, 3)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) ->C : Symbol(C, Decl(es5ExportDefaultClassDeclaration3.ts, 1, 24)) - - diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types deleted file mode 100644 index 1ed302ac45e..00000000000 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.types +++ /dev/null @@ -1,33 +0,0 @@ -=== tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts === - -var before: C = new C(); ->before : C ->C : C ->new C() : C ->C : typeof C - -export default class C { ->C : C - - method(): C { ->method : () => C ->C : C - - return new C(); ->new C() : C ->C : typeof C - } -} - -var after: C = new C(); ->after : C ->C : C ->new C() : C ->C : typeof C - -var t: typeof C = C; ->t : typeof C ->C : typeof C ->C : typeof C - - diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt b/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt new file mode 100644 index 00000000000..e484d4096bb --- /dev/null +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/exportAssignmentOfGenericType1_0.ts(1,10): error TS2449: Class 'T' used before its declaration. + + +==== tests/cases/compiler/exportAssignmentOfGenericType1_1.ts (0 errors) ==== + /// + import q = require("exportAssignmentOfGenericType1_0"); + + class M extends q { } + var m: M; + var r: string = m.foo; + +==== tests/cases/compiler/exportAssignmentOfGenericType1_0.ts (1 errors) ==== + export = T; + ~ +!!! error TS2449: Class 'T' used before its declaration. + class T { foo: X; } + \ No newline at end of file diff --git a/tests/baselines/reference/exportImport.errors.txt b/tests/baselines/reference/exportImport.errors.txt new file mode 100644 index 00000000000..fb5a41fe1eb --- /dev/null +++ b/tests/baselines/reference/exportImport.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/w1.ts(2,1): error TS2449: Class 'Widget1' used before its declaration. +tests/cases/compiler/w1.ts(2,10): error TS2449: Class 'Widget1' used before its declaration. + + +==== tests/cases/compiler/consumer.ts (0 errors) ==== + import e = require('./exporter'); + + export function w(): e.w { // Should be OK + return new e.w(); + } +==== tests/cases/compiler/w1.ts (2 errors) ==== + + export = Widget1 + ~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'Widget1' used before its declaration. + ~~~~~~~ +!!! error TS2449: Class 'Widget1' used before its declaration. + class Widget1 { name = 'one'; } + +==== tests/cases/compiler/exporter.ts (0 errors) ==== + export import w = require('./w1'); + \ No newline at end of file diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt index 2678fdf8667..64e5c7d3ef3 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts(1,23): error TS2690: A class must be declared after its base class. +tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts(1,23): error TS2449: Class 'base' used before its declaration. ==== tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts (1 errors) ==== class derived extends base { } ~~~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'base' used before its declaration. class base { constructor (public n: number) { } } \ No newline at end of file diff --git a/tests/baselines/reference/for-of14.errors.txt b/tests/baselines/reference/for-of14.errors.txt index ab95d042689..d4ec79620d9 100644 --- a/tests/baselines/reference/for-of14.errors.txt +++ b/tests/baselines/reference/for-of14.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/for-ofStatements/for-of14.ts(2,11): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. +tests/cases/conformance/es6/for-ofStatements/for-of14.ts(8,11): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. ==== tests/cases/conformance/es6/for-ofStatements/for-of14.ts (1 errors) ==== - var v: string; - for (v of new StringIterator) { } // Should fail because the iterator is not iterable - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. - class StringIterator { next() { return ""; } - } \ No newline at end of file + } + + var v: string; + for (v of new StringIterator) { } // Should fail because the iterator is not iterable + ~~~~~~~~~~~~~~~~~~ +!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/for-of14.js b/tests/baselines/reference/for-of14.js index 42832f8e58e..ac3af1ff1db 100644 --- a/tests/baselines/reference/for-of14.js +++ b/tests/baselines/reference/for-of14.js @@ -1,18 +1,18 @@ //// [for-of14.ts] -var v: string; -for (v of new StringIterator) { } // Should fail because the iterator is not iterable - class StringIterator { next() { return ""; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable //// [for-of14.js] -var v; -for (v of new StringIterator) { } // Should fail because the iterator is not iterable class StringIterator { next() { return ""; } } +var v; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable diff --git a/tests/baselines/reference/for-of15.errors.txt b/tests/baselines/reference/for-of15.errors.txt index 20a4abe4bd0..6d990aa01fc 100644 --- a/tests/baselines/reference/for-of15.errors.txt +++ b/tests/baselines/reference/for-of15.errors.txt @@ -1,12 +1,7 @@ -tests/cases/conformance/es6/for-ofStatements/for-of15.ts(2,11): error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. +tests/cases/conformance/es6/for-ofStatements/for-of15.ts(11,11): error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. ==== tests/cases/conformance/es6/for-ofStatements/for-of15.ts (1 errors) ==== - var v: string; - for (v of new StringIterator) { } // Should fail - ~~~~~~~~~~~~~~~~~~ -!!! error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. - class StringIterator { next() { return ""; @@ -14,4 +9,9 @@ tests/cases/conformance/es6/for-ofStatements/for-of15.ts(2,11): error TS2490: Th [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var v: string; + for (v of new StringIterator) { } // Should fail + ~~~~~~~~~~~~~~~~~~ +!!! error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. \ No newline at end of file diff --git a/tests/baselines/reference/for-of15.js b/tests/baselines/reference/for-of15.js index 62232745c8c..f88c8640168 100644 --- a/tests/baselines/reference/for-of15.js +++ b/tests/baselines/reference/for-of15.js @@ -1,7 +1,4 @@ //// [for-of15.ts] -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { next() { return ""; @@ -9,11 +6,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should fail //// [for-of15.js] -var v; -for (v of new StringIterator) { } // Should fail class StringIterator { next() { return ""; @@ -22,3 +20,5 @@ class StringIterator { return this; } } +var v; +for (v of new StringIterator) { } // Should fail diff --git a/tests/baselines/reference/for-of16.errors.txt b/tests/baselines/reference/for-of16.errors.txt index 20e3e876537..7574f98e3d8 100644 --- a/tests/baselines/reference/for-of16.errors.txt +++ b/tests/baselines/reference/for-of16.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/for-ofStatements/for-of16.ts(2,11): error TS2489: An iterator must have a 'next()' method. +tests/cases/conformance/es6/for-ofStatements/for-of16.ts(8,11): error TS2489: An iterator must have a 'next()' method. ==== tests/cases/conformance/es6/for-ofStatements/for-of16.ts (1 errors) ==== - var v: string; - for (v of new StringIterator) { } // Should fail - ~~~~~~~~~~~~~~~~~~ -!!! error TS2489: An iterator must have a 'next()' method. - class StringIterator { [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var v: string; + for (v of new StringIterator) { } // Should fail + ~~~~~~~~~~~~~~~~~~ +!!! error TS2489: An iterator must have a 'next()' method. \ No newline at end of file diff --git a/tests/baselines/reference/for-of16.js b/tests/baselines/reference/for-of16.js index 974be239fd7..2219e15a6f9 100644 --- a/tests/baselines/reference/for-of16.js +++ b/tests/baselines/reference/for-of16.js @@ -1,18 +1,18 @@ //// [for-of16.ts] -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should fail //// [for-of16.js] -var v; -for (v of new StringIterator) { } // Should fail class StringIterator { [Symbol.iterator]() { return this; } } +var v; +for (v of new StringIterator) { } // Should fail diff --git a/tests/baselines/reference/for-of17.errors.txt b/tests/baselines/reference/for-of17.errors.txt index dfdeb8db007..5a77815369f 100644 --- a/tests/baselines/reference/for-of17.errors.txt +++ b/tests/baselines/reference/for-of17.errors.txt @@ -1,12 +1,7 @@ -tests/cases/conformance/es6/for-ofStatements/for-of17.ts(2,6): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of17.ts(14,6): error TS2322: Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/es6/for-ofStatements/for-of17.ts (1 errors) ==== - var v: string; - for (v of new NumberIterator) { } // Should succeed - ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - class NumberIterator { next() { return { @@ -17,4 +12,9 @@ tests/cases/conformance/es6/for-ofStatements/for-of17.ts(2,6): error TS2322: Typ [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var v: string; + for (v of new NumberIterator) { } // Should succeed + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of17.js b/tests/baselines/reference/for-of17.js index a3927647005..2cd6bbe0d2e 100644 --- a/tests/baselines/reference/for-of17.js +++ b/tests/baselines/reference/for-of17.js @@ -1,7 +1,4 @@ //// [for-of17.ts] -var v: string; -for (v of new NumberIterator) { } // Should succeed - class NumberIterator { next() { return { @@ -12,11 +9,12 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new NumberIterator) { } // Should succeed //// [for-of17.js] -var v; -for (v of new NumberIterator) { } // Should succeed class NumberIterator { next() { return { @@ -28,3 +26,5 @@ class NumberIterator { return this; } } +var v; +for (v of new NumberIterator) { } // Should succeed diff --git a/tests/baselines/reference/for-of18.js b/tests/baselines/reference/for-of18.js index c31e6b6e8ca..fb7a684098a 100644 --- a/tests/baselines/reference/for-of18.js +++ b/tests/baselines/reference/for-of18.js @@ -1,7 +1,4 @@ //// [for-of18.ts] -var v: string; -for (v of new StringIterator) { } // Should succeed - class StringIterator { next() { return { @@ -12,11 +9,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var v: string; +for (v of new StringIterator) { } // Should succeed //// [for-of18.js] -var v; -for (v of new StringIterator) { } // Should succeed class StringIterator { next() { return { @@ -28,3 +26,5 @@ class StringIterator { return this; } } +var v; +for (v of new StringIterator) { } // Should succeed diff --git a/tests/baselines/reference/for-of18.symbols b/tests/baselines/reference/for-of18.symbols index b9d32662713..8f552c2757c 100644 --- a/tests/baselines/reference/for-of18.symbols +++ b/tests/baselines/reference/for-of18.symbols @@ -1,23 +1,16 @@ === tests/cases/conformance/es6/for-ofStatements/for-of18.ts === -var v: string; ->v : Symbol(v, Decl(for-of18.ts, 0, 3)) - -for (v of new StringIterator) { } // Should succeed ->v : Symbol(v, Decl(for-of18.ts, 0, 3)) ->StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) +>StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 0, 0)) next() { ->next : Symbol(StringIterator.next, Decl(for-of18.ts, 3, 22)) +>next : Symbol(StringIterator.next, Decl(for-of18.ts, 0, 22)) return { value: "", ->value : Symbol(value, Decl(for-of18.ts, 5, 16)) +>value : Symbol(value, Decl(for-of18.ts, 2, 16)) done: false ->done : Symbol(done, Decl(for-of18.ts, 6, 22)) +>done : Symbol(done, Decl(for-of18.ts, 3, 22)) }; } @@ -27,6 +20,14 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) +>this : Symbol(StringIterator, Decl(for-of18.ts, 0, 0)) } } + +var v: string; +>v : Symbol(v, Decl(for-of18.ts, 12, 3)) + +for (v of new StringIterator) { } // Should succeed +>v : Symbol(v, Decl(for-of18.ts, 12, 3)) +>StringIterator : Symbol(StringIterator, Decl(for-of18.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of18.types b/tests/baselines/reference/for-of18.types index 86978b62cc7..8b70c446254 100644 --- a/tests/baselines/reference/for-of18.types +++ b/tests/baselines/reference/for-of18.types @@ -1,12 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of18.ts === -var v: string; ->v : string - -for (v of new StringIterator) { } // Should succeed ->v : string ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -35,3 +27,12 @@ class StringIterator { >this : this } } + +var v: string; +>v : string + +for (v of new StringIterator) { } // Should succeed +>v : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of19.js b/tests/baselines/reference/for-of19.js index d0f95caa1e2..c0000d8d107 100644 --- a/tests/baselines/reference/for-of19.js +++ b/tests/baselines/reference/for-of19.js @@ -1,8 +1,4 @@ //// [for-of19.ts] -for (var v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (var v of new FooIterator) { + v; } //// [for-of19.js] -for (var v of new FooIterator) { - v; -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (var v of new FooIterator) { + v; +} diff --git a/tests/baselines/reference/for-of19.symbols b/tests/baselines/reference/for-of19.symbols index e1a129aa324..f36dd74f9b9 100644 --- a/tests/baselines/reference/for-of19.symbols +++ b/tests/baselines/reference/for-of19.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of19.ts === -for (var v of new FooIterator) { ->v : Symbol(v, Decl(for-of19.ts, 0, 8)) ->FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) - - v; ->v : Symbol(v, Decl(for-of19.ts, 0, 8)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of19.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of19.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of19.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of19.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of19.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of19.ts, 2, 1)) +>value : Symbol(value, Decl(for-of19.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of19.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of19.ts, 8, 27)) +>done : Symbol(done, Decl(for-of19.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of19.ts, 0, 13)) } } + +for (var v of new FooIterator) { +>v : Symbol(v, Decl(for-of19.ts, 13, 8)) +>FooIterator : Symbol(FooIterator, Decl(for-of19.ts, 0, 13)) + + v; +>v : Symbol(v, Decl(for-of19.ts, 13, 8)) +} diff --git a/tests/baselines/reference/for-of19.types b/tests/baselines/reference/for-of19.types index a2882ccf1ac..a62b2d64c8e 100644 --- a/tests/baselines/reference/for-of19.types +++ b/tests/baselines/reference/for-of19.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of19.ts === -for (var v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - v; ->v : Foo -} - class Foo { } >Foo : Foo @@ -40,3 +31,12 @@ class FooIterator { >this : this } } + +for (var v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} diff --git a/tests/baselines/reference/for-of20.js b/tests/baselines/reference/for-of20.js index c098abd2f73..97259778d26 100644 --- a/tests/baselines/reference/for-of20.js +++ b/tests/baselines/reference/for-of20.js @@ -1,8 +1,4 @@ //// [for-of20.ts] -for (let v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (let v of new FooIterator) { + v; } //// [for-of20.js] -for (let v of new FooIterator) { - v; -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (let v of new FooIterator) { + v; +} diff --git a/tests/baselines/reference/for-of20.symbols b/tests/baselines/reference/for-of20.symbols index 20b444e6bcc..5fff9fd7871 100644 --- a/tests/baselines/reference/for-of20.symbols +++ b/tests/baselines/reference/for-of20.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of20.ts === -for (let v of new FooIterator) { ->v : Symbol(v, Decl(for-of20.ts, 0, 8)) ->FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) - - v; ->v : Symbol(v, Decl(for-of20.ts, 0, 8)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of20.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of20.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of20.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of20.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of20.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of20.ts, 2, 1)) +>value : Symbol(value, Decl(for-of20.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of20.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of20.ts, 8, 27)) +>done : Symbol(done, Decl(for-of20.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of20.ts, 0, 13)) } } + +for (let v of new FooIterator) { +>v : Symbol(v, Decl(for-of20.ts, 13, 8)) +>FooIterator : Symbol(FooIterator, Decl(for-of20.ts, 0, 13)) + + v; +>v : Symbol(v, Decl(for-of20.ts, 13, 8)) +} diff --git a/tests/baselines/reference/for-of20.types b/tests/baselines/reference/for-of20.types index 9274c7f4b96..e620b603107 100644 --- a/tests/baselines/reference/for-of20.types +++ b/tests/baselines/reference/for-of20.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of20.ts === -for (let v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - v; ->v : Foo -} - class Foo { } >Foo : Foo @@ -40,3 +31,12 @@ class FooIterator { >this : this } } + +for (let v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} diff --git a/tests/baselines/reference/for-of21.js b/tests/baselines/reference/for-of21.js index 27da28e3b4f..66791de89b3 100644 --- a/tests/baselines/reference/for-of21.js +++ b/tests/baselines/reference/for-of21.js @@ -1,8 +1,4 @@ //// [for-of21.ts] -for (const v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + v; } //// [for-of21.js] -for (const v of new FooIterator) { - v; -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (const v of new FooIterator) { + v; +} diff --git a/tests/baselines/reference/for-of21.symbols b/tests/baselines/reference/for-of21.symbols index 71403edfc9e..0068c9ef4a8 100644 --- a/tests/baselines/reference/for-of21.symbols +++ b/tests/baselines/reference/for-of21.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of21.ts === -for (const v of new FooIterator) { ->v : Symbol(v, Decl(for-of21.ts, 0, 10)) ->FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) - - v; ->v : Symbol(v, Decl(for-of21.ts, 0, 10)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of21.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of21.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of21.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of21.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of21.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of21.ts, 2, 1)) +>value : Symbol(value, Decl(for-of21.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of21.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of21.ts, 8, 27)) +>done : Symbol(done, Decl(for-of21.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of21.ts, 0, 13)) } } + +for (const v of new FooIterator) { +>v : Symbol(v, Decl(for-of21.ts, 13, 10)) +>FooIterator : Symbol(FooIterator, Decl(for-of21.ts, 0, 13)) + + v; +>v : Symbol(v, Decl(for-of21.ts, 13, 10)) +} diff --git a/tests/baselines/reference/for-of21.types b/tests/baselines/reference/for-of21.types index 1366cb1a420..59c66b2a41e 100644 --- a/tests/baselines/reference/for-of21.types +++ b/tests/baselines/reference/for-of21.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of21.ts === -for (const v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - v; ->v : Foo -} - class Foo { } >Foo : Foo @@ -40,3 +31,12 @@ class FooIterator { >this : this } } + +for (const v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} diff --git a/tests/baselines/reference/for-of22.js b/tests/baselines/reference/for-of22.js index 886e8dba7c3..767ed1cc15d 100644 --- a/tests/baselines/reference/for-of22.js +++ b/tests/baselines/reference/for-of22.js @@ -1,9 +1,4 @@ //// [for-of22.ts] -v; -for (var v of new FooIterator) { - -} - class Foo { } class FooIterator { next() { @@ -15,12 +10,14 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +v; +for (var v of new FooIterator) { + } //// [for-of22.js] -v; -for (var v of new FooIterator) { -} class Foo { } class FooIterator { @@ -34,3 +31,6 @@ class FooIterator { return this; } } +v; +for (var v of new FooIterator) { +} diff --git a/tests/baselines/reference/for-of22.symbols b/tests/baselines/reference/for-of22.symbols index 36a522759cf..929cae4ed77 100644 --- a/tests/baselines/reference/for-of22.symbols +++ b/tests/baselines/reference/for-of22.symbols @@ -1,29 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of22.ts === -v; ->v : Symbol(v, Decl(for-of22.ts, 1, 8)) - -for (var v of new FooIterator) { ->v : Symbol(v, Decl(for-of22.ts, 1, 8)) ->FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) - -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of22.ts, 3, 1)) +>Foo : Symbol(Foo, Decl(for-of22.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of22.ts, 6, 19)) +>next : Symbol(FooIterator.next, Decl(for-of22.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of22.ts, 8, 16)) ->Foo : Symbol(Foo, Decl(for-of22.ts, 3, 1)) +>value : Symbol(value, Decl(for-of22.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of22.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of22.ts, 9, 27)) +>done : Symbol(done, Decl(for-of22.ts, 4, 27)) }; } @@ -33,6 +24,15 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) +>this : Symbol(FooIterator, Decl(for-of22.ts, 0, 13)) } } + +v; +>v : Symbol(v, Decl(for-of22.ts, 14, 8)) + +for (var v of new FooIterator) { +>v : Symbol(v, Decl(for-of22.ts, 14, 8)) +>FooIterator : Symbol(FooIterator, Decl(for-of22.ts, 0, 13)) + +} diff --git a/tests/baselines/reference/for-of22.types b/tests/baselines/reference/for-of22.types index 80cd42b2b33..e1449875da5 100644 --- a/tests/baselines/reference/for-of22.types +++ b/tests/baselines/reference/for-of22.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of22.ts === -v; ->v : Foo - -for (var v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - -} - class Foo { } >Foo : Foo @@ -41,3 +31,13 @@ class FooIterator { >this : this } } + +v; +>v : Foo + +for (var v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +} diff --git a/tests/baselines/reference/for-of23.js b/tests/baselines/reference/for-of23.js index f5649128c11..9ad03c0109a 100644 --- a/tests/baselines/reference/for-of23.js +++ b/tests/baselines/reference/for-of23.js @@ -1,8 +1,4 @@ //// [for-of23.ts] -for (const v of new FooIterator) { - const v = 0; // new scope -} - class Foo { } class FooIterator { next() { @@ -14,12 +10,13 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + const v = 0; // new scope } //// [for-of23.js] -for (const v of new FooIterator) { - const v = 0; // new scope -} class Foo { } class FooIterator { @@ -33,3 +30,6 @@ class FooIterator { return this; } } +for (const v of new FooIterator) { + const v = 0; // new scope +} diff --git a/tests/baselines/reference/for-of23.symbols b/tests/baselines/reference/for-of23.symbols index 3be07f4fd4a..7a57e38baf7 100644 --- a/tests/baselines/reference/for-of23.symbols +++ b/tests/baselines/reference/for-of23.symbols @@ -1,28 +1,20 @@ === tests/cases/conformance/es6/for-ofStatements/for-of23.ts === -for (const v of new FooIterator) { ->v : Symbol(v, Decl(for-of23.ts, 0, 10)) ->FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) - - const v = 0; // new scope ->v : Symbol(v, Decl(for-of23.ts, 1, 9)) -} - class Foo { } ->Foo : Symbol(Foo, Decl(for-of23.ts, 2, 1)) +>Foo : Symbol(Foo, Decl(for-of23.ts, 0, 0)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) +>FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 0, 13)) next() { ->next : Symbol(FooIterator.next, Decl(for-of23.ts, 5, 19)) +>next : Symbol(FooIterator.next, Decl(for-of23.ts, 1, 19)) return { value: new Foo, ->value : Symbol(value, Decl(for-of23.ts, 7, 16)) ->Foo : Symbol(Foo, Decl(for-of23.ts, 2, 1)) +>value : Symbol(value, Decl(for-of23.ts, 3, 16)) +>Foo : Symbol(Foo, Decl(for-of23.ts, 0, 0)) done: false ->done : Symbol(done, Decl(for-of23.ts, 8, 27)) +>done : Symbol(done, Decl(for-of23.ts, 4, 27)) }; } @@ -32,6 +24,14 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) +>this : Symbol(FooIterator, Decl(for-of23.ts, 0, 13)) } } + +for (const v of new FooIterator) { +>v : Symbol(v, Decl(for-of23.ts, 13, 10)) +>FooIterator : Symbol(FooIterator, Decl(for-of23.ts, 0, 13)) + + const v = 0; // new scope +>v : Symbol(v, Decl(for-of23.ts, 14, 9)) +} diff --git a/tests/baselines/reference/for-of23.types b/tests/baselines/reference/for-of23.types index ed74156f514..427eb57f5a1 100644 --- a/tests/baselines/reference/for-of23.types +++ b/tests/baselines/reference/for-of23.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of23.ts === -for (const v of new FooIterator) { ->v : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - - const v = 0; // new scope ->v : 0 ->0 : 0 -} - class Foo { } >Foo : Foo @@ -41,3 +31,13 @@ class FooIterator { >this : this } } + +for (const v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + const v = 0; // new scope +>v : 0 +>0 : 0 +} diff --git a/tests/baselines/reference/for-of25.js b/tests/baselines/reference/for-of25.js index 5715f6e8a3a..032efa52ae3 100644 --- a/tests/baselines/reference/for-of25.js +++ b/tests/baselines/reference/for-of25.js @@ -1,18 +1,18 @@ //// [for-of25.ts] -var x: any; -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return x; } -} +} + +var x: any; +for (var v of new StringIterator) { } //// [for-of25.js] -var x; -for (var v of new StringIterator) { } class StringIterator { [Symbol.iterator]() { return x; } } +var x; +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of25.symbols b/tests/baselines/reference/for-of25.symbols index e21348ba565..e9304e517bd 100644 --- a/tests/baselines/reference/for-of25.symbols +++ b/tests/baselines/reference/for-of25.symbols @@ -1,13 +1,6 @@ === tests/cases/conformance/es6/for-ofStatements/for-of25.ts === -var x: any; ->x : Symbol(x, Decl(for-of25.ts, 0, 3)) - -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of25.ts, 1, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 0, 0)) [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) @@ -15,6 +8,14 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return x; ->x : Symbol(x, Decl(for-of25.ts, 0, 3)) +>x : Symbol(x, Decl(for-of25.ts, 6, 3)) } } + +var x: any; +>x : Symbol(x, Decl(for-of25.ts, 6, 3)) + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of25.ts, 7, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of25.types b/tests/baselines/reference/for-of25.types index c4d6b32aebc..7a11b7acf67 100644 --- a/tests/baselines/reference/for-of25.types +++ b/tests/baselines/reference/for-of25.types @@ -1,12 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of25.ts === -var x: any; ->x : any - -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -19,3 +11,12 @@ class StringIterator { >x : any } } + +var x: any; +>x : any + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of26.js b/tests/baselines/reference/for-of26.js index 33319f50efa..ab9c4fdca92 100644 --- a/tests/baselines/reference/for-of26.js +++ b/tests/baselines/reference/for-of26.js @@ -1,7 +1,4 @@ //// [for-of26.ts] -var x: any; -for (var v of new StringIterator) { } - class StringIterator { next() { return x; @@ -9,11 +6,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +var x: any; +for (var v of new StringIterator) { } //// [for-of26.js] -var x; -for (var v of new StringIterator) { } class StringIterator { next() { return x; @@ -22,3 +20,5 @@ class StringIterator { return this; } } +var x; +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of26.symbols b/tests/baselines/reference/for-of26.symbols index 947240bf8e3..20473898253 100644 --- a/tests/baselines/reference/for-of26.symbols +++ b/tests/baselines/reference/for-of26.symbols @@ -1,19 +1,12 @@ === tests/cases/conformance/es6/for-ofStatements/for-of26.ts === -var x: any; ->x : Symbol(x, Decl(for-of26.ts, 0, 3)) - -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of26.ts, 1, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 0, 0)) next() { ->next : Symbol(StringIterator.next, Decl(for-of26.ts, 3, 22)) +>next : Symbol(StringIterator.next, Decl(for-of26.ts, 0, 22)) return x; ->x : Symbol(x, Decl(for-of26.ts, 0, 3)) +>x : Symbol(x, Decl(for-of26.ts, 9, 3)) } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) @@ -21,6 +14,14 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) +>this : Symbol(StringIterator, Decl(for-of26.ts, 0, 0)) } } + +var x: any; +>x : Symbol(x, Decl(for-of26.ts, 9, 3)) + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of26.ts, 10, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of26.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of26.types b/tests/baselines/reference/for-of26.types index fe930e2e57f..b0cfd891741 100644 --- a/tests/baselines/reference/for-of26.types +++ b/tests/baselines/reference/for-of26.types @@ -1,12 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of26.ts === -var x: any; ->x : any - -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -25,3 +17,12 @@ class StringIterator { >this : this } } + +var x: any; +>x : any + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of27.js b/tests/baselines/reference/for-of27.js index 1ac3a1dfc42..6adc66e241b 100644 --- a/tests/baselines/reference/for-of27.js +++ b/tests/baselines/reference/for-of27.js @@ -1,11 +1,11 @@ //// [for-of27.ts] -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]: any; -} +} + +for (var v of new StringIterator) { } //// [for-of27.js] -for (var v of new StringIterator) { } class StringIterator { } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of27.symbols b/tests/baselines/reference/for-of27.symbols index b2b733ab13b..4799a138351 100644 --- a/tests/baselines/reference/for-of27.symbols +++ b/tests/baselines/reference/for-of27.symbols @@ -1,13 +1,14 @@ === tests/cases/conformance/es6/for-ofStatements/for-of27.ts === -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of27.ts, 0, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 0)) [Symbol.iterator]: any; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) } + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of27.ts, 4, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of27.types b/tests/baselines/reference/for-of27.types index 8e9130ce272..f6115ccf8ce 100644 --- a/tests/baselines/reference/for-of27.types +++ b/tests/baselines/reference/for-of27.types @@ -1,9 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of27.ts === -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -12,3 +7,9 @@ class StringIterator { >Symbol : SymbolConstructor >iterator : symbol } + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of28.js b/tests/baselines/reference/for-of28.js index 78e86774813..e06e2fc6abc 100644 --- a/tests/baselines/reference/for-of28.js +++ b/tests/baselines/reference/for-of28.js @@ -1,17 +1,17 @@ //// [for-of28.ts] -for (var v of new StringIterator) { } - class StringIterator { next: any; [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of28.js] -for (var v of new StringIterator) { } class StringIterator { [Symbol.iterator]() { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of28.symbols b/tests/baselines/reference/for-of28.symbols index 52ed4fd7459..ad5ea53a80e 100644 --- a/tests/baselines/reference/for-of28.symbols +++ b/tests/baselines/reference/for-of28.symbols @@ -1,13 +1,9 @@ === tests/cases/conformance/es6/for-ofStatements/for-of28.ts === -for (var v of new StringIterator) { } ->v : Symbol(v, Decl(for-of28.ts, 0, 8)) ->StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) - class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) +>StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 0)) next: any; ->next : Symbol(StringIterator.next, Decl(for-of28.ts, 2, 22)) +>next : Symbol(StringIterator.next, Decl(for-of28.ts, 0, 22)) [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) @@ -15,6 +11,11 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) +>this : Symbol(StringIterator, Decl(for-of28.ts, 0, 0)) } } + +for (var v of new StringIterator) { } +>v : Symbol(v, Decl(for-of28.ts, 7, 8)) +>StringIterator : Symbol(StringIterator, Decl(for-of28.ts, 0, 0)) + diff --git a/tests/baselines/reference/for-of28.types b/tests/baselines/reference/for-of28.types index 882d2df6186..a454a0c4485 100644 --- a/tests/baselines/reference/for-of28.types +++ b/tests/baselines/reference/for-of28.types @@ -1,9 +1,4 @@ === tests/cases/conformance/es6/for-ofStatements/for-of28.ts === -for (var v of new StringIterator) { } ->v : any ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class StringIterator { >StringIterator : StringIterator @@ -19,3 +14,9 @@ class StringIterator { >this : this } } + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/for-of30.errors.txt b/tests/baselines/reference/for-of30.errors.txt index 6434b5294d5..b0091c90b57 100644 --- a/tests/baselines/reference/for-of30.errors.txt +++ b/tests/baselines/reference/for-of30.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +tests/cases/conformance/es6/for-ofStatements/for-of30.ts(16,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. Types of property '[Symbol.iterator]' are incompatible. Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. @@ -7,15 +7,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty ==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ==== - for (var v of new StringIterator) { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'return' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. - class StringIterator { next() { return { @@ -29,4 +20,13 @@ tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Ty [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'return' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of30.js b/tests/baselines/reference/for-of30.js index 37316774c95..935944db640 100644 --- a/tests/baselines/reference/for-of30.js +++ b/tests/baselines/reference/for-of30.js @@ -1,6 +1,4 @@ //// [for-of30.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -14,10 +12,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of30.js] -for (var v of new StringIterator) { } class StringIterator { constructor() { this.return = 0; @@ -32,3 +31,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of31.errors.txt b/tests/baselines/reference/for-of31.errors.txt index 6d5f6e816be..bf38e0f5008 100644 --- a/tests/baselines/reference/for-of31.errors.txt +++ b/tests/baselines/reference/for-of31.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +tests/cases/conformance/es6/for-ofStatements/for-of31.ts(14,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. Types of property '[Symbol.iterator]' are incompatible. Type '() => StringIterator' is not assignable to type '() => Iterator'. Type 'StringIterator' is not assignable to type 'Iterator'. @@ -9,17 +9,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty ==== tests/cases/conformance/es6/for-ofStatements/for-of31.ts (1 errors) ==== - for (var v of new StringIterator) { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult'. -!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult'. -!!! error TS2322: Property 'done' is missing in type '{ value: string; }'. - class StringIterator { next() { return { @@ -31,4 +20,15 @@ tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Ty [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult'. +!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'done' is missing in type '{ value: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of31.js b/tests/baselines/reference/for-of31.js index a92e827b91e..84e24bed5a9 100644 --- a/tests/baselines/reference/for-of31.js +++ b/tests/baselines/reference/for-of31.js @@ -1,6 +1,4 @@ //// [for-of31.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -12,10 +10,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of31.js] -for (var v of new StringIterator) { } class StringIterator { next() { return { @@ -27,3 +26,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of33.errors.txt b/tests/baselines/reference/for-of33.errors.txt index ff1feacd7b3..eba30ce9bf9 100644 --- a/tests/baselines/reference/for-of33.errors.txt +++ b/tests/baselines/reference/for-of33.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/es6/for-ofStatements/for-of33.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/conformance/es6/for-ofStatements/for-of33.ts(4,5): error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of33.ts(2,5): error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of33.ts(7,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ==== tests/cases/conformance/es6/for-ofStatements/for-of33.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~ -!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. - class StringIterator { [Symbol.iterator]() { ~~~~~~~~~~~~~~~~~ !!! error TS7023: '[Symbol.iterator]' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. return v; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of33.js b/tests/baselines/reference/for-of33.js index b63aeedf774..e77d3cf5de8 100644 --- a/tests/baselines/reference/for-of33.js +++ b/tests/baselines/reference/for-of33.js @@ -1,16 +1,16 @@ //// [for-of33.ts] -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return v; } -} +} + +for (var v of new StringIterator) { } //// [for-of33.js] -for (var v of new StringIterator) { } class StringIterator { [Symbol.iterator]() { return v; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of34.errors.txt b/tests/baselines/reference/for-of34.errors.txt index c378a8f5bb8..2d53ecb0a20 100644 --- a/tests/baselines/reference/for-of34.errors.txt +++ b/tests/baselines/reference/for-of34.errors.txt @@ -1,12 +1,8 @@ -tests/cases/conformance/es6/for-ofStatements/for-of34.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/conformance/es6/for-ofStatements/for-of34.ts(4,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of34.ts(2,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of34.ts(11,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ==== tests/cases/conformance/es6/for-ofStatements/for-of34.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~ -!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. - class StringIterator { next() { ~~~~ @@ -17,4 +13,8 @@ tests/cases/conformance/es6/for-ofStatements/for-of34.ts(4,5): error TS7023: 'ne [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of34.js b/tests/baselines/reference/for-of34.js index f61f04ea955..2d9af61d1a3 100644 --- a/tests/baselines/reference/for-of34.js +++ b/tests/baselines/reference/for-of34.js @@ -1,6 +1,4 @@ //// [for-of34.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return v; @@ -9,10 +7,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of34.js] -for (var v of new StringIterator) { } class StringIterator { next() { return v; @@ -21,3 +20,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/for-of35.errors.txt b/tests/baselines/reference/for-of35.errors.txt index 58fb5056fd7..6f14a24fb96 100644 --- a/tests/baselines/reference/for-of35.errors.txt +++ b/tests/baselines/reference/for-of35.errors.txt @@ -1,12 +1,8 @@ -tests/cases/conformance/es6/for-ofStatements/for-of35.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. -tests/cases/conformance/es6/for-ofStatements/for-of35.ts(4,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of35.ts(2,5): error TS7023: 'next' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +tests/cases/conformance/es6/for-ofStatements/for-of35.ts(14,10): error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. ==== tests/cases/conformance/es6/for-ofStatements/for-of35.ts (2 errors) ==== - for (var v of new StringIterator) { } - ~ -!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. - class StringIterator { next() { ~~~~ @@ -20,4 +16,8 @@ tests/cases/conformance/es6/for-ofStatements/for-of35.ts(4,5): error TS7023: 'ne [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of35.js b/tests/baselines/reference/for-of35.js index c7d7c5890dd..a73f873d7ce 100644 --- a/tests/baselines/reference/for-of35.js +++ b/tests/baselines/reference/for-of35.js @@ -1,6 +1,4 @@ //// [for-of35.ts] -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -12,10 +10,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +for (var v of new StringIterator) { } //// [for-of35.js] -for (var v of new StringIterator) { } class StringIterator { next() { return { @@ -27,3 +26,4 @@ class StringIterator { return this; } } +for (var v of new StringIterator) { } diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt index 1962576abcd..d259a2d2e27 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(1,17): error TS2690: A class must be declared after its base class. -tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(2,20): error TS2690: A class must be declared after its base class. +tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(1,17): error TS2449: Class 'B' used before its declaration. +tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(2,20): error TS2449: Class 'C' used before its declaration. ==== tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts (2 errors) ==== class A extends B { } - ~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~ +!!! error TS2449: Class 'B' used before its declaration. class B extends C { } ~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'C' used before its declaration. class C { constructor(p: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReference.errors.txt b/tests/baselines/reference/indirectSelfReference.errors.txt index 3f7d3d47f12..0339dd8ed08 100644 --- a/tests/baselines/reference/indirectSelfReference.errors.txt +++ b/tests/baselines/reference/indirectSelfReference.errors.txt @@ -1,11 +1,14 @@ tests/cases/compiler/indirectSelfReference.ts(1,7): error TS2506: 'a' is referenced directly or indirectly in its own base expression. +tests/cases/compiler/indirectSelfReference.ts(1,17): error TS2449: Class 'b' used before its declaration. tests/cases/compiler/indirectSelfReference.ts(2,7): error TS2506: 'b' is referenced directly or indirectly in its own base expression. -==== tests/cases/compiler/indirectSelfReference.ts (2 errors) ==== +==== tests/cases/compiler/indirectSelfReference.ts (3 errors) ==== class a extends b{ } ~ !!! error TS2506: 'a' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'b' used before its declaration. class b extends a{ } ~ !!! error TS2506: 'b' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt index 5a6aeed5de1..d1cdbf1da58 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt @@ -1,11 +1,14 @@ tests/cases/compiler/indirectSelfReferenceGeneric.ts(1,7): error TS2506: 'a' is referenced directly or indirectly in its own base expression. +tests/cases/compiler/indirectSelfReferenceGeneric.ts(1,20): error TS2449: Class 'b' used before its declaration. tests/cases/compiler/indirectSelfReferenceGeneric.ts(2,7): error TS2506: 'b' is referenced directly or indirectly in its own base expression. -==== tests/cases/compiler/indirectSelfReferenceGeneric.ts (2 errors) ==== +==== tests/cases/compiler/indirectSelfReferenceGeneric.ts (3 errors) ==== class a extends b { } ~ !!! error TS2506: 'a' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'b' used before its declaration. class b extends a { } ~ !!! error TS2506: 'b' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern1.js b/tests/baselines/reference/iterableArrayPattern1.js index b45ac92d1fd..6061b9950da 100644 --- a/tests/baselines/reference/iterableArrayPattern1.js +++ b/tests/baselines/reference/iterableArrayPattern1.js @@ -1,5 +1,4 @@ //// [iterableArrayPattern1.ts] -var [a, b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var [a, b] = new SymbolIterator; //// [iterableArrayPattern1.js] -var [a, b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -26,3 +26,4 @@ class SymbolIterator { return this; } } +var [a, b] = new SymbolIterator; diff --git a/tests/baselines/reference/iterableArrayPattern1.symbols b/tests/baselines/reference/iterableArrayPattern1.symbols index 4921fc8ec9c..b901b43b7b9 100644 --- a/tests/baselines/reference/iterableArrayPattern1.symbols +++ b/tests/baselines/reference/iterableArrayPattern1.symbols @@ -1,22 +1,17 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts === -var [a, b] = new SymbolIterator; ->a : Symbol(a, Decl(iterableArrayPattern1.ts, 0, 5)) ->b : Symbol(b, Decl(iterableArrayPattern1.ts, 0, 7)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern1.ts, 1, 22)) +>next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern1.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16)) +>value : Symbol(value, Decl(iterableArrayPattern1.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28)) +>done : Symbol(done, Decl(iterableArrayPattern1.ts, 3, 28)) }; } @@ -27,6 +22,12 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) +>this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 0)) } } + +var [a, b] = new SymbolIterator; +>a : Symbol(a, Decl(iterableArrayPattern1.ts, 13, 5)) +>b : Symbol(b, Decl(iterableArrayPattern1.ts, 13, 7)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 0)) + diff --git a/tests/baselines/reference/iterableArrayPattern1.types b/tests/baselines/reference/iterableArrayPattern1.types index 816ce7ac6cf..e7d307b2cb9 100644 --- a/tests/baselines/reference/iterableArrayPattern1.types +++ b/tests/baselines/reference/iterableArrayPattern1.types @@ -1,10 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts === -var [a, b] = new SymbolIterator; ->a : symbol ->b : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -35,3 +29,10 @@ class SymbolIterator { >this : this } } + +var [a, b] = new SymbolIterator; +>a : symbol +>b : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iterableArrayPattern10.errors.txt b/tests/baselines/reference/iterableArrayPattern10.errors.txt index f06c4d7de17..f0b3e14c9fd 100644 --- a/tests/baselines/reference/iterableArrayPattern10.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern10.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(17,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. Property '0' is missing in type 'FooIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts (1 errors) ==== - function fun([a, b]) { } - fun(new FooIterator); - ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. -!!! error TS2345: Property '0' is missing in type 'FooIterator'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun([a, b]) { } + fun(new FooIterator); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[any, any]'. +!!! error TS2345: Property '0' is missing in type 'FooIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern10.js b/tests/baselines/reference/iterableArrayPattern10.js index c8d37e3f894..530a21d6a16 100644 --- a/tests/baselines/reference/iterableArrayPattern10.js +++ b/tests/baselines/reference/iterableArrayPattern10.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern10.ts] -function fun([a, b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, b]) { } +fun(new FooIterator); //// [iterableArrayPattern10.js] -function fun([a, b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern11.js b/tests/baselines/reference/iterableArrayPattern11.js index 85ed4ab9710..92a9d9e200a 100644 --- a/tests/baselines/reference/iterableArrayPattern11.js +++ b/tests/baselines/reference/iterableArrayPattern11.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern11.ts] -function fun([a, b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,13 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, b] = new FooIterator) { } +fun(new FooIterator); + //// [iterableArrayPattern11.js] -function fun([a, b] = new FooIterator) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +34,5 @@ class FooIterator { return this; } } +function fun([a, b] = new FooIterator) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern11.symbols b/tests/baselines/reference/iterableArrayPattern11.symbols index e1b3713f9dd..36871283fbf 100644 --- a/tests/baselines/reference/iterableArrayPattern11.symbols +++ b/tests/baselines/reference/iterableArrayPattern11.symbols @@ -1,36 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts === -function fun([a, b] = new FooIterator) { } ->fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 0, 0)) ->a : Symbol(a, Decl(iterableArrayPattern11.ts, 0, 14)) ->b : Symbol(b, Decl(iterableArrayPattern11.ts, 0, 16)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) - -fun(new FooIterator); ->fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 0, 0)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 1, 21)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern11.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern11.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 1, 21)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern11.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern11.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern11.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern11.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern11.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern11.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern11.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern11.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern11.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern11.ts, 5, 27)) }; } @@ -41,6 +31,17 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) } } + +function fun([a, b] = new FooIterator) { } +>fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 13, 1)) +>a : Symbol(a, Decl(iterableArrayPattern11.ts, 15, 14)) +>b : Symbol(b, Decl(iterableArrayPattern11.ts, 15, 16)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) + +fun(new FooIterator); +>fun : Symbol(fun, Decl(iterableArrayPattern11.ts, 13, 1)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern11.types b/tests/baselines/reference/iterableArrayPattern11.types index 0acadd7cfc8..d3fa43d2f1b 100644 --- a/tests/baselines/reference/iterableArrayPattern11.types +++ b/tests/baselines/reference/iterableArrayPattern11.types @@ -1,17 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts === -function fun([a, b] = new FooIterator) { } ->fun : ([a, b]?: FooIterator) => void ->a : Foo ->b : Foo ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - -fun(new FooIterator); ->fun(new FooIterator) : void ->fun : ([a, b]?: FooIterator) => void ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -51,3 +38,17 @@ class FooIterator { >this : this } } + +function fun([a, b] = new FooIterator) { } +>fun : ([a, b]?: FooIterator) => void +>a : Foo +>b : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +fun(new FooIterator); +>fun(new FooIterator) : void +>fun : ([a, b]?: FooIterator) => void +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern12.js b/tests/baselines/reference/iterableArrayPattern12.js index 4856af9cb48..89694ffa0cd 100644 --- a/tests/baselines/reference/iterableArrayPattern12.js +++ b/tests/baselines/reference/iterableArrayPattern12.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern12.ts] -function fun([a, ...b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, ...b] = new FooIterator) { } +fun(new FooIterator); //// [iterableArrayPattern12.js] -function fun([a, ...b] = new FooIterator) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, ...b] = new FooIterator) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern12.symbols b/tests/baselines/reference/iterableArrayPattern12.symbols index 4044544d17b..cb876370876 100644 --- a/tests/baselines/reference/iterableArrayPattern12.symbols +++ b/tests/baselines/reference/iterableArrayPattern12.symbols @@ -1,36 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts === -function fun([a, ...b] = new FooIterator) { } ->fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 0, 0)) ->a : Symbol(a, Decl(iterableArrayPattern12.ts, 0, 14)) ->b : Symbol(b, Decl(iterableArrayPattern12.ts, 0, 16)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) - -fun(new FooIterator); ->fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 0, 0)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 1, 21)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern12.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern12.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 1, 21)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern12.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern12.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern12.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern12.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern12.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern12.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern12.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern12.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern12.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern12.ts, 5, 27)) }; } @@ -41,6 +31,17 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) } } + +function fun([a, ...b] = new FooIterator) { } +>fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 13, 1)) +>a : Symbol(a, Decl(iterableArrayPattern12.ts, 15, 14)) +>b : Symbol(b, Decl(iterableArrayPattern12.ts, 15, 16)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) + +fun(new FooIterator); +>fun : Symbol(fun, Decl(iterableArrayPattern12.ts, 13, 1)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern12.types b/tests/baselines/reference/iterableArrayPattern12.types index c00e1daae81..3c50058b3e0 100644 --- a/tests/baselines/reference/iterableArrayPattern12.types +++ b/tests/baselines/reference/iterableArrayPattern12.types @@ -1,17 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts === -function fun([a, ...b] = new FooIterator) { } ->fun : ([a, ...b]?: FooIterator) => void ->a : Foo ->b : Foo[] ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - -fun(new FooIterator); ->fun(new FooIterator) : void ->fun : ([a, ...b]?: FooIterator) => void ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -51,3 +38,17 @@ class FooIterator { >this : this } } + +function fun([a, ...b] = new FooIterator) { } +>fun : ([a, ...b]?: FooIterator) => void +>a : Foo +>b : Foo[] +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +fun(new FooIterator); +>fun(new FooIterator) : void +>fun : ([a, ...b]?: FooIterator) => void +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern13.js b/tests/baselines/reference/iterableArrayPattern13.js index 06f9901a851..efbce2bfd13 100644 --- a/tests/baselines/reference/iterableArrayPattern13.js +++ b/tests/baselines/reference/iterableArrayPattern13.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern13.ts] -function fun([a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, ...b]) { } +fun(new FooIterator); //// [iterableArrayPattern13.js] -function fun([a, ...b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, ...b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern13.symbols b/tests/baselines/reference/iterableArrayPattern13.symbols index c04d66fa6d4..25241ab24b8 100644 --- a/tests/baselines/reference/iterableArrayPattern13.symbols +++ b/tests/baselines/reference/iterableArrayPattern13.symbols @@ -1,35 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts === -function fun([a, ...b]) { } ->fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 0, 0)) ->a : Symbol(a, Decl(iterableArrayPattern13.ts, 0, 14)) ->b : Symbol(b, Decl(iterableArrayPattern13.ts, 0, 16)) - -fun(new FooIterator); ->fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 0, 0)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 1, 21)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern13.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern13.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 1, 21)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern13.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern13.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern13.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern13.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern13.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern13.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern13.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern13.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern13.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern13.ts, 5, 27)) }; } @@ -40,6 +31,16 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 1, 27)) } } + +function fun([a, ...b]) { } +>fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 13, 1)) +>a : Symbol(a, Decl(iterableArrayPattern13.ts, 15, 14)) +>b : Symbol(b, Decl(iterableArrayPattern13.ts, 15, 16)) + +fun(new FooIterator); +>fun : Symbol(fun, Decl(iterableArrayPattern13.ts, 13, 1)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern13.types b/tests/baselines/reference/iterableArrayPattern13.types index 04dab57748d..724a0795efa 100644 --- a/tests/baselines/reference/iterableArrayPattern13.types +++ b/tests/baselines/reference/iterableArrayPattern13.types @@ -1,15 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts === -function fun([a, ...b]) { } ->fun : ([a, ...b]: Iterable) => void ->a : any ->b : any[] - -fun(new FooIterator); ->fun(new FooIterator) : void ->fun : ([a, ...b]: Iterable) => void ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -49,3 +38,15 @@ class FooIterator { >this : this } } + +function fun([a, ...b]) { } +>fun : ([a, ...b]: Iterable) => void +>a : any +>b : any[] + +fun(new FooIterator); +>fun(new FooIterator) : void +>fun : ([a, ...b]: Iterable) => void +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern14.errors.txt b/tests/baselines/reference/iterableArrayPattern14.errors.txt index a14ddc45022..664f73e13a0 100644 --- a/tests/baselines/reference/iterableArrayPattern14.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern14.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts (1 errors) ==== - function fun(...[a, ...b]) { } - ~~~~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts(1,17): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[a, ...b]) { } + ~~~~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(new FooIterator); \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern14.js b/tests/baselines/reference/iterableArrayPattern14.js index a3595b0df0c..bb1d416f4f2 100644 --- a/tests/baselines/reference/iterableArrayPattern14.js +++ b/tests/baselines/reference/iterableArrayPattern14.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern14.ts] -function fun(...[a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[a, ...b]) { } +fun(new FooIterator); //// [iterableArrayPattern14.js] -function fun(...[a, ...b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun(...[a, ...b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern15.errors.txt b/tests/baselines/reference/iterableArrayPattern15.errors.txt index bb2d1eb096d..ce7559de94f 100644 --- a/tests/baselines/reference/iterableArrayPattern15.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern15.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts (1 errors) ==== - function fun(...[a, b]: Bar[]) { } - ~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(...new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts(1,17): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[a, b]: Bar[]) { } + ~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(...new FooIterator); \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern15.js b/tests/baselines/reference/iterableArrayPattern15.js index 1c2050129ce..d14fd1b364e 100644 --- a/tests/baselines/reference/iterableArrayPattern15.js +++ b/tests/baselines/reference/iterableArrayPattern15.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern15.ts] -function fun(...[a, b]: Bar[]) { } -fun(...new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[a, b]: Bar[]) { } +fun(...new FooIterator); //// [iterableArrayPattern15.js] -function fun(...[a, b]) { } -fun(...new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun(...[a, b]) { } +fun(...new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern16.errors.txt b/tests/baselines/reference/iterableArrayPattern16.errors.txt index e03d0a799da..ba5531a0a54 100644 --- a/tests/baselines/reference/iterableArrayPattern16.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern16.errors.txt @@ -1,9 +1,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[Bar, Bar]'. Property '0' is missing in type 'FooIterator'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,12): error TS2449: Class 'FooIteratorIterator' used before its declaration. -==== tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts (2 errors) ==== +==== tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts (3 errors) ==== function fun(...[a, b]: [Bar, Bar][]) { } ~~~~~~ !!! error TS2501: A rest element cannot contain a binding pattern. @@ -11,6 +12,8 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,5): error ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[Bar, Bar]'. !!! error TS2345: Property '0' is missing in type 'FooIterator'. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'FooIteratorIterator' used before its declaration. class Bar { x } class Foo extends Bar { y } class FooIterator { diff --git a/tests/baselines/reference/iterableArrayPattern17.errors.txt b/tests/baselines/reference/iterableArrayPattern17.errors.txt index 3cc04fadd11..d22d8580c71 100644 --- a/tests/baselines/reference/iterableArrayPattern17.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern17.errors.txt @@ -1,16 +1,9 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. -tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(17,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. Property 'x' is missing in type 'FooIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts (2 errors) ==== - function fun(...[a, b]: Bar[]) { } - ~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(new FooIterator); - ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. -!!! error TS2345: Property 'x' is missing in type 'FooIterator'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -24,4 +17,12 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[a, b]: Bar[]) { } + ~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(new FooIterator); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar'. +!!! error TS2345: Property 'x' is missing in type 'FooIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern17.js b/tests/baselines/reference/iterableArrayPattern17.js index c6274aabcd9..e9979380af6 100644 --- a/tests/baselines/reference/iterableArrayPattern17.js +++ b/tests/baselines/reference/iterableArrayPattern17.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern17.ts] -function fun(...[a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[a, b]: Bar[]) { } +fun(new FooIterator); //// [iterableArrayPattern17.js] -function fun(...[a, b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun(...[a, b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern18.errors.txt b/tests/baselines/reference/iterableArrayPattern18.errors.txt index c6f8c5e28bd..a3f8b6f840f 100644 --- a/tests/baselines/reference/iterableArrayPattern18.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern18.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(2,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(17,5): error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. Property 'length' is missing in type 'FooIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts (1 errors) ==== - function fun([a, b]: Bar[]) { } - fun(new FooIterator); - ~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. -!!! error TS2345: Property 'length' is missing in type 'FooIterator'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun([a, b]: Bar[]) { } + fun(new FooIterator); + ~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type 'Bar[]'. +!!! error TS2345: Property 'length' is missing in type 'FooIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern18.js b/tests/baselines/reference/iterableArrayPattern18.js index e2016c47690..93b038cd32d 100644 --- a/tests/baselines/reference/iterableArrayPattern18.js +++ b/tests/baselines/reference/iterableArrayPattern18.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern18.ts] -function fun([a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([a, b]: Bar[]) { } +fun(new FooIterator); //// [iterableArrayPattern18.js] -function fun([a, b]) { } -fun(new FooIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +function fun([a, b]) { } +fun(new FooIterator); diff --git a/tests/baselines/reference/iterableArrayPattern19.errors.txt b/tests/baselines/reference/iterableArrayPattern19.errors.txt index 3f8b550d287..f4a9fac0a06 100644 --- a/tests/baselines/reference/iterableArrayPattern19.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern19.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(2,5): error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(17,5): error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. Property 'length' is missing in type 'FooArrayIterator'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts (1 errors) ==== - function fun([[a], b]: Bar[][]) { } - fun(new FooArrayIterator); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. -!!! error TS2345: Property 'length' is missing in type 'FooArrayIterator'. class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(2,5): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun([[a], b]: Bar[][]) { } + fun(new FooArrayIterator); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'FooArrayIterator' is not assignable to parameter of type 'Bar[][]'. +!!! error TS2345: Property 'length' is missing in type 'FooArrayIterator'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern19.js b/tests/baselines/reference/iterableArrayPattern19.js index bc3cf33afc2..3c930957f4d 100644 --- a/tests/baselines/reference/iterableArrayPattern19.js +++ b/tests/baselines/reference/iterableArrayPattern19.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern19.ts] -function fun([[a], b]: Bar[][]) { } -fun(new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,11 +12,12 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} +} + +function fun([[a], b]: Bar[][]) { } +fun(new FooArrayIterator); //// [iterableArrayPattern19.js] -function fun([[a], b]) { } -fun(new FooArrayIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooArrayIterator { return this; } } +function fun([[a], b]) { } +fun(new FooArrayIterator); diff --git a/tests/baselines/reference/iterableArrayPattern2.js b/tests/baselines/reference/iterableArrayPattern2.js index 7392db7d6b2..aab7ad9ec60 100644 --- a/tests/baselines/reference/iterableArrayPattern2.js +++ b/tests/baselines/reference/iterableArrayPattern2.js @@ -1,5 +1,4 @@ //// [iterableArrayPattern2.ts] -var [a, ...b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var [a, ...b] = new SymbolIterator; //// [iterableArrayPattern2.js] -var [a, ...b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -26,3 +26,4 @@ class SymbolIterator { return this; } } +var [a, ...b] = new SymbolIterator; diff --git a/tests/baselines/reference/iterableArrayPattern2.symbols b/tests/baselines/reference/iterableArrayPattern2.symbols index 50d3352b9e7..db700cdd572 100644 --- a/tests/baselines/reference/iterableArrayPattern2.symbols +++ b/tests/baselines/reference/iterableArrayPattern2.symbols @@ -1,22 +1,17 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts === -var [a, ...b] = new SymbolIterator; ->a : Symbol(a, Decl(iterableArrayPattern2.ts, 0, 5)) ->b : Symbol(b, Decl(iterableArrayPattern2.ts, 0, 7)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern2.ts, 1, 22)) +>next : Symbol(SymbolIterator.next, Decl(iterableArrayPattern2.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16)) +>value : Symbol(value, Decl(iterableArrayPattern2.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28)) +>done : Symbol(done, Decl(iterableArrayPattern2.ts, 3, 28)) }; } @@ -27,6 +22,12 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) +>this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 0)) } } + +var [a, ...b] = new SymbolIterator; +>a : Symbol(a, Decl(iterableArrayPattern2.ts, 13, 5)) +>b : Symbol(b, Decl(iterableArrayPattern2.ts, 13, 7)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 0)) + diff --git a/tests/baselines/reference/iterableArrayPattern2.types b/tests/baselines/reference/iterableArrayPattern2.types index 63786a1d351..6a1bc9eb6f0 100644 --- a/tests/baselines/reference/iterableArrayPattern2.types +++ b/tests/baselines/reference/iterableArrayPattern2.types @@ -1,10 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts === -var [a, ...b] = new SymbolIterator; ->a : symbol ->b : symbol[] ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -35,3 +29,10 @@ class SymbolIterator { >this : this } } + +var [a, ...b] = new SymbolIterator; +>a : symbol +>b : symbol[] +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iterableArrayPattern20.errors.txt b/tests/baselines/reference/iterableArrayPattern20.errors.txt index 4451a814bd5..23f133238ce 100644 --- a/tests/baselines/reference/iterableArrayPattern20.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern20.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts(1,17): error TS2501: A rest element cannot contain a binding pattern. +tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts(16,17): error TS2501: A rest element cannot contain a binding pattern. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts (1 errors) ==== - function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2501: A rest element cannot contain a binding pattern. - fun(...new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts(1,17): error [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2501: A rest element cannot contain a binding pattern. + fun(...new FooArrayIterator); \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern20.js b/tests/baselines/reference/iterableArrayPattern20.js index 489f97a29f3..a327cb3e477 100644 --- a/tests/baselines/reference/iterableArrayPattern20.js +++ b/tests/baselines/reference/iterableArrayPattern20.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern20.ts] -function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } -fun(...new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,11 +12,12 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} +} + +function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } +fun(...new FooArrayIterator); //// [iterableArrayPattern20.js] -function fun(...[[a = new Foo], b = [new Foo]]) { } -fun(...new FooArrayIterator); class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooArrayIterator { return this; } } +function fun(...[[a = new Foo], b = [new Foo]]) { } +fun(...new FooArrayIterator); diff --git a/tests/baselines/reference/iterableArrayPattern3.js b/tests/baselines/reference/iterableArrayPattern3.js index 7136c6ab209..e29a67af731 100644 --- a/tests/baselines/reference/iterableArrayPattern3.js +++ b/tests/baselines/reference/iterableArrayPattern3.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern3.ts] -var a: Bar, b: Bar; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: Bar; +[a, b] = new FooIterator; //// [iterableArrayPattern3.js] -var a, b; -[a, b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern3.symbols b/tests/baselines/reference/iterableArrayPattern3.symbols index 6cf09801382..a82c5f5e025 100644 --- a/tests/baselines/reference/iterableArrayPattern3.symbols +++ b/tests/baselines/reference/iterableArrayPattern3.symbols @@ -1,37 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts === -var a: Bar, b: Bar; ->a : Symbol(a, Decl(iterableArrayPattern3.ts, 0, 3)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->b : Symbol(b, Decl(iterableArrayPattern3.ts, 0, 11)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) - -[a, b] = new FooIterator; ->a : Symbol(a, Decl(iterableArrayPattern3.ts, 0, 3)) ->b : Symbol(b, Decl(iterableArrayPattern3.ts, 0, 11)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern3.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern3.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 1, 25)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern3.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern3.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern3.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern3.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern3.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern3.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern3.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern3.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern3.ts, 5, 27)) }; } @@ -42,6 +31,18 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 1, 27)) } } + +var a: Bar, b: Bar; +>a : Symbol(a, Decl(iterableArrayPattern3.ts, 15, 3)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) +>b : Symbol(b, Decl(iterableArrayPattern3.ts, 15, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern3.ts, 0, 0)) + +[a, b] = new FooIterator; +>a : Symbol(a, Decl(iterableArrayPattern3.ts, 15, 3)) +>b : Symbol(b, Decl(iterableArrayPattern3.ts, 15, 11)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern3.types b/tests/baselines/reference/iterableArrayPattern3.types index a21e702526b..b138c8629d4 100644 --- a/tests/baselines/reference/iterableArrayPattern3.types +++ b/tests/baselines/reference/iterableArrayPattern3.types @@ -1,18 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts === -var a: Bar, b: Bar; ->a : Bar ->Bar : Bar ->b : Bar ->Bar : Bar - -[a, b] = new FooIterator; ->[a, b] = new FooIterator : FooIterator ->[a, b] : [Bar, Bar] ->a : Bar ->b : Bar ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -52,3 +38,18 @@ class FooIterator { >this : this } } + +var a: Bar, b: Bar; +>a : Bar +>Bar : Bar +>b : Bar +>Bar : Bar + +[a, b] = new FooIterator; +>[a, b] = new FooIterator : FooIterator +>[a, b] : [Bar, Bar] +>a : Bar +>b : Bar +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern4.js b/tests/baselines/reference/iterableArrayPattern4.js index 6e60dadbd7a..c53b6ef4162 100644 --- a/tests/baselines/reference/iterableArrayPattern4.js +++ b/tests/baselines/reference/iterableArrayPattern4.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern4.ts] -var a: Bar, b: Bar[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: Bar[]; +[a, ...b] = new FooIterator //// [iterableArrayPattern4.js] -var a, b; -[a, ...b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, ...b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern4.symbols b/tests/baselines/reference/iterableArrayPattern4.symbols index 651c60cf08f..6a3526a3482 100644 --- a/tests/baselines/reference/iterableArrayPattern4.symbols +++ b/tests/baselines/reference/iterableArrayPattern4.symbols @@ -1,37 +1,26 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts === -var a: Bar, b: Bar[]; ->a : Symbol(a, Decl(iterableArrayPattern4.ts, 0, 3)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->b : Symbol(b, Decl(iterableArrayPattern4.ts, 0, 11)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) - -[a, ...b] = new FooIterator; ->a : Symbol(a, Decl(iterableArrayPattern4.ts, 0, 3)) ->b : Symbol(b, Decl(iterableArrayPattern4.ts, 0, 11)) ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) - class Bar { x } ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->x : Symbol(Bar.x, Decl(iterableArrayPattern4.ts, 2, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) +>x : Symbol(Bar.x, Decl(iterableArrayPattern4.ts, 0, 11)) class Foo extends Bar { y } ->Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 2, 15)) ->Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 1, 28)) ->y : Symbol(Foo.y, Decl(iterableArrayPattern4.ts, 3, 23)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 0, 15)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) +>y : Symbol(Foo.y, Decl(iterableArrayPattern4.ts, 1, 23)) class FooIterator { ->FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 1, 27)) next() { ->next : Symbol(FooIterator.next, Decl(iterableArrayPattern4.ts, 4, 19)) +>next : Symbol(FooIterator.next, Decl(iterableArrayPattern4.ts, 2, 19)) return { value: new Foo, ->value : Symbol(value, Decl(iterableArrayPattern4.ts, 6, 16)) ->Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 2, 15)) +>value : Symbol(value, Decl(iterableArrayPattern4.ts, 4, 16)) +>Foo : Symbol(Foo, Decl(iterableArrayPattern4.ts, 0, 15)) done: false ->done : Symbol(done, Decl(iterableArrayPattern4.ts, 7, 27)) +>done : Symbol(done, Decl(iterableArrayPattern4.ts, 5, 27)) }; } @@ -42,6 +31,18 @@ class FooIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) +>this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 1, 27)) } } + +var a: Bar, b: Bar[]; +>a : Symbol(a, Decl(iterableArrayPattern4.ts, 15, 3)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) +>b : Symbol(b, Decl(iterableArrayPattern4.ts, 15, 11)) +>Bar : Symbol(Bar, Decl(iterableArrayPattern4.ts, 0, 0)) + +[a, ...b] = new FooIterator +>a : Symbol(a, Decl(iterableArrayPattern4.ts, 15, 3)) +>b : Symbol(b, Decl(iterableArrayPattern4.ts, 15, 11)) +>FooIterator : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 1, 27)) + diff --git a/tests/baselines/reference/iterableArrayPattern4.types b/tests/baselines/reference/iterableArrayPattern4.types index a3be4114498..1024f4c9670 100644 --- a/tests/baselines/reference/iterableArrayPattern4.types +++ b/tests/baselines/reference/iterableArrayPattern4.types @@ -1,19 +1,4 @@ === tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts === -var a: Bar, b: Bar[]; ->a : Bar ->Bar : Bar ->b : Bar[] ->Bar : Bar - -[a, ...b] = new FooIterator; ->[a, ...b] = new FooIterator : FooIterator ->[a, ...b] : Bar[] ->a : Bar ->...b : Bar ->b : Bar[] ->new FooIterator : FooIterator ->FooIterator : typeof FooIterator - class Bar { x } >Bar : Bar >x : any @@ -53,3 +38,19 @@ class FooIterator { >this : this } } + +var a: Bar, b: Bar[]; +>a : Bar +>Bar : Bar +>b : Bar[] +>Bar : Bar + +[a, ...b] = new FooIterator +>[a, ...b] = new FooIterator : FooIterator +>[a, ...b] : Bar[] +>a : Bar +>...b : Bar +>b : Bar[] +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + diff --git a/tests/baselines/reference/iterableArrayPattern5.errors.txt b/tests/baselines/reference/iterableArrayPattern5.errors.txt index ca540d805be..1bbbe268e6c 100644 --- a/tests/baselines/reference/iterableArrayPattern5.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern5.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts(2,5): error TS2322: Type 'Foo' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts(17,5): error TS2322: Type 'Foo' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts (1 errors) ==== - var a: Bar, b: string; - [a, b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo' is not assignable to type 'string'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts(2,5): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string; + [a, b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern5.js b/tests/baselines/reference/iterableArrayPattern5.js index 77e71cac6d3..56ed70b1379 100644 --- a/tests/baselines/reference/iterableArrayPattern5.js +++ b/tests/baselines/reference/iterableArrayPattern5.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern5.ts] -var a: Bar, b: string; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string; +[a, b] = new FooIterator; //// [iterableArrayPattern5.js] -var a, b; -[a, b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern6.errors.txt b/tests/baselines/reference/iterableArrayPattern6.errors.txt index e0a546d154c..3a20f1f52c5 100644 --- a/tests/baselines/reference/iterableArrayPattern6.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern6.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts(2,8): error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts(17,8): error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. Type 'Foo' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts (1 errors) ==== - var a: Bar, b: string[]; - [a, ...b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. -!!! error TS2322: Type 'Foo' is not assignable to type 'string'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts(2,8): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string[]; + [a, ...b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo[]' is not assignable to type 'string[]'. +!!! error TS2322: Type 'Foo' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern6.js b/tests/baselines/reference/iterableArrayPattern6.js index 8c797e819f5..1053cced9cb 100644 --- a/tests/baselines/reference/iterableArrayPattern6.js +++ b/tests/baselines/reference/iterableArrayPattern6.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern6.ts] -var a: Bar, b: string[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string[]; +[a, ...b] = new FooIterator; //// [iterableArrayPattern6.js] -var a, b; -[a, ...b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, ...b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern7.errors.txt b/tests/baselines/reference/iterableArrayPattern7.errors.txt index 997cc21f38b..972de74039f 100644 --- a/tests/baselines/reference/iterableArrayPattern7.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern7.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts(2,5): error TS2322: Type 'Foo' is not assignable to type 'string[]'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts(17,5): error TS2322: Type 'Foo' is not assignable to type 'string[]'. Property 'length' is missing in type 'Foo'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts (1 errors) ==== - var a: Bar, b: string[]; - [a, b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo' is not assignable to type 'string[]'. -!!! error TS2322: Property 'length' is missing in type 'Foo'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -21,4 +16,10 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts(2,5): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string[]; + [a, b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo' is not assignable to type 'string[]'. +!!! error TS2322: Property 'length' is missing in type 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern7.js b/tests/baselines/reference/iterableArrayPattern7.js index 3f79e6bfba8..74b25f1ec62 100644 --- a/tests/baselines/reference/iterableArrayPattern7.js +++ b/tests/baselines/reference/iterableArrayPattern7.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern7.ts] -var a: Bar, b: string[]; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string[]; +[a, b] = new FooIterator; //// [iterableArrayPattern7.js] -var a, b; -[a, b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, b] = new FooIterator; diff --git a/tests/baselines/reference/iterableArrayPattern8.errors.txt b/tests/baselines/reference/iterableArrayPattern8.errors.txt index c06e0c9543f..94c6e9593ef 100644 --- a/tests/baselines/reference/iterableArrayPattern8.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern8.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts(2,8): error TS2322: Type 'Foo[]' is not assignable to type 'string'. +tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts(17,8): error TS2322: Type 'Foo[]' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts (1 errors) ==== - var a: Bar, b: string; - [a, ...b] = new FooIterator; - ~ -!!! error TS2322: Type 'Foo[]' is not assignable to type 'string'. class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -19,4 +15,9 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts(2,8): error T [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var a: Bar, b: string; + [a, ...b] = new FooIterator; + ~ +!!! error TS2322: Type 'Foo[]' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern8.js b/tests/baselines/reference/iterableArrayPattern8.js index dd1c76c1f51..b943953b152 100644 --- a/tests/baselines/reference/iterableArrayPattern8.js +++ b/tests/baselines/reference/iterableArrayPattern8.js @@ -1,6 +1,4 @@ //// [iterableArrayPattern8.ts] -var a: Bar, b: string; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,11 +12,12 @@ class FooIterator { [Symbol.iterator]() { return this; } -} +} + +var a: Bar, b: string; +[a, ...b] = new FooIterator; //// [iterableArrayPattern8.js] -var a, b; -[a, ...b] = new FooIterator; class Bar { } class Foo extends Bar { @@ -34,3 +33,5 @@ class FooIterator { return this; } } +var a, b; +[a, ...b] = new FooIterator; diff --git a/tests/baselines/reference/iteratorSpreadInArray.js b/tests/baselines/reference/iteratorSpreadInArray.js index 8e25a2e7ecf..0b64eb4b409 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.js +++ b/tests/baselines/reference/iteratorSpreadInArray.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,12 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new SymbolIterator]; + //// [iteratorSpreadInArray.js] -var array = [...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +27,4 @@ class SymbolIterator { return this; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray.symbols b/tests/baselines/reference/iteratorSpreadInArray.symbols index 7fc2d469eae..6d6656f0f71 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray.symbols @@ -1,21 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts === -var array = [...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray.ts, 0, 3)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray.ts, 3, 28)) }; } @@ -26,6 +22,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 0)) } } + +var array = [...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray.ts, 13, 3)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray.types b/tests/baselines/reference/iteratorSpreadInArray.types index 4b5a63e5d57..9d43fa57b07 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.types +++ b/tests/baselines/reference/iteratorSpreadInArray.types @@ -1,11 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts === -var array = [...new SymbolIterator]; ->array : symbol[] ->[...new SymbolIterator] : symbol[] ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -36,3 +29,11 @@ class SymbolIterator { >this : this } } + +var array = [...new SymbolIterator]; +>array : symbol[] +>[...new SymbolIterator] : symbol[] +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray10.errors.txt b/tests/baselines/reference/iteratorSpreadInArray10.errors.txt index 90cde7d03b1..28a878ac431 100644 --- a/tests/baselines/reference/iteratorSpreadInArray10.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray10.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts(1,17): error TS2489: An iterator must have a 'next()' method. +tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts(7,17): error TS2489: An iterator must have a 'next()' method. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts (1 errors) ==== - var array = [...new SymbolIterator]; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2489: An iterator must have a 'next()' method. - class SymbolIterator { [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array = [...new SymbolIterator]; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2489: An iterator must have a 'next()' method. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray10.js b/tests/baselines/reference/iteratorSpreadInArray10.js index 1004dbd7b34..196ca7c714b 100644 --- a/tests/baselines/reference/iteratorSpreadInArray10.js +++ b/tests/baselines/reference/iteratorSpreadInArray10.js @@ -1,16 +1,16 @@ //// [iteratorSpreadInArray10.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new SymbolIterator]; //// [iteratorSpreadInArray10.js] -var array = [...new SymbolIterator]; class SymbolIterator { [Symbol.iterator]() { return this; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray2.js b/tests/baselines/reference/iteratorSpreadInArray2.js index aa4a1099a40..e766016389e 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.js +++ b/tests/baselines/reference/iteratorSpreadInArray2.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray2.ts] -var array = [...new NumberIterator, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -25,10 +23,12 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new NumberIterator, ...new SymbolIterator]; + //// [iteratorSpreadInArray2.js] -var array = [...new NumberIterator, ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -51,3 +51,4 @@ class NumberIterator { return this; } } +var array = [...new NumberIterator, ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray2.symbols b/tests/baselines/reference/iteratorSpreadInArray2.symbols index 8d39834c17f..6fd22547ee6 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray2.symbols @@ -1,22 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts === -var array = [...new NumberIterator, ...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray2.ts, 0, 3)) ->NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray2.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray2.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 3, 28)) }; } @@ -27,22 +22,22 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 0)) } } class NumberIterator { ->NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) +>NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 11, 1)) next() { ->next : Symbol(NumberIterator.next, Decl(iteratorSpreadInArray2.ts, 15, 22)) +>next : Symbol(NumberIterator.next, Decl(iteratorSpreadInArray2.ts, 13, 22)) return { value: 0, ->value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 17, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 15, 16)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 18, 21)) +>done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 16, 21)) }; } @@ -53,6 +48,12 @@ class NumberIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) +>this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 11, 1)) } } + +var array = [...new NumberIterator, ...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray2.ts, 26, 3)) +>NumberIterator : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 11, 1)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray2.types b/tests/baselines/reference/iteratorSpreadInArray2.types index 19bf5eab004..440a2bebcf8 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.types +++ b/tests/baselines/reference/iteratorSpreadInArray2.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts === -var array = [...new NumberIterator, ...new SymbolIterator]; ->array : (number | symbol)[] ->[...new NumberIterator, ...new SymbolIterator] : (number | symbol)[] ->...new NumberIterator : number ->new NumberIterator : NumberIterator ->NumberIterator : typeof NumberIterator ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -69,3 +59,14 @@ class NumberIterator { >this : this } } + +var array = [...new NumberIterator, ...new SymbolIterator]; +>array : (number | symbol)[] +>[...new NumberIterator, ...new SymbolIterator] : (number | symbol)[] +>...new NumberIterator : number +>new NumberIterator : NumberIterator +>NumberIterator : typeof NumberIterator +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray3.js b/tests/baselines/reference/iteratorSpreadInArray3.js index 1d468e4483e..239a95020f0 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.js +++ b/tests/baselines/reference/iteratorSpreadInArray3.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray3.ts] -var array = [...[0, 1], ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...[0, 1], ...new SymbolIterator]; //// [iteratorSpreadInArray3.js] -var array = [...[0, 1], ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +26,4 @@ class SymbolIterator { return this; } } +var array = [...[0, 1], ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray3.symbols b/tests/baselines/reference/iteratorSpreadInArray3.symbols index c110733dd66..ff6bc66e9d3 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray3.symbols @@ -1,21 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts === -var array = [...[0, 1], ...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray3.ts, 0, 3)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray3.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray3.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 3, 28)) }; } @@ -26,6 +22,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 0)) } } + +var array = [...[0, 1], ...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray3.ts, 13, 3)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray3.types b/tests/baselines/reference/iteratorSpreadInArray3.types index 1fd29bb2381..b4c8f36f6de 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.types +++ b/tests/baselines/reference/iteratorSpreadInArray3.types @@ -1,15 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts === -var array = [...[0, 1], ...new SymbolIterator]; ->array : (number | symbol)[] ->[...[0, 1], ...new SymbolIterator] : (number | symbol)[] ->...[0, 1] : number ->[0, 1] : number[] ->0 : 0 ->1 : 1 ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -40,3 +29,15 @@ class SymbolIterator { >this : this } } + +var array = [...[0, 1], ...new SymbolIterator]; +>array : (number | symbol)[] +>[...[0, 1], ...new SymbolIterator] : (number | symbol)[] +>...[0, 1] : number +>[0, 1] : number[] +>0 : 0 +>1 : 1 +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray4.js b/tests/baselines/reference/iteratorSpreadInArray4.js index 82a08bfa964..95443f760cd 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.js +++ b/tests/baselines/reference/iteratorSpreadInArray4.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray4.ts] -var array = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [0, 1, ...new SymbolIterator]; //// [iteratorSpreadInArray4.js] -var array = [0, 1, ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +26,4 @@ class SymbolIterator { return this; } } +var array = [0, 1, ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray4.symbols b/tests/baselines/reference/iteratorSpreadInArray4.symbols index e1159ee0e96..16fa1c62c6c 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray4.symbols @@ -1,21 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts === -var array = [0, 1, ...new SymbolIterator]; ->array : Symbol(array, Decl(iteratorSpreadInArray4.ts, 0, 3)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray4.ts, 2, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray4.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 4, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 5, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 3, 28)) }; } @@ -26,6 +22,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 0)) } } + +var array = [0, 1, ...new SymbolIterator]; +>array : Symbol(array, Decl(iteratorSpreadInArray4.ts, 13, 3)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray4.types b/tests/baselines/reference/iteratorSpreadInArray4.types index 6024e79dee5..d473416113f 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.types +++ b/tests/baselines/reference/iteratorSpreadInArray4.types @@ -1,13 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts === -var array = [0, 1, ...new SymbolIterator]; ->array : (number | symbol)[] ->[0, 1, ...new SymbolIterator] : (number | symbol)[] ->0 : 0 ->1 : 1 ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -38,3 +29,13 @@ class SymbolIterator { >this : this } } + +var array = [0, 1, ...new SymbolIterator]; +>array : (number | symbol)[] +>[0, 1, ...new SymbolIterator] : (number | symbol)[] +>0 : 0 +>1 : 1 +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray5.errors.txt b/tests/baselines/reference/iteratorSpreadInArray5.errors.txt index 498cc7d48ef..02049824c4f 100644 --- a/tests/baselines/reference/iteratorSpreadInArray5.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray5.errors.txt @@ -1,15 +1,9 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts(1,5): error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts(14,5): error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. Type 'number | symbol' is not assignable to type 'number'. Type 'symbol' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts (1 errors) ==== - var array: number[] = [0, 1, ...new SymbolIterator]; - ~~~~~ -!!! error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. -!!! error TS2322: Type 'number | symbol' is not assignable to type 'number'. -!!! error TS2322: Type 'symbol' is not assignable to type 'number'. - class SymbolIterator { next() { return { @@ -21,4 +15,10 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts(1,5): error TS2322: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array: number[] = [0, 1, ...new SymbolIterator]; + ~~~~~ +!!! error TS2322: Type '(number | symbol)[]' is not assignable to type 'number[]'. +!!! error TS2322: Type 'number | symbol' is not assignable to type 'number'. +!!! error TS2322: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray5.js b/tests/baselines/reference/iteratorSpreadInArray5.js index 0aa158a5dc2..ee0bf116760 100644 --- a/tests/baselines/reference/iteratorSpreadInArray5.js +++ b/tests/baselines/reference/iteratorSpreadInArray5.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray5.ts] -var array: number[] = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,10 +10,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array: number[] = [0, 1, ...new SymbolIterator]; //// [iteratorSpreadInArray5.js] -var array = [0, 1, ...new SymbolIterator]; class SymbolIterator { next() { return { @@ -27,3 +26,4 @@ class SymbolIterator { return this; } } +var array = [0, 1, ...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index 8148ce43de7..e9b6954e6e3 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -1,16 +1,9 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(2,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. Type 'symbol[]' is not assignable to type 'number[]'. Type 'symbol' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts (1 errors) ==== - var array: number[] = [0, 1]; - array.concat([...new SymbolIterator]); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. -!!! error TS2345: Type 'symbol' is not assignable to type 'number'. - class SymbolIterator { next() { return { @@ -22,4 +15,11 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(2,14): error TS2345 [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array: number[] = [0, 1]; + array.concat([...new SymbolIterator]); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[]'. +!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2345: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray6.js b/tests/baselines/reference/iteratorSpreadInArray6.js index 02d1c435b8c..36b5fcf5cfc 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.js +++ b/tests/baselines/reference/iteratorSpreadInArray6.js @@ -1,7 +1,4 @@ //// [iteratorSpreadInArray6.ts] -var array: number[] = [0, 1]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,11 +10,12 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array: number[] = [0, 1]; +array.concat([...new SymbolIterator]); //// [iteratorSpreadInArray6.js] -var array = [0, 1]; -array.concat([...new SymbolIterator]); class SymbolIterator { next() { return { @@ -29,3 +27,5 @@ class SymbolIterator { return this; } } +var array = [0, 1]; +array.concat([...new SymbolIterator]); diff --git a/tests/baselines/reference/iteratorSpreadInArray7.js b/tests/baselines/reference/iteratorSpreadInArray7.js index 72a614ae4ec..aa209609b21 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.js +++ b/tests/baselines/reference/iteratorSpreadInArray7.js @@ -1,7 +1,4 @@ //// [iteratorSpreadInArray7.ts] -var array: symbol[]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,11 +10,12 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array: symbol[]; +array.concat([...new SymbolIterator]); //// [iteratorSpreadInArray7.js] -var array; -array.concat([...new SymbolIterator]); class SymbolIterator { next() { return { @@ -29,3 +27,5 @@ class SymbolIterator { return this; } } +var array; +array.concat([...new SymbolIterator]); diff --git a/tests/baselines/reference/iteratorSpreadInArray7.symbols b/tests/baselines/reference/iteratorSpreadInArray7.symbols index 57774bcd7ee..534741a62a6 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray7.symbols @@ -1,26 +1,17 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts === -var array: symbol[]; ->array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) - -array.concat([...new SymbolIterator]); ->array.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) ->concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) - class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 0, 0)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray7.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInArray7.ts, 0, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 5, 16)) +>value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 2, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 6, 28)) +>done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 3, 28)) }; } @@ -31,6 +22,16 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 0, 0)) } } + +var array: symbol[]; +>array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 13, 3)) + +array.concat([...new SymbolIterator]); +>array.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 13, 3)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 0, 0)) + diff --git a/tests/baselines/reference/iteratorSpreadInArray7.types b/tests/baselines/reference/iteratorSpreadInArray7.types index ef0e3898e0f..b102c72486b 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.types +++ b/tests/baselines/reference/iteratorSpreadInArray7.types @@ -1,17 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts === -var array: symbol[]; ->array : symbol[] - -array.concat([...new SymbolIterator]); ->array.concat([...new SymbolIterator]) : symbol[] ->array.concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } ->array : symbol[] ->concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } ->[...new SymbolIterator] : symbol[] ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - class SymbolIterator { >SymbolIterator : SymbolIterator @@ -42,3 +29,17 @@ class SymbolIterator { >this : this } } + +var array: symbol[]; +>array : symbol[] + +array.concat([...new SymbolIterator]); +>array.concat([...new SymbolIterator]) : symbol[] +>array.concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } +>array : symbol[] +>concat : { (...items: symbol[][]): symbol[]; (...items: (symbol | symbol[])[]): symbol[]; } +>[...new SymbolIterator] : symbol[] +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInArray8.errors.txt b/tests/baselines/reference/iteratorSpreadInArray8.errors.txt index 365bc8db9c2..1f8c9629424 100644 --- a/tests/baselines/reference/iteratorSpreadInArray8.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray8.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts(1,17): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. +tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts(10,17): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts (1 errors) ==== - var array = [...new SymbolIterator]; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. - class SymbolIterator { next() { return { @@ -13,4 +9,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts(1,17): error TS2488 done: false }; } - } \ No newline at end of file + } + + var array = [...new SymbolIterator]; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray8.js b/tests/baselines/reference/iteratorSpreadInArray8.js index 08378699129..c2a0becb0d3 100644 --- a/tests/baselines/reference/iteratorSpreadInArray8.js +++ b/tests/baselines/reference/iteratorSpreadInArray8.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray8.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -8,10 +6,11 @@ class SymbolIterator { done: false }; } -} +} + +var array = [...new SymbolIterator]; //// [iteratorSpreadInArray8.js] -var array = [...new SymbolIterator]; class SymbolIterator { next() { return { @@ -20,3 +19,4 @@ class SymbolIterator { }; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInArray9.errors.txt b/tests/baselines/reference/iteratorSpreadInArray9.errors.txt index 90b8bdbeb46..5f43bb4f5ae 100644 --- a/tests/baselines/reference/iteratorSpreadInArray9.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(13,17): error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. Types of property '[Symbol.iterator]' are incompatible. Type '() => SymbolIterator' is not assignable to type '() => Iterator'. Type 'SymbolIterator' is not assignable to type 'Iterator'. @@ -9,17 +9,6 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322 ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts (1 errors) ==== - var array = [...new SymbolIterator]; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. -!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. -!!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator'. -!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult'. -!!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult'. -!!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'. - class SymbolIterator { next() { return { @@ -30,4 +19,15 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts(1,17): error TS2322 [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + var array = [...new SymbolIterator]; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => SymbolIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'SymbolIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '() => { value: symbol; }' is not assignable to type '(value?: any) => IteratorResult'. +!!! error TS2322: Type '{ value: symbol; }' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'done' is missing in type '{ value: symbol; }'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray9.js b/tests/baselines/reference/iteratorSpreadInArray9.js index ed0a9b4ebe9..8b3a02e5e18 100644 --- a/tests/baselines/reference/iteratorSpreadInArray9.js +++ b/tests/baselines/reference/iteratorSpreadInArray9.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInArray9.ts] -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -11,10 +9,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +var array = [...new SymbolIterator]; //// [iteratorSpreadInArray9.js] -var array = [...new SymbolIterator]; class SymbolIterator { next() { return { @@ -25,3 +24,4 @@ class SymbolIterator { return this; } } +var array = [...new SymbolIterator]; diff --git a/tests/baselines/reference/iteratorSpreadInCall.errors.txt b/tests/baselines/reference/iteratorSpreadInCall.errors.txt index 614153192d7..d26f9ab6447 100644 --- a/tests/baselines/reference/iteratorSpreadInCall.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s: symbol) { } class SymbolIterator { next() { @@ -18,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts(1,1): error TS2346: S [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall.js b/tests/baselines/reference/iteratorSpreadInCall.js index f3bf17c0327..a4b17cfb5ef 100644 --- a/tests/baselines/reference/iteratorSpreadInCall.js +++ b/tests/baselines/reference/iteratorSpreadInCall.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall.ts] -foo(...new SymbolIterator); - function foo(s: symbol) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall.js] -foo(...new SymbolIterator); function foo(s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall10.errors.txt b/tests/baselines/reference/iteratorSpreadInCall10.errors.txt index 04d9045e86c..bf478012c5d 100644 --- a/tests/baselines/reference/iteratorSpreadInCall10.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall10.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -19,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts(1,1): error TS2346: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall10.js b/tests/baselines/reference/iteratorSpreadInCall10.js index 14a08c97009..9fb1cf20a6e 100644 --- a/tests/baselines/reference/iteratorSpreadInCall10.js +++ b/tests/baselines/reference/iteratorSpreadInCall10.js @@ -1,8 +1,5 @@ //// [iteratorSpreadInCall10.ts] -foo(...new SymbolIterator); - function foo(s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall10.js] -foo(...new SymbolIterator); function foo(s) { return s[0]; } class SymbolIterator { next() { @@ -30,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall11.js b/tests/baselines/reference/iteratorSpreadInCall11.js index d01eb259ef3..adfbb03d71c 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.js +++ b/tests/baselines/reference/iteratorSpreadInCall11.js @@ -1,8 +1,5 @@ //// [iteratorSpreadInCall11.ts] -foo(...new SymbolIterator); - function foo(...s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall11.js] -foo(...new SymbolIterator); function foo(...s) { return s[0]; } class SymbolIterator { next() { @@ -30,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall11.symbols b/tests/baselines/reference/iteratorSpreadInCall11.symbols index 098a7b9b9ce..b6db07942d0 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall11.symbols @@ -1,28 +1,24 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts === -foo(...new SymbolIterator); ->foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 27)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) - function foo(...s: T[]) { return s[0] } ->foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 27)) ->T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 2, 13)) ->s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 2, 16)) ->T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 2, 13)) ->s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 2, 16)) +>foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 0)) +>T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 0, 13)) +>s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 0, 16)) +>T : Symbol(T, Decl(iteratorSpreadInCall11.ts, 0, 13)) +>s : Symbol(s, Decl(iteratorSpreadInCall11.ts, 0, 16)) class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 0, 42)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall11.ts, 4, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall11.ts, 1, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 6, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 3, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 7, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 4, 28)) }; } @@ -33,6 +29,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 0, 42)) } } + +foo(...new SymbolIterator); +>foo : Symbol(foo, Decl(iteratorSpreadInCall11.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 0, 42)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall11.types b/tests/baselines/reference/iteratorSpreadInCall11.types index 5990b26df64..4a3d73d36d0 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.types +++ b/tests/baselines/reference/iteratorSpreadInCall11.types @@ -1,11 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts === -foo(...new SymbolIterator); ->foo(...new SymbolIterator) : symbol ->foo : (...s: T[]) => T ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - function foo(...s: T[]) { return s[0] } >foo : (...s: T[]) => T >T : T @@ -45,3 +38,11 @@ class SymbolIterator { >this : this } } + +foo(...new SymbolIterator); +>foo(...new SymbolIterator) : symbol +>foo : (...s: T[]) => T +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall12.js b/tests/baselines/reference/iteratorSpreadInCall12.js index b138192826d..ba8149e29d6 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.js +++ b/tests/baselines/reference/iteratorSpreadInCall12.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall12.ts] -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); - class Foo { constructor(...s: T[]) { } } @@ -29,10 +27,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); //// [iteratorSpreadInCall12.js] -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); class Foo { constructor(...s) { } } @@ -58,3 +57,4 @@ class StringIterator { return this; } } +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); diff --git a/tests/baselines/reference/iteratorSpreadInCall12.symbols b/tests/baselines/reference/iteratorSpreadInCall12.symbols index f989860f04e..983ab8fcd90 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall12.symbols @@ -1,31 +1,26 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts === -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); ->Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 64)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) - class Foo { ->Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 64)) ->T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 2, 10)) +>Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 0)) +>T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 0, 10)) constructor(...s: T[]) { } ->s : Symbol(s, Decl(iteratorSpreadInCall12.ts, 3, 16)) ->T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 2, 10)) +>s : Symbol(s, Decl(iteratorSpreadInCall12.ts, 1, 16)) +>T : Symbol(T, Decl(iteratorSpreadInCall12.ts, 0, 10)) } class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 2, 1)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall12.ts, 6, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall12.ts, 4, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 8, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 6, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 9, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 7, 28)) }; } @@ -36,22 +31,22 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 2, 1)) } } class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 15, 1)) next() { ->next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall12.ts, 19, 22)) +>next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall12.ts, 17, 22)) return { value: "", ->value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 21, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 19, 16)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 22, 22)) +>done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 20, 22)) }; } @@ -62,6 +57,12 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) +>this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 15, 1)) } } + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); +>Foo : Symbol(Foo, Decl(iteratorSpreadInCall12.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 2, 1)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 15, 1)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall12.types b/tests/baselines/reference/iteratorSpreadInCall12.types index b614fdde16b..55986b57645 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.types +++ b/tests/baselines/reference/iteratorSpreadInCall12.types @@ -1,18 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts === -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); ->new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo ->Foo : typeof Foo ->...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol ->[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator ->...[...new StringIterator] : string ->[...new StringIterator] : string[] ->...new StringIterator : string ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - class Foo { >Foo : Foo >T : T @@ -82,3 +68,18 @@ class StringIterator { >this : this } } + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); +>new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo +>Foo : typeof Foo +>...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol +>[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[] +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator +>...[...new StringIterator] : string +>[...new StringIterator] : string[] +>...new StringIterator : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall2.errors.txt b/tests/baselines/reference/iteratorSpreadInCall2.errors.txt index bd994ab37b0..abf8fc71ed7 100644 --- a/tests/baselines/reference/iteratorSpreadInCall2.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall2.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s: symbol[]) { } class SymbolIterator { next() { @@ -18,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts(1,1): error TS2346: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall2.js b/tests/baselines/reference/iteratorSpreadInCall2.js index 6c3517857d5..e858a7cd721 100644 --- a/tests/baselines/reference/iteratorSpreadInCall2.js +++ b/tests/baselines/reference/iteratorSpreadInCall2.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall2.ts] -foo(...new SymbolIterator); - function foo(s: symbol[]) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall2.js] -foo(...new SymbolIterator); function foo(s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall3.js b/tests/baselines/reference/iteratorSpreadInCall3.js index b33ceae7bfd..9dd0c23add7 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.js +++ b/tests/baselines/reference/iteratorSpreadInCall3.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall3.ts] -foo(...new SymbolIterator); - function foo(...s: symbol[]) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall3.js] -foo(...new SymbolIterator); function foo(...s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall3.symbols b/tests/baselines/reference/iteratorSpreadInCall3.symbols index 8557b6c8319..d8f414bcd72 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall3.symbols @@ -1,25 +1,21 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts === -foo(...new SymbolIterator); ->foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 27)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) - function foo(...s: symbol[]) { } ->foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 27)) ->s : Symbol(s, Decl(iteratorSpreadInCall3.ts, 2, 13)) +>foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 0)) +>s : Symbol(s, Decl(iteratorSpreadInCall3.ts, 0, 13)) class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 0, 32)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall3.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall3.ts, 1, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 5, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 3, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 6, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 4, 28)) }; } @@ -30,6 +26,11 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 0, 32)) } } + +foo(...new SymbolIterator); +>foo : Symbol(foo, Decl(iteratorSpreadInCall3.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 0, 32)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall3.types b/tests/baselines/reference/iteratorSpreadInCall3.types index 56b7f6db6d1..fef9f7dcab7 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.types +++ b/tests/baselines/reference/iteratorSpreadInCall3.types @@ -1,11 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts === -foo(...new SymbolIterator); ->foo(...new SymbolIterator) : void ->foo : (...s: symbol[]) => void ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator - function foo(...s: symbol[]) { } >foo : (...s: symbol[]) => void >s : symbol[] @@ -40,3 +33,11 @@ class SymbolIterator { >this : this } } + +foo(...new SymbolIterator); +>foo(...new SymbolIterator) : void +>foo : (...s: symbol[]) => void +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall4.errors.txt b/tests/baselines/reference/iteratorSpreadInCall4.errors.txt index 0e0a40a512f..3beaf2ce65c 100644 --- a/tests/baselines/reference/iteratorSpreadInCall4.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall4.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(1,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(15,1): error TS2346: Supplied parameters do not match any signature of call target. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts (1 errors) ==== - foo(...new SymbolIterator); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - function foo(s1: symbol, ...s: symbol[]) { } class SymbolIterator { next() { @@ -18,4 +14,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts(1,1): error TS2346: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall4.js b/tests/baselines/reference/iteratorSpreadInCall4.js index 7819a1ba6f9..a0d655c25a8 100644 --- a/tests/baselines/reference/iteratorSpreadInCall4.js +++ b/tests/baselines/reference/iteratorSpreadInCall4.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall4.ts] -foo(...new SymbolIterator); - function foo(s1: symbol, ...s: symbol[]) { } class SymbolIterator { next() { @@ -13,10 +11,11 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator); //// [iteratorSpreadInCall4.js] -foo(...new SymbolIterator); function foo(s1, ...s) { } class SymbolIterator { next() { @@ -29,3 +28,4 @@ class SymbolIterator { return this; } } +foo(...new SymbolIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall5.js b/tests/baselines/reference/iteratorSpreadInCall5.js index a4a30ee0166..b17054363ed 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.js +++ b/tests/baselines/reference/iteratorSpreadInCall5.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall5.ts] -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | string)[]) { } class SymbolIterator { next() { @@ -26,10 +24,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall5.js] -foo(...new SymbolIterator, ...new StringIterator); function foo(...s) { } class SymbolIterator { next() { @@ -53,3 +52,4 @@ class StringIterator { return this; } } +foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall5.symbols b/tests/baselines/reference/iteratorSpreadInCall5.symbols index 0ed608e0589..81143b79f29 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall5.symbols @@ -1,26 +1,21 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts === -foo(...new SymbolIterator, ...new StringIterator); ->foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 50)) ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) - function foo(...s: (symbol | string)[]) { } ->foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 50)) ->s : Symbol(s, Decl(iteratorSpreadInCall5.ts, 2, 13)) +>foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 0)) +>s : Symbol(s, Decl(iteratorSpreadInCall5.ts, 0, 13)) class SymbolIterator { ->SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 0, 43)) next() { ->next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall5.ts, 3, 22)) +>next : Symbol(SymbolIterator.next, Decl(iteratorSpreadInCall5.ts, 1, 22)) return { value: Symbol(), ->value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 5, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 3, 16)) >Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 6, 28)) +>done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 4, 28)) }; } @@ -31,22 +26,22 @@ class SymbolIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) +>this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 0, 43)) } } class StringIterator { ->StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 12, 1)) next() { ->next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall5.ts, 16, 22)) +>next : Symbol(StringIterator.next, Decl(iteratorSpreadInCall5.ts, 14, 22)) return { value: "", ->value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 18, 16)) +>value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 16, 16)) done: false ->done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 19, 22)) +>done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 17, 22)) }; } @@ -57,6 +52,12 @@ class StringIterator { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) return this; ->this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) +>this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 12, 1)) } } + +foo(...new SymbolIterator, ...new StringIterator); +>foo : Symbol(foo, Decl(iteratorSpreadInCall5.ts, 0, 0)) +>SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 0, 43)) +>StringIterator : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 12, 1)) + diff --git a/tests/baselines/reference/iteratorSpreadInCall5.types b/tests/baselines/reference/iteratorSpreadInCall5.types index 9542a76daf1..a4f16829d52 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.types +++ b/tests/baselines/reference/iteratorSpreadInCall5.types @@ -1,14 +1,4 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts === -foo(...new SymbolIterator, ...new StringIterator); ->foo(...new SymbolIterator, ...new StringIterator) : void ->foo : (...s: (string | symbol)[]) => void ->...new SymbolIterator : symbol ->new SymbolIterator : SymbolIterator ->SymbolIterator : typeof SymbolIterator ->...new StringIterator : string ->new StringIterator : StringIterator ->StringIterator : typeof StringIterator - function foo(...s: (symbol | string)[]) { } >foo : (...s: (string | symbol)[]) => void >s : (string | symbol)[] @@ -73,3 +63,14 @@ class StringIterator { >this : this } } + +foo(...new SymbolIterator, ...new StringIterator); +>foo(...new SymbolIterator, ...new StringIterator) : void +>foo : (...s: (string | symbol)[]) => void +>...new SymbolIterator : symbol +>new SymbolIterator : SymbolIterator +>SymbolIterator : typeof SymbolIterator +>...new StringIterator : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + diff --git a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt index 93aaec8c330..2c89c7bb493 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall6.errors.txt @@ -1,11 +1,7 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. +tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(28,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ==== - foo(...new SymbolIterator, ...new StringIterator); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. - function foo(...s: (symbol | number)[]) { } class SymbolIterator { next() { @@ -31,4 +27,8 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator, ...new StringIterator); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall6.js b/tests/baselines/reference/iteratorSpreadInCall6.js index 8ad60be911e..161f420ce0e 100644 --- a/tests/baselines/reference/iteratorSpreadInCall6.js +++ b/tests/baselines/reference/iteratorSpreadInCall6.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall6.ts] -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | number)[]) { } class SymbolIterator { next() { @@ -26,10 +24,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall6.js] -foo(...new SymbolIterator, ...new StringIterator); function foo(...s) { } class SymbolIterator { next() { @@ -53,3 +52,4 @@ class StringIterator { return this; } } +foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall7.errors.txt b/tests/baselines/reference/iteratorSpreadInCall7.errors.txt index 51cae1d72b2..30096c90db6 100644 --- a/tests/baselines/reference/iteratorSpreadInCall7.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall7.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(1,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(28,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts (1 errors) ==== - foo(...new SymbolIterator, ...new StringIterator); - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. - function foo(...s: T[]) { return s[0]; } class SymbolIterator { next() { @@ -33,4 +28,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(1,1): error TS2453: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + foo(...new SymbolIterator, ...new StringIterator); + ~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall7.js b/tests/baselines/reference/iteratorSpreadInCall7.js index 4a56b75d236..e7c354413df 100644 --- a/tests/baselines/reference/iteratorSpreadInCall7.js +++ b/tests/baselines/reference/iteratorSpreadInCall7.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall7.ts] -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: T[]) { return s[0]; } class SymbolIterator { next() { @@ -26,10 +24,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall7.js] -foo(...new SymbolIterator, ...new StringIterator); function foo(...s) { return s[0]; } class SymbolIterator { next() { @@ -53,3 +52,4 @@ class StringIterator { return this; } } +foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall8.errors.txt b/tests/baselines/reference/iteratorSpreadInCall8.errors.txt index d7913458b6a..5fd0b43ce5a 100644 --- a/tests/baselines/reference/iteratorSpreadInCall8.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall8.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts(1,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts(31,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts (1 errors) ==== - new Foo(...new SymbolIterator, ...new StringIterator); - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. - class Foo { constructor(...s: T[]) { } } @@ -36,4 +31,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts(1,5): error TS2453: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + new Foo(...new SymbolIterator, ...new StringIterator); + ~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall8.js b/tests/baselines/reference/iteratorSpreadInCall8.js index 3871ff83bc6..a591fd363ab 100644 --- a/tests/baselines/reference/iteratorSpreadInCall8.js +++ b/tests/baselines/reference/iteratorSpreadInCall8.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall8.ts] -new Foo(...new SymbolIterator, ...new StringIterator); - class Foo { constructor(...s: T[]) { } } @@ -29,10 +27,11 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +new Foo(...new SymbolIterator, ...new StringIterator); //// [iteratorSpreadInCall8.js] -new Foo(...new SymbolIterator, ...new StringIterator); class Foo { constructor(...s) { } } @@ -58,3 +57,4 @@ class StringIterator { return this; } } +new Foo(...new SymbolIterator, ...new StringIterator); diff --git a/tests/baselines/reference/iteratorSpreadInCall9.errors.txt b/tests/baselines/reference/iteratorSpreadInCall9.errors.txt index da2ee7f8efc..59854bd36ad 100644 --- a/tests/baselines/reference/iteratorSpreadInCall9.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInCall9.errors.txt @@ -1,13 +1,8 @@ -tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts(1,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts(31,5): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts (1 errors) ==== - new Foo(...new SymbolIterator, ...[...new StringIterator]); - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. - class Foo { constructor(...s: T[]) { } } @@ -36,4 +31,10 @@ tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts(1,5): error TS2453: [Symbol.iterator]() { return this; } - } \ No newline at end of file + } + + new Foo(...new SymbolIterator, ...[...new StringIterator]); + ~~~ +!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInCall9.js b/tests/baselines/reference/iteratorSpreadInCall9.js index da80c461b1b..3f54728fd88 100644 --- a/tests/baselines/reference/iteratorSpreadInCall9.js +++ b/tests/baselines/reference/iteratorSpreadInCall9.js @@ -1,6 +1,4 @@ //// [iteratorSpreadInCall9.ts] -new Foo(...new SymbolIterator, ...[...new StringIterator]); - class Foo { constructor(...s: T[]) { } } @@ -29,10 +27,12 @@ class StringIterator { [Symbol.iterator]() { return this; } -} +} + +new Foo(...new SymbolIterator, ...[...new StringIterator]); + //// [iteratorSpreadInCall9.js] -new Foo(...new SymbolIterator, ...[...new StringIterator]); class Foo { constructor(...s) { } } @@ -58,3 +58,4 @@ class StringIterator { return this; } } +new Foo(...new SymbolIterator, ...[...new StringIterator]); diff --git a/tests/baselines/reference/parserRealSource10.errors.txt b/tests/baselines/reference/parserRealSource10.errors.txt index d6199636e69..ae48cd79b51 100644 --- a/tests/baselines/reference/parserRealSource10.errors.txt +++ b/tests/baselines/reference/parserRealSource10.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,33): error TS2449: Class 'TokenInfo' used before its declaration. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,36): error TS2304: Cannot find name 'string'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. @@ -342,7 +343,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(356,53): error tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -==== tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts (342 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts (343 errors) ==== // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. @@ -472,6 +473,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error } export var tokenTable = new TokenInfo[]; + ~~~~~~~~~ +!!! error TS2449: Class 'TokenInfo' used before its declaration. ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. export var nodeTypeTable = new string[]; diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt new file mode 100644 index 00000000000..2945950068a --- /dev/null +++ b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt @@ -0,0 +1,20 @@ +tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts(1,1): error TS2449: Class 'Foo' used before its declaration. +tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts(1,10): error TS2449: Class 'Foo' used before its declaration. + + +==== tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts (0 errors) ==== + import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0"); + export = Bar; + interface Bar { + foo: Foo; + } +==== tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts (2 errors) ==== + export = Foo; + ~~~~~~~~~~~~~ +!!! error TS2449: Class 'Foo' used before its declaration. + ~~~ +!!! error TS2449: Class 'Foo' used before its declaration. + class Foo { + constructor(public a: A) { } + } + \ No newline at end of file diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt index dd44005047e..95378c4c694 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_GlobalFile.ts(16,67): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(17,67): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(20,63): error TS2690: A class must be declared after its base class. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(20,77): error TS2449: Class 'publicClassInPrivateModule' used before its declaration. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS2690: A class must be declared after its base class. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,83): error TS2449: Class 'publicClassInPrivateModule' used before its declaration. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(64,55): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClass' has or is using private name 'privateClass'. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. @@ -30,14 +30,14 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): } class privateClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'publicClassInPrivateModule' used before its declaration. } export class publicClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { // Should error ~~~~~~~~~~~~~ !!! error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2449: Class 'publicClassInPrivateModule' used before its declaration. } } diff --git a/tests/baselines/reference/recursiveBaseCheck3.errors.txt b/tests/baselines/reference/recursiveBaseCheck3.errors.txt index 97f7cadc3d6..ba0ea669c55 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck3.errors.txt @@ -1,12 +1,15 @@ tests/cases/compiler/recursiveBaseCheck3.ts(1,7): error TS2506: 'A' is referenced directly or indirectly in its own base expression. +tests/cases/compiler/recursiveBaseCheck3.ts(1,20): error TS2449: Class 'C' used before its declaration. tests/cases/compiler/recursiveBaseCheck3.ts(2,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' does not exist on type 'C<{}>'. -==== tests/cases/compiler/recursiveBaseCheck3.ts (3 errors) ==== +==== tests/cases/compiler/recursiveBaseCheck3.ts (4 errors) ==== class A extends C { } ~ !!! error TS2506: 'A' is referenced directly or indirectly in its own base expression. + ~ +!!! error TS2449: Class 'C' used before its declaration. class C extends A { } ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 704c39891e6..616d5392c8b 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -1,13 +1,13 @@ //// [recursiveClassInstantiationsWithDefaultConstructors.ts] -var a = new TypeScript2.MemberNameArray() module TypeScript2 { -export class MemberName { -public prefix: string = ""; + export class MemberName { + public prefix: string = ""; + } + export class MemberNameArray extends MemberName { + } } -export class MemberNameArray extends MemberName { -} -} - + +var a = new TypeScript2.MemberNameArray() //// [recursiveClassInstantiationsWithDefaultConstructors.js] var __extends = (this && this.__extends) || (function () { @@ -20,7 +20,6 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var a = new TypeScript2.MemberNameArray(); var TypeScript2; (function (TypeScript2) { var MemberName = (function () { @@ -39,3 +38,4 @@ var TypeScript2; }(MemberName)); TypeScript2.MemberNameArray = MemberNameArray; })(TypeScript2 || (TypeScript2 = {})); +var a = new TypeScript2.MemberNameArray(); diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols index c722d8ef8f7..7d87f5ec91f 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.symbols @@ -1,22 +1,22 @@ === tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts === -var a = new TypeScript2.MemberNameArray() ->a : Symbol(a, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 3)) ->TypeScript2.MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) ->TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 41)) ->MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) - module TypeScript2 { ->TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 41)) +>TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 0)) -export class MemberName { ->MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 20)) + export class MemberName { +>MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 20)) -public prefix: string = ""; ->prefix : Symbol(MemberName.prefix, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 2, 25)) -} -export class MemberNameArray extends MemberName { ->MemberNameArray : Symbol(MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 4, 1)) ->MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 20)) -} + public prefix: string = ""; +>prefix : Symbol(MemberName.prefix, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 1, 29)) + } + export class MemberNameArray extends MemberName { +>MemberNameArray : Symbol(MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 3, 5)) +>MemberName : Symbol(MemberName, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 20)) + } } +var a = new TypeScript2.MemberNameArray() +>a : Symbol(a, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 8, 3)) +>TypeScript2.MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 3, 5)) +>TypeScript2 : Symbol(TypeScript2, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 0, 0)) +>MemberNameArray : Symbol(TypeScript2.MemberNameArray, Decl(recursiveClassInstantiationsWithDefaultConstructors.ts, 3, 5)) + diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types index 3e74ba7f57b..f1cf5894cde 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.types @@ -1,4 +1,20 @@ === tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts === +module TypeScript2 { +>TypeScript2 : typeof TypeScript2 + + export class MemberName { +>MemberName : MemberName + + public prefix: string = ""; +>prefix : string +>"" : "" + } + export class MemberNameArray extends MemberName { +>MemberNameArray : MemberNameArray +>MemberName : MemberName + } +} + var a = new TypeScript2.MemberNameArray() >a : TypeScript2.MemberNameArray >new TypeScript2.MemberNameArray() : TypeScript2.MemberNameArray @@ -6,19 +22,3 @@ var a = new TypeScript2.MemberNameArray() >TypeScript2 : typeof TypeScript2 >MemberNameArray : typeof TypeScript2.MemberNameArray -module TypeScript2 { ->TypeScript2 : typeof TypeScript2 - -export class MemberName { ->MemberName : MemberName - -public prefix: string = ""; ->prefix : string ->"" : "" -} -export class MemberNameArray extends MemberName { ->MemberNameArray : MemberNameArray ->MemberName : MemberName -} -} - diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt index b9e650b644b..bfb9a5127f8 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt @@ -1,34 +1,34 @@ -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(2,35): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(9,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(45,39): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(60,34): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(96,33): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(114,40): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(126,34): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(182,42): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(199,39): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(247,35): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(272,30): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(301,33): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(403,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(436,45): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(469,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(490,34): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(495,39): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(500,38): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(534,42): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(549,41): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(580,45): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(589,44): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(605,46): error TS2690: A class must be declared after its base class. -tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42): error TS2690: A class must be declared after its base class. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(2,45): error TS2449: Class 'nitidus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(9,56): error TS2449: Class 'mixtus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(45,48): error TS2449: Class 'psilurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(60,44): error TS2449: Class 'jugularis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(96,44): error TS2449: Class 'aurata' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(114,48): error TS2449: Class 'gilbertii' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(126,43): error TS2449: Class 'johorensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(182,54): error TS2449: Class 'falconeri' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(199,47): error TS2449: Class 'pygmaea' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(247,46): error TS2449: Class 'ciliolabrum' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(272,35): error TS2449: Class 'coludo' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(301,41): error TS2449: Class 'oreas' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(403,53): error TS2449: Class 'johorensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(436,55): error TS2449: Class 'punicus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(469,52): error TS2449: Class 'stolzmanni' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(490,42): error TS2449: Class 'portoricensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(495,50): error TS2449: Class 'pelurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(500,49): error TS2449: Class 'lasiurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(534,50): error TS2449: Class 'stolzmanni' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(549,53): error TS2449: Class 'daphaenodon' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(580,54): error TS2449: Class 'johorensis' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(589,52): error TS2449: Class 'stolzmanni' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(605,55): error TS2449: Class 'psilurus' used before its declaration. +tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53): error TS2449: Class 'lasiurus' used before its declaration. ==== tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts (24 errors) ==== module rionegrensis { export class caniventer extends Lanthanum.nitidus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'nitidus' used before its declaration. salomonseni() : caniventer { var x : caniventer; () => { var y = this; }; return x; } uchidai() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } raffrayana() : lavali.otion { var x : lavali.otion; () => { var y = this; }; return x; } @@ -36,8 +36,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 nayaur() : gabriellae.amicus { var x : gabriellae.amicus; () => { var y = this; }; return x; } } export class veraecrucis extends trivirgatus.mixtus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~ +!!! error TS2449: Class 'mixtus' used before its declaration. naso() : panamensis.setulosus> { var x : panamensis.setulosus>; () => { var y = this; }; return x; } vancouverensis() : imperfecta.ciliolabrum { var x : imperfecta.ciliolabrum; () => { var y = this; }; return x; } africana() : argurus.gilbertii, sagitta.cinereus> { var x : argurus.gilbertii, sagitta.cinereus>; () => { var y = this; }; return x; } @@ -74,8 +74,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 porcellus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } } export class oralis extends caurinus.psilurus { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'psilurus' used before its declaration. cepapi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } porteri() : lavali.thaeleri { var x : lavali.thaeleri; () => { var y = this; }; return x; } bindi() : caurinus.mahaganus> { var x : caurinus.mahaganus>; () => { var y = this; }; return x; } @@ -91,8 +91,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 eisentrauti() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } } export class sumatrana extends Lanthanum.jugularis { - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~ +!!! error TS2449: Class 'jugularis' used before its declaration. wolffsohni() : Lanthanum.suillus { var x : Lanthanum.suillus; () => { var y = this; }; return x; } geata() : ruatanica.hector { var x : ruatanica.hector; () => { var y = this; }; return x; } awashensis() : petrophilus.minutilla { var x : petrophilus.minutilla; () => { var y = this; }; return x; } @@ -129,8 +129,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 olchonensis() : rendalli.crenulata { var x : rendalli.crenulata; () => { var y = this; }; return x; } } export class durangae extends dogramacii.aurata { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~ +!!! error TS2449: Class 'aurata' used before its declaration. Californium() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } Flerovium() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } phrudus() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } @@ -149,8 +149,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 anatolicus() : julianae.steerii { var x : julianae.steerii; () => { var y = this; }; return x; } } export class nitidus extends argurus.gilbertii { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~ +!!! error TS2449: Class 'gilbertii' used before its declaration. granatensis() : quasiater.bobrinskoi { var x : quasiater.bobrinskoi; () => { var y = this; }; return x; } negligens() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } lewisi() : julianae.oralis { var x : julianae.oralis; () => { var y = this; }; return x; } @@ -163,8 +163,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 bicornis() : dogramacii.kaiseri { var x : dogramacii.kaiseri; () => { var y = this; }; return x; } } export class megalonyx extends caurinus.johorensis { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'johorensis' used before its declaration. phillipsii() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } melanogaster() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } elaphus() : nitidus { var x : nitidus; () => { var y = this; }; return x; } @@ -221,8 +221,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 biacensis() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } } export class crenulata extends trivirgatus.falconeri { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~ +!!! error TS2449: Class 'falconeri' used before its declaration. salvanius() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } maritimus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } edax() : lutreolus.cor>, rionegrensis.caniventer> { var x : lutreolus.cor>, rionegrensis.caniventer>; () => { var y = this; }; return x; } @@ -240,8 +240,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 vallinus() : sagitta.sicarius { var x : sagitta.sicarius; () => { var y = this; }; return x; } } export class mixtus extends argurus.pygmaea> { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'pygmaea' used before its declaration. ochrogaster() : dogramacii.aurata { var x : dogramacii.aurata; () => { var y = this; }; return x; } bryophilus() : macrorhinos.marmosurus>> { var x : macrorhinos.marmosurus>>; () => { var y = this; }; return x; } liechtensteini() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } @@ -290,8 +290,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module ruatanica { export class americanus extends imperfecta.ciliolabrum { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~ +!!! error TS2449: Class 'ciliolabrum' used before its declaration. nasoloi() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } mystacalis() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } fardoulisi() : trivirgatus.oconnelli { var x : trivirgatus.oconnelli; () => { var y = this; }; return x; } @@ -317,8 +317,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 export class beisa { } export class otion extends howi.coludo { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~ +!!! error TS2449: Class 'coludo' used before its declaration. bonaerensis() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } dussumieri() : nigra.gracilis { var x : nigra.gracilis; () => { var y = this; }; return x; } osvaldoreigi() : julianae.albidens { var x : julianae.albidens; () => { var y = this; }; return x; } @@ -348,8 +348,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 coyhaiquensis() : caurinus.mahaganus, panglima.abidi>, lutreolus.punicus> { var x : caurinus.mahaganus, panglima.abidi>, lutreolus.punicus>; () => { var y = this; }; return x; } } export class thaeleri extends argurus.oreas { - ~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~ +!!! error TS2449: Class 'oreas' used before its declaration. coromandra() : julianae.galapagoensis { var x : julianae.galapagoensis; () => { var y = this; }; return x; } parvipes() : nigra.dolichurus { var x : nigra.dolichurus; () => { var y = this; }; return x; } sponsorius() : rionegrensis.veraecrucis, julianae.steerii> { var x : rionegrensis.veraecrucis, julianae.steerii>; () => { var y = this; }; return x; } @@ -452,8 +452,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module panglima { export class amphibius extends caurinus.johorensis, Lanthanum.jugularis> { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'johorensis' used before its declaration. bottegi(): macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni> { var x: macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>; () => { var y = this; }; return x; } jerdoni(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } camtschatica(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } @@ -487,8 +487,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module minutus { export class himalayana extends lutreolus.punicus { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'punicus' used before its declaration. simoni(): argurus.netscheri> { var x: argurus.netscheri>; () => { var y = this; }; return x; } lobata(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } rusticus(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } @@ -522,8 +522,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module howi { export class angulatus extends sagitta.stolzmanni { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'stolzmanni' used before its declaration. pennatus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } } } @@ -545,22 +545,22 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module sagitta { export class walkeri extends minutus.portoricensis { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~~~ +!!! error TS2449: Class 'portoricensis' used before its declaration. maracajuensis(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } } } module minutus { export class inez extends samarensis.pelurus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~ +!!! error TS2449: Class 'pelurus' used before its declaration. vexillaris(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } } } module macrorhinos { export class konganensis extends imperfecta.lasiurus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'lasiurus' used before its declaration. } } module panamensis { @@ -595,8 +595,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module samarensis { export class pelurus extends sagitta.stolzmanni { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'stolzmanni' used before its declaration. Palladium(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } castanea(): argurus.netscheri, julianae.oralis> { var x: argurus.netscheri, julianae.oralis>; () => { var y = this; }; return x; } chamek(): argurus.pygmaea { var x: argurus.pygmaea; () => { var y = this; }; return x; } @@ -612,8 +612,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 olitor(): rionegrensis.veraecrucis { var x: rionegrensis.veraecrucis; () => { var y = this; }; return x; } } export class fuscus extends macrorhinos.daphaenodon { - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~~ +!!! error TS2449: Class 'daphaenodon' used before its declaration. planifrons(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } badia(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } prymnolopha(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } @@ -645,8 +645,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module sagitta { export class leptoceros extends caurinus.johorensis> { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'johorensis' used before its declaration. victus(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } hoplomyoides(): panglima.fundatus, nigra.gracilis> { var x: panglima.fundatus, nigra.gracilis>; () => { var y = this; }; return x; } gratiosus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } @@ -656,8 +656,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module daubentonii { export class nigricans extends sagitta.stolzmanni { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~~~ +!!! error TS2449: Class 'stolzmanni' used before its declaration. woosnami(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } } } @@ -674,8 +674,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module chrysaeolus { export class sarasinorum extends caurinus.psilurus { - ~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'psilurus' used before its declaration. belzebul(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } hinpoon(): nigra.caucasica { var x: nigra.caucasica; () => { var y = this; }; return x; } kandti(): quasiater.wattsi { var x: quasiater.wattsi; () => { var y = this; }; return x; } @@ -840,8 +840,8 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,42 } module gabriellae { export class klossii extends imperfecta.lasiurus { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2690: A class must be declared after its base class. + ~~~~~~~~ +!!! error TS2449: Class 'lasiurus' used before its declaration. } export class amicus { pirrensis(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt index b1dab90db33..a8e95fc5bd8 100644 --- a/tests/baselines/reference/symbolProperty33.errors.txt +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/Symbols/symbolProperty33.ts(1,18): error TS2690: A class must be declared after its base class. +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(1,18): error TS2449: Class 'C2' used before its declaration. tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (2 errors) ==== class C1 extends C2 { ~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'C2' used before its declaration. [Symbol.toStringTag]() { return { x: "" }; } diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt index 98a9875bd50..3ff62c12ad1 100644 --- a/tests/baselines/reference/symbolProperty34.errors.txt +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/Symbols/symbolProperty34.ts(1,18): error TS2690: A class must be declared after its base class. +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(1,18): error TS2449: Class 'C2' used before its declaration. tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (2 errors) ==== class C1 extends C2 { ~~ -!!! error TS2690: A class must be declared after its base class. +!!! error TS2449: Class 'C2' used before its declaration. [Symbol.toStringTag]() { return { x: "" }; } diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.js b/tests/baselines/reference/typeArgumentInferenceOrdering.js index d6e5666b550..f7a46c84385 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.js +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.js @@ -1,7 +1,4 @@ //// [typeArgumentInferenceOrdering.ts] -function foo(f: { y: T }): T { return null } -var x = foo(new C()).x; // was Error that property x does not exist on type {} - class C { y: I; } @@ -13,13 +10,15 @@ interface I { interface Goo { p: string; } - + +function foo(f: { y: T }): T { return null } +var x = foo(new C()).x; // was Error that property x does not exist on type {} //// [typeArgumentInferenceOrdering.js] -function foo(f) { return null; } -var x = foo(new C()).x; // was Error that property x does not exist on type {} var C = (function () { function C() { } return C; }()); +function foo(f) { return null; } +var x = foo(new C()).x; // was Error that property x does not exist on type {} diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.symbols b/tests/baselines/reference/typeArgumentInferenceOrdering.symbols index 630aebcf185..0c01b4d8a5d 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.symbols +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.symbols @@ -1,39 +1,39 @@ === tests/cases/compiler/typeArgumentInferenceOrdering.ts === -function foo(f: { y: T }): T { return null } ->foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) ->T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 0, 13)) ->f : Symbol(f, Decl(typeArgumentInferenceOrdering.ts, 0, 16)) ->y : Symbol(y, Decl(typeArgumentInferenceOrdering.ts, 0, 20)) ->T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 0, 13)) ->T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 0, 13)) - -var x = foo(new C()).x; // was Error that property x does not exist on type {} ->x : Symbol(x, Decl(typeArgumentInferenceOrdering.ts, 1, 3)) ->foo(new C()).x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) ->foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) ->C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 1, 23)) ->x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) - class C { ->C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 1, 23)) +>C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) y: I; ->y : Symbol(C.y, Decl(typeArgumentInferenceOrdering.ts, 3, 9)) ->I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 5, 1)) +>y : Symbol(C.y, Decl(typeArgumentInferenceOrdering.ts, 0, 9)) +>I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 2, 1)) } interface I { ->I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 5, 1)) +>I : Symbol(I, Decl(typeArgumentInferenceOrdering.ts, 2, 1)) x(): Goo; ->x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 7, 13)) ->Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 9, 1)) +>x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 4, 13)) +>Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 6, 1)) } interface Goo { ->Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 9, 1)) +>Goo : Symbol(Goo, Decl(typeArgumentInferenceOrdering.ts, 6, 1)) p: string; ->p : Symbol(Goo.p, Decl(typeArgumentInferenceOrdering.ts, 11, 15)) +>p : Symbol(Goo.p, Decl(typeArgumentInferenceOrdering.ts, 8, 15)) } +function foo(f: { y: T }): T { return null } +>foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 10, 1)) +>T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 12, 13)) +>f : Symbol(f, Decl(typeArgumentInferenceOrdering.ts, 12, 16)) +>y : Symbol(y, Decl(typeArgumentInferenceOrdering.ts, 12, 20)) +>T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 12, 13)) +>T : Symbol(T, Decl(typeArgumentInferenceOrdering.ts, 12, 13)) + +var x = foo(new C()).x; // was Error that property x does not exist on type {} +>x : Symbol(x, Decl(typeArgumentInferenceOrdering.ts, 13, 3)) +>foo(new C()).x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 4, 13)) +>foo : Symbol(foo, Decl(typeArgumentInferenceOrdering.ts, 10, 1)) +>C : Symbol(C, Decl(typeArgumentInferenceOrdering.ts, 0, 0)) +>x : Symbol(I.x, Decl(typeArgumentInferenceOrdering.ts, 4, 13)) + diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.types b/tests/baselines/reference/typeArgumentInferenceOrdering.types index 1bbeadcf4d5..788ab2285a3 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.types +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.types @@ -1,22 +1,4 @@ === tests/cases/compiler/typeArgumentInferenceOrdering.ts === -function foo(f: { y: T }): T { return null } ->foo : (f: { y: T; }) => T ->T : T ->f : { y: T; } ->y : T ->T : T ->T : T ->null : null - -var x = foo(new C()).x; // was Error that property x does not exist on type {} ->x : () => Goo ->foo(new C()).x : () => Goo ->foo(new C()) : I ->foo : (f: { y: T; }) => T ->new C() : C ->C : typeof C ->x : () => Goo - class C { >C : C @@ -40,3 +22,21 @@ interface Goo { >p : string } +function foo(f: { y: T }): T { return null } +>foo : (f: { y: T; }) => T +>T : T +>f : { y: T; } +>y : T +>T : T +>T : T +>null : null + +var x = foo(new C()).x; // was Error that property x does not exist on type {} +>x : () => Goo +>foo(new C()).x : () => Goo +>foo(new C()) : I +>foo : (f: { y: T; }) => T +>new C() : C +>C : typeof C +>x : () => Goo + diff --git a/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts new file mode 100644 index 00000000000..cf09163ed5a --- /dev/null +++ b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInFunctionDeclaration.ts @@ -0,0 +1,4 @@ +function f() { + new C2(); // OK +} +class C2 { } \ No newline at end of file diff --git a/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts new file mode 100644 index 00000000000..389c669e740 --- /dev/null +++ b/tests/cases/compiler/classDeclarationCheckUsedBeforeDefinitionInItself.ts @@ -0,0 +1,4 @@ +// @target: es6 +class C3 { + static intance = new C3(); // ok +} \ No newline at end of file diff --git a/tests/cases/compiler/enumUsedBeforeDeclaration.ts b/tests/cases/compiler/enumUsedBeforeDeclaration.ts new file mode 100644 index 00000000000..98f5fca86f1 --- /dev/null +++ b/tests/cases/compiler/enumUsedBeforeDeclaration.ts @@ -0,0 +1,5 @@ +const v: Color = Color.Green; +const v2: ConstColor = ConstColor.Green; +enum Color { Red, Green, Blue } +const enum ConstColor { Red, Green, Blue } + diff --git a/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts b/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts index 1f76e4e6b56..9f008cd2b1e 100644 --- a/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts +++ b/tests/cases/compiler/recursiveClassInstantiationsWithDefaultConstructors.ts @@ -1,8 +1,9 @@ -var a = new TypeScript2.MemberNameArray() module TypeScript2 { -export class MemberName { -public prefix: string = ""; -} -export class MemberNameArray extends MemberName { -} + export class MemberName { + public prefix: string = ""; + } + export class MemberNameArray extends MemberName { + } } + +var a = new TypeScript2.MemberNameArray() \ No newline at end of file diff --git a/tests/cases/compiler/typeArgumentInferenceOrdering.ts b/tests/cases/compiler/typeArgumentInferenceOrdering.ts index 6887f7455d6..faa7b45a4ac 100644 --- a/tests/cases/compiler/typeArgumentInferenceOrdering.ts +++ b/tests/cases/compiler/typeArgumentInferenceOrdering.ts @@ -1,6 +1,3 @@ -function foo(f: { y: T }): T { return null } -var x = foo(new C()).x; // was Error that property x does not exist on type {} - class C { y: I; } @@ -12,3 +9,6 @@ interface I { interface Goo { p: string; } + +function foo(f: { y: T }): T { return null } +var x = foo(new C()).x; // was Error that property x does not exist on type {} \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts index 7b3be0365e9..7a4cd1a2e4c 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern1.ts @@ -1,5 +1,4 @@ //@target: ES6 -var [a, b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var [a, b] = new SymbolIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts index 35d05ef1f9c..591cdd2b6a5 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, b]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts index ed93b5175d0..83ab94decec 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern11.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, b] = new FooIterator) { } +fun(new FooIterator); diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts index b7e763694ea..079eb25df4a 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern12.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, ...b] = new FooIterator) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, ...b] = new FooIterator) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts index f0b9b142f40..f4909547e26 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, ...b]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts index c327efa3ec2..976c5148232 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[a, ...b]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[a, ...b]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts index 21d632fd541..ecc686b634a 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[a, b]: Bar[]) { } -fun(...new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[a, b]: Bar[]) { } +fun(...new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts index 90db0e5edb5..b81114cab23 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[a, b]: Bar[]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts index e6e5ad617b2..a03713037d6 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([a, b]: Bar[]) { } -fun(new FooIterator); class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([a, b]: Bar[]) { } +fun(new FooIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts index 8513dd07649..32024e83b1b 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun([[a], b]: Bar[][]) { } -fun(new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,4 +12,7 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun([[a], b]: Bar[][]) { } +fun(new FooArrayIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts index 587f1f0b056..d5543c0aed6 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern2.ts @@ -1,5 +1,4 @@ //@target: ES6 -var [a, ...b] = new SymbolIterator; class SymbolIterator { next() { return { @@ -11,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var [a, ...b] = new SymbolIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts index b5be67b393f..6a0e9126734 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern20.ts @@ -1,6 +1,4 @@ //@target: ES6 -function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } -fun(...new FooArrayIterator); class Bar { x } class Foo extends Bar { y } class FooArrayIterator { @@ -14,4 +12,7 @@ class FooArrayIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +function fun(...[[a = new Foo], b = [new Foo]]: Bar[][]) { } +fun(...new FooArrayIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts index 31656b5661f..ff63aa74179 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern3.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: Bar; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: Bar; +[a, b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts index edd95be1598..b5aef9003b1 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern4.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: Bar[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: Bar[]; +[a, ...b] = new FooIterator \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts index b51d0f09d08..a3911b1f5ef 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern5.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string; +[a, b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts index fc9395ed6a4..057b9aeaffe 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern6.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string[]; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string[]; +[a, ...b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts index 85b2f2e54e3..965b7157670 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern7.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string[]; -[a, b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string[]; +[a, b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts b/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts index dd49205d6e0..5638b4c49c6 100644 --- a/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts +++ b/tests/cases/conformance/es6/destructuring/iterableArrayPattern8.ts @@ -1,6 +1,4 @@ //@target: ES6 -var a: Bar, b: string; -[a, ...b] = new FooIterator; class Bar { x } class Foo extends Bar { y } class FooIterator { @@ -14,4 +12,7 @@ class FooIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var a: Bar, b: string; +[a, ...b] = new FooIterator; \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of14.ts b/tests/cases/conformance/es6/for-ofStatements/for-of14.ts index 84fbda4825c..f79794d59d5 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of14.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of14.ts @@ -1,9 +1,9 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should fail because the iterator is not iterable - class StringIterator { next() { return ""; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of15.ts b/tests/cases/conformance/es6/for-ofStatements/for-of15.ts index 1973e7ff95e..b2e788bdef2 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of15.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of15.ts @@ -1,7 +1,4 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { next() { return ""; @@ -9,4 +6,7 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should fail \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of16.ts b/tests/cases/conformance/es6/for-ofStatements/for-of16.ts index 8f7bd6d8486..fe78bae2aef 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of16.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of16.ts @@ -1,9 +1,9 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should fail - class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should fail \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of17.ts b/tests/cases/conformance/es6/for-ofStatements/for-of17.ts index 431f066d477..b7270cbb813 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of17.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of17.ts @@ -1,7 +1,4 @@ //@target: ES6 -var v: string; -for (v of new NumberIterator) { } // Should succeed - class NumberIterator { next() { return { @@ -12,4 +9,7 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new NumberIterator) { } // Should succeed \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of18.ts b/tests/cases/conformance/es6/for-ofStatements/for-of18.ts index 407ad7f0ed8..647ae314b4d 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of18.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of18.ts @@ -1,7 +1,4 @@ //@target: ES6 -var v: string; -for (v of new StringIterator) { } // Should succeed - class StringIterator { next() { return { @@ -12,4 +9,7 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var v: string; +for (v of new StringIterator) { } // Should succeed \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of19.ts b/tests/cases/conformance/es6/for-ofStatements/for-of19.ts index ff80b2690ef..be51d219dc0 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of19.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of19.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (var v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (var v of new FooIterator) { + v; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of20.ts b/tests/cases/conformance/es6/for-ofStatements/for-of20.ts index 615f5149375..3aa537a9f6f 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of20.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of20.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (let v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (let v of new FooIterator) { + v; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of21.ts b/tests/cases/conformance/es6/for-ofStatements/for-of21.ts index 4e4621034e1..ab1e6fff269 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of21.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of21.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (const v of new FooIterator) { - v; -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + v; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of22.ts b/tests/cases/conformance/es6/for-ofStatements/for-of22.ts index 10a96502cdd..c9a88340792 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of22.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of22.ts @@ -1,9 +1,4 @@ //@target: ES6 -v; -for (var v of new FooIterator) { - -} - class Foo { } class FooIterator { next() { @@ -15,4 +10,9 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +v; +for (var v of new FooIterator) { + } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of23.ts b/tests/cases/conformance/es6/for-ofStatements/for-of23.ts index 81227cd0665..df734181077 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of23.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of23.ts @@ -1,8 +1,4 @@ //@target: ES6 -for (const v of new FooIterator) { - const v = 0; // new scope -} - class Foo { } class FooIterator { next() { @@ -14,4 +10,8 @@ class FooIterator { [Symbol.iterator]() { return this; } +} + +for (const v of new FooIterator) { + const v = 0; // new scope } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of25.ts b/tests/cases/conformance/es6/for-ofStatements/for-of25.ts index a1698bd2824..61e6a58ce30 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of25.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of25.ts @@ -1,9 +1,9 @@ //@target: ES6 -var x: any; -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return x; } -} \ No newline at end of file +} + +var x: any; +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of26.ts b/tests/cases/conformance/es6/for-ofStatements/for-of26.ts index 0ab564a4f52..4414fdc1592 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of26.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of26.ts @@ -1,7 +1,4 @@ //@target: ES6 -var x: any; -for (var v of new StringIterator) { } - class StringIterator { next() { return x; @@ -9,4 +6,7 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var x: any; +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of27.ts b/tests/cases/conformance/es6/for-ofStatements/for-of27.ts index 8f2b84cbe1d..f7244eed34c 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of27.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of27.ts @@ -1,6 +1,6 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]: any; -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of28.ts b/tests/cases/conformance/es6/for-ofStatements/for-of28.ts index 8c693193b08..e1b86f6135f 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of28.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of28.ts @@ -1,9 +1,9 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { next: any; [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of30.ts b/tests/cases/conformance/es6/for-ofStatements/for-of30.ts index 03b97c23136..67e1e3da70a 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of30.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of30.ts @@ -1,6 +1,4 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -14,4 +12,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of31.ts b/tests/cases/conformance/es6/for-ofStatements/for-of31.ts index 307f9b7cd43..701fcb50ed0 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of31.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of31.ts @@ -1,6 +1,4 @@ //@target: ES6 -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -12,4 +10,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of33.ts b/tests/cases/conformance/es6/for-ofStatements/for-of33.ts index b73d2daee8a..f0af5c4a408 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of33.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of33.ts @@ -1,9 +1,9 @@ //@target: ES6 //@noImplicitAny: true -for (var v of new StringIterator) { } - class StringIterator { [Symbol.iterator]() { return v; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of34.ts b/tests/cases/conformance/es6/for-ofStatements/for-of34.ts index d00f5ccde2e..63b88223996 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of34.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of34.ts @@ -1,7 +1,5 @@ //@target: ES6 //@noImplicitAny: true -for (var v of new StringIterator) { } - class StringIterator { next() { return v; @@ -10,4 +8,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of35.ts b/tests/cases/conformance/es6/for-ofStatements/for-of35.ts index 0d66ce39edf..ab6e26d6d60 100644 --- a/tests/cases/conformance/es6/for-ofStatements/for-of35.ts +++ b/tests/cases/conformance/es6/for-ofStatements/for-of35.ts @@ -1,7 +1,5 @@ //@target: ES6 //@noImplicitAny: true -for (var v of new StringIterator) { } - class StringIterator { next() { return { @@ -13,4 +11,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts index 4b4f3e8cc1c..88a85a4b883 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts index f8549b82b76..56ff08e79f3 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray10.ts @@ -1,8 +1,8 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts index 9db5d010874..e267386a509 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray2.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new NumberIterator, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -25,4 +23,6 @@ class NumberIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new NumberIterator, ...new SymbolIterator]; diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts index 174c97de7cc..8ef12250ce5 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray3.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...[0, 1], ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...[0, 1], ...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts index 47c2e633702..ec9faa78fe6 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray4.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [0, 1, ...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts index e6a8041a961..d4df51739c9 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray5.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array: number[] = [0, 1, ...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -12,4 +10,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array: number[] = [0, 1, ...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts index 7495ca6aac6..1d021ca6122 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts @@ -1,7 +1,4 @@ //@target: ES6 -var array: number[] = [0, 1]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,4 +10,7 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array: number[] = [0, 1]; +array.concat([...new SymbolIterator]); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts index 12ca478c738..2f96507c093 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray7.ts @@ -1,7 +1,4 @@ //@target: ES6 -var array: symbol[]; -array.concat([...new SymbolIterator]); - class SymbolIterator { next() { return { @@ -13,4 +10,7 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array: symbol[]; +array.concat([...new SymbolIterator]); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts index 0e2258aa5ea..8cc56068f84 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray8.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -8,4 +6,6 @@ class SymbolIterator { done: false }; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts index 2b8d93c9ccb..5bb80fd0c71 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInArray9.ts @@ -1,6 +1,4 @@ //@target: ES6 -var array = [...new SymbolIterator]; - class SymbolIterator { next() { return { @@ -11,4 +9,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +var array = [...new SymbolIterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts index 85d07e56996..34f6a7eb8f0 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s: symbol) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts index bf8ad336fbf..aeb9aabde50 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall10.ts @@ -1,8 +1,5 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts index 182e454cfc8..795e9603be4 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall11.ts @@ -1,8 +1,5 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(...s: T[]) { return s[0] } - class SymbolIterator { next() { return { @@ -14,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts index a0bd1ede193..06bceec84f5 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts @@ -1,6 +1,4 @@ //@target: ES6 -new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); - class Foo { constructor(...s: T[]) { } } @@ -29,4 +27,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +new Foo(...[...new SymbolIterator, ...[...new StringIterator]]); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts index 4a8fd9ff389..e6d72775943 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall2.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s: symbol[]) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts index b6e8fe0c86b..0391dfdad0f 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall3.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(...s: symbol[]) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts index 2a73fd6f3c9..f3747f25869 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall4.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator); - function foo(s1: symbol, ...s: symbol[]) { } class SymbolIterator { next() { @@ -13,4 +11,6 @@ class SymbolIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts index c17c4156e65..53b0e660379 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | string)[]) { } class SymbolIterator { next() { @@ -26,4 +24,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts index 2c6150f8040..c48260e97ea 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: (symbol | number)[]) { } class SymbolIterator { next() { @@ -26,4 +24,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts index 56fb7936eb7..6893cd9d8a4 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts @@ -1,6 +1,4 @@ //@target: ES6 -foo(...new SymbolIterator, ...new StringIterator); - function foo(...s: T[]) { return s[0]; } class SymbolIterator { next() { @@ -26,4 +24,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts index e5b969456b7..c81a475d7de 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall8.ts @@ -1,6 +1,4 @@ //@target: ES6 -new Foo(...new SymbolIterator, ...new StringIterator); - class Foo { constructor(...s: T[]) { } } @@ -29,4 +27,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +new Foo(...new SymbolIterator, ...new StringIterator); \ No newline at end of file diff --git a/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts b/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts index 470f99844ba..41ee21a5645 100644 --- a/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts +++ b/tests/cases/conformance/es6/spread/iteratorSpreadInCall9.ts @@ -1,6 +1,4 @@ //@target: ES6 -new Foo(...new SymbolIterator, ...[...new StringIterator]); - class Foo { constructor(...s: T[]) { } } @@ -29,4 +27,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +new Foo(...new SymbolIterator, ...[...new StringIterator]); diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts index 185641d0804..b832d57855e 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts @@ -1,5 +1,4 @@ //@target: ES5 -for (var v of new StringIterator) { } // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { @@ -12,4 +11,6 @@ class StringIterator { [Symbol.iterator]() { return this; } -} \ No newline at end of file +} + +for (var v of new StringIterator) { } \ No newline at end of file diff --git a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts index 98f94718f30..4cc3a723951 100644 --- a/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts +++ b/tests/cases/conformance/types/typeAliases/classDoesNotDependOnBaseTypes.ts @@ -1,12 +1,12 @@ -var x: StringTree; -if (typeof x !== "string") { - x[0] = ""; - x[0] = new StringTreeCollection; -} - type StringTree = string | StringTreeCollection; class StringTreeCollectionBase { [n: number]: StringTree; } -class StringTreeCollection extends StringTreeCollectionBase { } \ No newline at end of file +class StringTreeCollection extends StringTreeCollectionBase { } + +var x: StringTree; +if (typeof x !== "string") { + x[0] = ""; + x[0] = new StringTreeCollection; +} \ No newline at end of file