Merge pull request #14307 from Microsoft/master-13893

[Master] Fix 13893: Fix runtime crash when class is used before declaration
This commit is contained in:
Yui
2017-03-21 08:36:59 -07:00
committed by GitHub
258 changed files with 1951 additions and 1693 deletions
+26 -18
View File
@@ -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
+8 -4
View File
@@ -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
@@ -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;
}
}
}
for (var v of new StringIterator) { }
~~~~~~~~~~~~~~~~~~
!!! error TS2495: Type 'StringIterator' is not an array type or a string type.
@@ -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];
}
@@ -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
@@ -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;
}
}
@@ -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
@@ -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;
}());
@@ -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))
@@ -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
@@ -0,0 +1,9 @@
//// [classDeclarationCheckUsedBeforeDefinitionInItself.ts]
class C3 {
static intance = new C3(); // ok
}
//// [classDeclarationCheckUsedBeforeDefinitionInItself.js]
class C3 {
}
C3.intance = new C3(); // ok
@@ -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))
}
@@ -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
}
@@ -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;
}
@@ -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))
}
@@ -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
@@ -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<T> extends E2<T> { 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<T> extends C2<T> { bar: T; }
~~
@@ -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<T> extends Q.E2<T> { 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<T> extends C2<T> { bar: T; }
@@ -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.
@@ -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(); }
@@ -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();
@@ -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;
@@ -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";
@@ -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 }
@@ -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 = {}));
@@ -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;
@@ -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))
@@ -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
@@ -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) ====
///<reference path='exportAssignmentOfGenericType1_0.ts'/>
import q = require("exportAssignmentOfGenericType1_0");
class M extends q<string> { }
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<X> { foo: X; }
@@ -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');
@@ -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) { } }
@@ -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 "";
}
}
}
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.
+6 -6
View File
@@ -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
@@ -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;
}
}
}
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.
+6 -6
View File
@@ -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
@@ -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;
}
}
}
var v: string;
for (v of new StringIterator) { } // Should fail
~~~~~~~~~~~~~~~~~~
!!! error TS2489: An iterator must have a 'next()' method.
+6 -6
View File
@@ -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
@@ -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;
}
}
}
var v: string;
for (v of new NumberIterator) { } // Should succeed
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
+6 -6
View File
@@ -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
+6 -6
View File
@@ -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
+13 -12
View File
@@ -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))
+9 -8
View File
@@ -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
+7 -7
View File
@@ -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;
}
+15 -15
View File
@@ -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))
}
+9 -9
View File
@@ -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
}
+7 -7
View File
@@ -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;
}
+15 -15
View File
@@ -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))
}
+9 -9
View File
@@ -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
}
+7 -7
View File
@@ -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;
}
+15 -15
View File
@@ -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))
}
+9 -9
View File
@@ -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
}
+8 -8
View File
@@ -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) {
}
+16 -16
View File
@@ -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))
}
+10 -10
View File
@@ -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
}
+7 -7
View File
@@ -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
}
+15 -15
View File
@@ -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))
}
+10 -10
View File
@@ -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
}
+6 -6
View File
@@ -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) { }
+10 -9
View File
@@ -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))
+9 -8
View File
@@ -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
+6 -6
View File
@@ -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) { }
+12 -11
View File
@@ -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))
+9 -8
View File
@@ -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
+4 -4
View File
@@ -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) { }
+6 -5
View File
@@ -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))
+6 -5
View File
@@ -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
+4 -4
View File
@@ -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) { }
+8 -7
View File
@@ -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))
+6 -5
View File
@@ -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
+11 -11
View File
@@ -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<string>'.
tests/cases/conformance/es6/for-ofStatements/for-of30.ts(16,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable<string>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
Type 'StringIterator' is not assignable to type 'Iterator<string>'.
@@ -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<string>'.
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
!!! error TS2322: Types of property 'return' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
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;
}
}
}
for (var v of new StringIterator) { }
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable<string>'.
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
!!! error TS2322: Types of property 'return' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult<string>'.
+4 -4
View File
@@ -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) { }
+13 -13
View File
@@ -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<string>'.
tests/cases/conformance/es6/for-ofStatements/for-of31.ts(14,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable<string>'.
Types of property '[Symbol.iterator]' are incompatible.
Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
Type 'StringIterator' is not assignable to type 'Iterator<string>'.
@@ -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<string>'.
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult<string>'.
!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
!!! 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;
}
}
}
for (var v of new StringIterator) { }
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable<string>'.
!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible.
!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator<string>'.
!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator<string>'.
!!! error TS2322: Types of property 'next' are incompatible.
!!! error TS2322: Type '() => { value: string; }' is not assignable to type '(value?: any) => IteratorResult<string>'.
!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult<string>'.
!!! error TS2322: Property 'done' is missing in type '{ value: string; }'.
+4 -4
View File
@@ -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) { }
@@ -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;
}
}
}
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.
+4 -4
View File
@@ -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) { }
@@ -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;
}
}
}
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.
+4 -4
View File
@@ -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) { }
@@ -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;
}
}
}
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.
+4 -4
View File
@@ -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) { }
@@ -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<string> { }
~~~~~~~~~
!!! error TS2690: A class must be declared after its base class.
~
!!! error TS2449: Class 'B' used before its declaration.
class B<U> 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) { }
}
@@ -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.
@@ -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<T> extends b<T> { }
~
!!! error TS2506: 'a' is referenced directly or indirectly in its own base expression.
~
!!! error TS2449: Class 'b' used before its declaration.
class b<T> extends a<T> { }
~
!!! error TS2506: 'b' is referenced directly or indirectly in its own base expression.
@@ -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;
@@ -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))
@@ -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
@@ -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;
}
}
}
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'.
@@ -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);
@@ -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);
@@ -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))
@@ -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
@@ -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);
@@ -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))
@@ -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
@@ -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);
@@ -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))
@@ -1,15 +1,4 @@
=== tests/cases/conformance/es6/destructuring/iterableArrayPattern13.ts ===
function fun([a, ...b]) { }
>fun : ([a, ...b]: Iterable<any>) => void
>a : any
>b : any[]
fun(new FooIterator);
>fun(new FooIterator) : void
>fun : ([a, ...b]: Iterable<any>) => 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<any>) => void
>a : any
>b : any[]
fun(new FooIterator);
>fun(new FooIterator) : void
>fun : ([a, ...b]: Iterable<any>) => void
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
@@ -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;
}
}
}
function fun(...[a, ...b]) { }
~~~~~~~~~
!!! error TS2501: A rest element cannot contain a binding pattern.
fun(new FooIterator);
@@ -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);
@@ -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;
}
}
}
function fun(...[a, b]: Bar[]) { }
~~~~~~
!!! error TS2501: A rest element cannot contain a binding pattern.
fun(...new FooIterator);
@@ -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);

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