Merge branch 'master' into inlineSourceMaps

This commit is contained in:
Mohamed Hegazy
2015-04-09 16:55:47 -07:00
277 changed files with 5928 additions and 1084 deletions

View File

@@ -1,12 +1,18 @@
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type.
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (1 errors) ====
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (3 errors) ====
var a: string, b: number;
var tuple: [number, string] = [2, "3"];
for ([a = 1, b = ""] of tuple) {
~~~~~~~~~~~~~~~
!!! error TS2461: Type 'string | number' is not an array type.
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
a;
b;
}

View File

@@ -14,6 +14,7 @@ obj[Symbol.foo];
var Symbol;
var obj = (_a = {},
_a[Symbol.foo] = 0,
_a);
_a
);
obj[Symbol.foo];
var _a;

View File

@@ -2,7 +2,5 @@
var v = { [yield]: foo }
//// [FunctionDeclaration8_es6.js]
var v = (_a = {},
_a[yield] = foo,
_a);
var v = (_a = {}, _a[yield] = foo, _a);
var _a;

View File

@@ -5,8 +5,6 @@ function * foo() {
//// [FunctionDeclaration9_es6.js]
function foo() {
var v = (_a = {},
_a[] = foo,
_a);
var v = (_a = {}, _a[] = foo, _a);
var _a;
}

View File

@@ -2,7 +2,5 @@
var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = (_a = {},
_a[foo()] = function () { },
_a);
var v = (_a = {}, _a[foo()] = function () { }, _a);
var _a;

View File

@@ -9,44 +9,55 @@ function f0() {
var a1 = [...a];
>a1 : number[]
>[...a] : number[]
>...a : number
>a : number[]
var a2 = [1, ...a];
>a2 : number[]
>[1, ...a] : number[]
>...a : number
>a : number[]
var a3 = [1, 2, ...a];
>a3 : number[]
>[1, 2, ...a] : number[]
>...a : number
>a : number[]
var a4 = [...a, 1];
>a4 : number[]
>[...a, 1] : number[]
>...a : number
>a : number[]
var a5 = [...a, 1, 2];
>a5 : number[]
>[...a, 1, 2] : number[]
>...a : number
>a : number[]
var a6 = [1, 2, ...a, 1, 2];
>a6 : number[]
>[1, 2, ...a, 1, 2] : number[]
>...a : number
>a : number[]
var a7 = [1, ...a, 2, ...a];
>a7 : number[]
>[1, ...a, 2, ...a] : number[]
>...a : number
>a : number[]
>...a : number
>a : number[]
var a8 = [...a, ...a, ...a];
>a8 : number[]
>[...a, ...a, ...a] : number[]
>...a : number
>a : number[]
>...a : number
>a : number[]
>...a : number
>a : number[]
}
@@ -60,6 +71,7 @@ function f1() {
var b = ["hello", ...a, true];
>b : (string | number | boolean)[]
>["hello", ...a, true] : (string | number | boolean)[]
>...a : number
>a : number[]
var b: (string | number | boolean)[];
@@ -72,19 +84,29 @@ function f2() {
var a = [...[...[...[...[...[]]]]]];
>a : any[]
>[...[...[...[...[...[]]]]]] : undefined[]
>...[...[...[...[...[]]]]] : undefined
>[...[...[...[...[]]]]] : undefined[]
>...[...[...[...[]]]] : undefined
>[...[...[...[]]]] : undefined[]
>...[...[...[]]] : undefined
>[...[...[]]] : undefined[]
>...[...[]] : undefined
>[...[]] : undefined[]
>...[] : undefined
>[] : undefined[]
var b = [...[...[...[...[...[5]]]]]];
>b : number[]
>[...[...[...[...[...[5]]]]]] : number[]
>...[...[...[...[...[5]]]]] : number
>[...[...[...[...[5]]]]] : number[]
>...[...[...[...[5]]]] : number
>[...[...[...[5]]]] : number[]
>...[...[...[5]]] : number
>[...[...[5]]] : number[]
>...[...[5]] : number
>[...[5]] : number[]
>...[5] : number
>[5] : number[]
}

View File

@@ -38,11 +38,13 @@ foo(1, 2, "abc");
foo(1, 2, ...a);
>foo(1, 2, ...a) : void
>foo : (x: number, y: number, ...z: string[]) => void
>...a : string
>a : string[]
foo(1, 2, ...a, "abc");
>foo(1, 2, ...a, "abc") : void
>foo : (x: number, y: number, ...z: string[]) => void
>...a : string
>a : string[]
obj.foo(1, 2, "abc");
@@ -56,6 +58,7 @@ obj.foo(1, 2, ...a);
>obj.foo : (x: number, y: number, ...z: string[]) => any
>obj : X
>foo : (x: number, y: number, ...z: string[]) => any
>...a : string
>a : string[]
obj.foo(1, 2, ...a, "abc");
@@ -63,6 +66,7 @@ obj.foo(1, 2, ...a, "abc");
>obj.foo : (x: number, y: number, ...z: string[]) => any
>obj : X
>foo : (x: number, y: number, ...z: string[]) => any
>...a : string
>a : string[]
(obj.foo)(1, 2, "abc");
@@ -78,6 +82,7 @@ obj.foo(1, 2, ...a, "abc");
>obj.foo : (x: number, y: number, ...z: string[]) => any
>obj : X
>foo : (x: number, y: number, ...z: string[]) => any
>...a : string
>a : string[]
(obj.foo)(1, 2, ...a, "abc");
@@ -86,6 +91,7 @@ obj.foo(1, 2, ...a, "abc");
>obj.foo : (x: number, y: number, ...z: string[]) => any
>obj : X
>foo : (x: number, y: number, ...z: string[]) => any
>...a : string
>a : string[]
xa[1].foo(1, 2, "abc");
@@ -101,6 +107,7 @@ xa[1].foo(1, 2, ...a);
>xa[1] : X
>xa : X[]
>foo : (x: number, y: number, ...z: string[]) => any
>...a : string
>a : string[]
xa[1].foo(1, 2, ...a, "abc");
@@ -109,6 +116,7 @@ xa[1].foo(1, 2, ...a, "abc");
>xa[1] : X
>xa : X[]
>foo : (x: number, y: number, ...z: string[]) => any
>...a : string
>a : string[]
(<Function>xa[1].foo)(...[1, 2, "abc"]);
@@ -120,6 +128,7 @@ xa[1].foo(1, 2, ...a, "abc");
>xa[1] : X
>xa : X[]
>foo : (x: number, y: number, ...z: string[]) => any
>...[1, 2, "abc"] : string | number
>[1, 2, "abc"] : (string | number)[]
class C {
@@ -145,6 +154,7 @@ class C {
>foo : (x: number, y: number, ...z: string[]) => void
>x : number
>y : number
>...z : string
>z : string[]
}
foo(x: number, y: number, ...z: string[]) {
@@ -167,6 +177,7 @@ class D extends C {
super(1, 2, ...a);
>super(1, 2, ...a) : void
>super : typeof C
>...a : string
>a : string[]
}
foo() {
@@ -183,6 +194,7 @@ class D extends C {
>super.foo : (x: number, y: number, ...z: string[]) => void
>super : C
>foo : (x: number, y: number, ...z: string[]) => void
>...a : string
>a : string[]
}
}
@@ -192,5 +204,6 @@ var c = new C(1, 2, ...a);
>c : C
>new C(1, 2, ...a) : C
>C : typeof C
>...a : string
>a : string[]

View File

@@ -32,5 +32,6 @@ var v = (_a = {},
_a[true] = function () { },
_a["hello bye"] = function () { },
_a["hello " + a + " bye"] = function () { },
_a);
_a
);
var _a;

View File

@@ -21,16 +21,61 @@ var s;
var n;
var a;
var v = (_a = {},
_a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a);
Object.defineProperty(_a, s, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, n, {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, s + s, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, s + n, {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, +s, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "", {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 0, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, a, {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, true, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "hello bye", {
set: function (v) { },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "hello " + a + " bye", {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
_a
);
var _a;

View File

@@ -9,6 +9,7 @@ function foo() {
function foo() {
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
}

View File

@@ -10,6 +10,7 @@ var M;
(function (M) {
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;
})(M || (M = {}));

View File

@@ -6,7 +6,17 @@ var v = {
//// [computedPropertyNames1_ES5.js]
var v = (_a = {},
_a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a);
Object.defineProperty(_a, 0 + 1, {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 0 + 1, {
set: function (v) { } //No error
,
enumerable: true,
configurable: true
}),
_a
);
var _a;

View File

@@ -6,5 +6,6 @@ var obj = {
//// [computedPropertyNames20_ES5.js]
var obj = (_a = {},
_a[this.bar] = 0,
_a);
_a
);
var _a;

View File

@@ -15,7 +15,8 @@ var C = (function () {
C.prototype.bar = function () {
var obj = (_a = {},
_a[this.bar()] = function () { },
_a);
_a
);
return 0;
var _a;
};

View File

@@ -15,9 +15,7 @@ var C = (function () {
C.prototype.bar = function () {
return 0;
};
C.prototype[(_a = {},
_a[this.bar()] = 1,
_a)[0]] = function () { };
C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { };
return C;
var _a;
})();

View File

@@ -36,7 +36,8 @@ var C = (function (_super) {
C.prototype.foo = function () {
var obj = (_a = {},
_a[_super.prototype.bar.call(this)] = function () { },
_a);
_a
);
return 0;
var _a;
};

View File

@@ -30,9 +30,7 @@ var C = (function (_super) {
function C() {
_super.apply(this, arguments);
}
C.prototype[(_a = {},
_a[_super.bar.call(this)] = 1,
_a)[0]] = function () { };
C.prototype[(_a = {}, _a[_super.bar.call(this)] = 1, _a)[0]] = function () { };
return C;
var _a;
})(Base);

View File

@@ -28,7 +28,8 @@ var C = (function (_super) {
_super.call(this);
var obj = (_a = {},
_a[(_super.call(this), "prop")] = function () { },
_a);
_a
);
var _a;
}
return C;

View File

@@ -19,7 +19,8 @@ var C = (function () {
(function () {
var obj = (_a = {},
_a[_this.bar()] = function () { },
_a);
_a
);
var _a;
});
return 0;

View File

@@ -33,8 +33,12 @@ var C = (function (_super) {
_super.call(this);
(function () {
var obj = (_a = {},
// Ideally, we would capture this. But the reference is
// illegal, and not capturing this is consistent with
//treatment of other similar violations.
_a[(_super.call(this), "prop")] = function () { },
_a);
_a
);
var _a;
});
}

View File

@@ -40,7 +40,8 @@ var C = (function (_super) {
(function () {
var obj = (_a = {},
_a[_super.prototype.bar.call(_this)] = function () { },
_a);
_a
);
var _a;
});
return 0;

View File

@@ -17,7 +17,8 @@ var C = (function () {
C.prototype.bar = function () {
var obj = (_a = {},
_a[foo()] = function () { },
_a);
_a
);
return 0;
var _a;
};

View File

@@ -17,7 +17,8 @@ var C = (function () {
C.bar = function () {
var obj = (_a = {},
_a[foo()] = function () { },
_a);
_a
);
return 0;
var _a;
};

View File

@@ -6,5 +6,6 @@ var o = {
//// [computedPropertyNames46_ES5.js]
var o = (_a = {},
_a["" || 0] = 0,
_a);
_a
);
var _a;

View File

@@ -16,5 +16,6 @@ var E2;
})(E2 || (E2 = {}));
var o = (_a = {},
_a[E1.x || E2.x] = 0,
_a);
_a
);
var _a;

View File

@@ -25,11 +25,14 @@ var E;
var a;
extractIndexer((_a = {},
_a[a] = "",
_a)); // Should return string
_a
)); // Should return string
extractIndexer((_b = {},
_b[E.x] = "",
_b)); // Should return string
_b
)); // Should return string
extractIndexer((_c = {},
_c["" || 0] = "",
_c)); // Should return any (widened form of undefined)
_c
)); // Should return any (widened form of undefined)
var _a, _b, _c;

View File

@@ -27,24 +27,41 @@ var x = {
//// [computedPropertyNames49_ES5.js]
var x = (_a = {
p1: 10
},
_a.p1 = 10,
_a[1 + 1] = Object.defineProperty({ get: function () {
p1: 10
},
Object.defineProperty(_a, 1 + 1, {
get: function () {
throw 10;
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ get: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 1 + 1, {
get: function () {
return 10;
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ set: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 1 + 1, {
set: function () {
// just throw
throw 10;
}, enumerable: true, configurable: true }),
_a.foo = Object.defineProperty({ get: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "foo", {
get: function () {
if (1 == 1) {
return 10;
}
}, enumerable: true, configurable: true }),
},
enumerable: true,
configurable: true
}),
,
_a.p2 = 20,
_a);
_a
);
var _a;

View File

@@ -32,5 +32,6 @@ var v = (_a = {},
_a[true] = 0,
_a["hello bye"] = 0,
_a["hello " + a + " bye"] = 0,
_a);
_a
);
var _a;

View File

@@ -27,29 +27,37 @@ var x = {
//// [computedPropertyNames50_ES5.js]
var x = (_a = {
p1: 10,
get foo() {
if (1 == 1) {
return 10;
}
}
},
_a.p1 = 10,
_a.foo = Object.defineProperty({ get: function () {
p1: 10,
get foo() {
if (1 == 1) {
return 10;
}
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ get: function () {
}
},
Object.defineProperty(_a, 1 + 1, {
get: function () {
throw 10;
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ set: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 1 + 1, {
set: function () {
// just throw
throw 10;
}, enumerable: true, configurable: true }),
_a[1 + 1] = Object.defineProperty({ get: function () {
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, 1 + 1, {
get: function () {
return 10;
}, enumerable: true, configurable: true }),
},
enumerable: true,
configurable: true
}),
,
_a.p2 = 20,
_a);
_a
);
var _a;

View File

@@ -18,5 +18,6 @@ var v = (_a = {},
_a[{}] = 0,
_a[undefined] = undefined,
_a[null] = null,
_a);
_a
);
var _a;

View File

@@ -16,5 +16,6 @@ var v = (_a = {},
_a[p1] = 0,
_a[p2] = 1,
_a[p3] = 2,
_a);
_a
);
var _a;

View File

@@ -13,5 +13,6 @@ var E;
})(E || (E = {}));
var v = (_a = {},
_a[E.member] = 0,
_a);
_a
);
var _a;

View File

@@ -15,6 +15,7 @@ function f() {
var v = (_a = {},
_a[t] = 0,
_a[u] = 1,
_a);
_a
);
var _a;
}

View File

@@ -16,5 +16,6 @@ var v = (_a = {},
_a[f("")] = 0,
_a[f(0)] = 0,
_a[f(true)] = 0,
_a);
_a
);
var _a;

View File

@@ -12,5 +12,6 @@ var o: I = {
var o = (_a = {},
_a[+"foo"] = "",
_a[+"bar"] = 0,
_a);
_a
);
var _a;

View File

@@ -13,5 +13,6 @@ var o: I = {
var o = (_a = {},
_a["" + 0] = function (y) { return y.length; },
_a["" + 1] = function (y) { return y.length; },
_a);
_a
);
var _a;

View File

@@ -13,5 +13,6 @@ var o: I = {
var o = (_a = {},
_a[+"foo"] = function (y) { return y.length; },
_a[+"bar"] = function (y) { return y.length; },
_a);
_a
);
var _a;

View File

@@ -12,5 +12,6 @@ var o: I = {
var o = (_a = {},
_a[+"foo"] = function (y) { return y.length; },
_a[+"bar"] = function (y) { return y.length; },
_a);
_a
);
var _a;

View File

@@ -13,5 +13,6 @@ var o: I = {
var o = (_a = {},
_a["" + "foo"] = "",
_a["" + "bar"] = 0,
_a);
_a
);
var _a;

View File

@@ -13,5 +13,6 @@ var o: I = {
var o = (_a = {},
_a[+"foo"] = "",
_a[+"bar"] = 0,
_a);
_a
);
var _a;

View File

@@ -15,13 +15,12 @@ foo({
//// [computedPropertyNamesContextualType6_ES5.js]
foo((_a = {
p: "",
0: function () { }
},
_a.p = "",
_a[0] = function () { },
p: "",
0: function () { }
},
_a["hi" + "bye"] = true,
_a[0 + 1] = 0,
_a[+"hi"] = [0],
_a));
_a
));
var _a;

View File

@@ -15,13 +15,12 @@ foo({
//// [computedPropertyNamesContextualType7_ES5.js]
foo((_a = {
p: "",
0: function () { }
},
_a.p = "",
_a[0] = function () { },
p: "",
0: function () { }
},
_a["hi" + "bye"] = true,
_a[0 + 1] = 0,
_a[+"hi"] = [0],
_a));
_a
));
var _a;

View File

@@ -13,5 +13,6 @@ var o: I = {
var o = (_a = {},
_a["" + "foo"] = "",
_a["" + "bar"] = 0,
_a);
_a
);
var _a;

View File

@@ -13,5 +13,6 @@ var o: I = {
var o = (_a = {},
_a[+"foo"] = "",
_a[+"bar"] = 0,
_a);
_a
);
var _a;

View File

@@ -10,9 +10,18 @@ var v = {
var v = (_a = {},
_a["" + ""] = 0,
_a["" + ""] = function () { },
_a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }),
_a);
Object.defineProperty(_a, "" + "", {
get: function () { return 0; },
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "" + "", {
set: function (x) { },
enumerable: true,
configurable: true
}),
_a
);
var _a;

View File

@@ -10,6 +10,7 @@ var v = (_a = {},
_a["hello"] = function () {
debugger;
},
_a);
_a
);
var _a;
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map

View File

@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;OACH,OAAO;QACJ,QAAQ,CAAC;IACb,CAAC;OACJ,CAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"}

View File

@@ -24,45 +24,53 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
---
>>> _a["hello"] = function () {
1->^^^^^^^
2 > ^^^^^^^
3 > ^^^^->
1->^^^^
2 > ^^^
3 > ^^^^^^^
4 > ^
5 > ^^^->
1->{
> [
2 > "hello"
1->Emitted(2, 8) Source(2, 6) + SourceIndex(0)
2 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
>
2 > [
3 > "hello"
4 > ]
1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
4 >Emitted(2, 16) Source(2, 14) + SourceIndex(0)
---
>>> debugger;
1->^^^^^^^^
2 > ^^^^^^^^
3 > ^
1->]() {
1->() {
>
2 > debugger
3 > ;
1->Emitted(3, 9) Source(3, 9) + SourceIndex(0)
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0)
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0)
1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"])
3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"])
---
>>> },
1 >^^^^
2 > ^
3 > ^^^^->
3 > ^^->
1 >
>
2 > }
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"])
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"])
---
>>> _a);
1->^^^^^^^
2 > ^
>>> _a
>>>);
1->^
2 > ^
3 > ^^^^^^->
1->
>}
2 >
1->Emitted(5, 8) Source(5, 2) + SourceIndex(0)
2 >Emitted(5, 9) Source(5, 2) + SourceIndex(0)
2 >
1->Emitted(6, 2) Source(5, 2) + SourceIndex(0)
2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0)
---
>>>var _a;
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map

View File

@@ -7,7 +7,7 @@ declare function dec<T>(target: T): T;
>T : T
@dec
>dec : unknown
>dec : <T>(target: T) => T
class C {
>C : C

View File

@@ -7,7 +7,7 @@ declare function dec<T>(target: T): T;
>T : T
@dec
>dec : unknown
>dec : <T>(target: T) => T
export class C {
>C : C

View File

@@ -14,6 +14,6 @@ class C {
>C : C
@dec get accessor() { return 1; }
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>accessor : number
}

View File

@@ -14,6 +14,6 @@ class C {
>C : C
@dec public get accessor() { return 1; }
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>accessor : number
}

View File

@@ -14,7 +14,7 @@ class C {
>C : C
@dec set accessor(value: number) { }
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>accessor : number
>value : number
}

View File

@@ -14,7 +14,7 @@ class C {
>C : C
@dec public set accessor(value: number) { }
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>accessor : number
>value : number
}

View File

@@ -10,6 +10,6 @@ class C {
>C : C
constructor(@dec p: number) {}
>dec : unknown
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>p : number
}

View File

@@ -14,6 +14,6 @@ class C {
>C : C
@dec method() {}
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>method : () => void
}

View File

@@ -0,0 +1,14 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts(5,10): error TS2331: 'this' cannot be referenced in a module body.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts (1 errors) ====
module M {
class C {
decorator(target: Object, key: string): void { }
@this.decorator
~~~~
!!! error TS2331: 'this' cannot be referenced in a module body.
method() { }
}
}

View File

@@ -0,0 +1,32 @@
//// [decoratorOnClassMethod11.ts]
module M {
class C {
decorator(target: Object, key: string): void { }
@this.decorator
method() { }
}
}
//// [decoratorOnClassMethod11.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var M;
(function (M) {
var C = (function () {
function C() {
}
C.prototype.decorator = function (target, key) { };
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method",
__decorate([
this.decorator
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})();
})(M || (M = {}));

View File

@@ -0,0 +1,15 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts(6,10): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod12.ts (1 errors) ====
module M {
class S {
decorator(target: Object, key: string): void { }
}
class C extends S {
@super.decorator
~~~~~
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
method() { }
}
}

View File

@@ -0,0 +1,46 @@
//// [decoratorOnClassMethod12.ts]
module M {
class S {
decorator(target: Object, key: string): void { }
}
class C extends S {
@super.decorator
method() { }
}
}
//// [decoratorOnClassMethod12.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var M;
(function (M) {
var S = (function () {
function S() {
}
S.prototype.decorator = function (target, key) { };
return S;
})();
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
C.prototype.method = function () { };
Object.defineProperty(C.prototype, "method",
__decorate([
_super.decorator
], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
return C;
})(S);
})(M || (M = {}));

View File

@@ -0,0 +1,29 @@
//// [decoratorOnClassMethod13.ts]
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {
@dec ["1"]() { }
@dec ["b"]() { }
}
//// [decoratorOnClassMethod13.js]
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
class C {
[_a = "1"]() { }
[_b = "b"]() { }
}
Object.defineProperty(C.prototype, _a,
__decorate([
dec
], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
Object.defineProperty(C.prototype, _b,
__decorate([
dec
], C.prototype, _b, Object.getOwnPropertyDescriptor(C.prototype, _b)));
var _a, _b;

View File

@@ -0,0 +1,21 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["1"]() { }
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
@dec ["b"]() { }
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@@ -14,6 +14,6 @@ class C {
>C : C
@dec public method() {}
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>method : () => void
}

View File

@@ -14,5 +14,5 @@ class C {
>C : C
@dec ["method"]() {}
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@@ -14,5 +14,5 @@ class C {
>C : C
@dec ["method"]() {}
>dec : unknown
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@@ -14,5 +14,5 @@ class C {
>C : C
@dec public ["method"]() {}
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@@ -10,6 +10,6 @@ class C {
>C : C
@dec method() {}
>dec : unknown
>dec : <T>(target: T) => T
>method : () => void
}

View File

@@ -11,6 +11,6 @@ class C {
method(@dec p: number) {}
>method : (p: number) => void
>dec : unknown
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>p : number
}

View File

@@ -8,6 +8,6 @@ class C {
>C : C
@dec prop;
>dec : unknown
>dec : (target: any, propertyKey: string) => void
>prop : any
}

View File

@@ -9,6 +9,6 @@ class C {
>C : C
@dec prop;
>dec : unknown
>dec : () => <T>(target: any, propertyKey: string) => void
>prop : any
}

View File

@@ -8,6 +8,6 @@ class C {
>C : C
@dec public prop;
>dec : unknown
>dec : (target: any, propertyKey: string) => void
>prop : any
}

View File

@@ -8,6 +8,6 @@ class C {
>C : C
@dec prop;
>dec : unknown
>dec : (target: Function) => void
>prop : any
}

View File

@@ -1,11 +1,11 @@
tests/cases/conformance/es6/for-ofStatements/for-of14.ts(2,11): error TS2488: The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator.
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 (1 errors) ====
var v: string;
for (v of new StringIterator) { } // Should fail because the iterator is not iterable
~~~~~~~~~~~~~~~~~~
!!! error TS2488: The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator.
!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
class StringIterator {
next() {

View File

@@ -1,11 +1,11 @@
tests/cases/conformance/es6/for-ofStatements/for-of16.ts(2,11): error TS2489: The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method.
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 (1 errors) ====
var v: string;
for (v of new StringIterator) { } // Should fail
~~~~~~~~~~~~~~~~~~
!!! error TS2489: The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method.
!!! error TS2489: An iterator must have a 'next()' method.
class StringIterator {
[Symbol.iterator]() {

View File

@@ -0,0 +1,7 @@
//// [for-of57.ts]
var iter: Iterable<number>;
for (let num of iter) { }
//// [for-of57.js]
var iter;
for (let num of iter) { }

View File

@@ -0,0 +1,9 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of57.ts ===
var iter: Iterable<number>;
>iter : Iterable<number>
>Iterable : Iterable<T>
for (let num of iter) { }
>num : number
>iter : Iterable<number>

View File

@@ -0,0 +1,28 @@
//// [iterableArrayPattern1.ts]
var [a, b] = new SymbolIterator;
class SymbolIterator {
next() {
return {
value: Symbol(),
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern1.js]
var [a, b] = new SymbolIterator;
class SymbolIterator {
next() {
return {
value: Symbol(),
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
=== 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
next() {
>next : () => { value: symbol; done: boolean; }
return {
>{ value: Symbol(), done: false } : { value: symbol; done: boolean; }
value: Symbol(),
>value : symbol
>Symbol() : symbol
>Symbol : SymbolConstructor
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : SymbolIterator
}
}

View File

@@ -0,0 +1,24 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern10.ts(2,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 {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern10.ts]
function fun([a, b]) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern10.js]
function fun([a, b]) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern11.ts]
function fun([a, b] = new FooIterator) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern11.js]
function fun([a, b] = new FooIterator) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,52 @@
=== 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
class Foo extends Bar { y }
>Foo : Foo
>Bar : Bar
>y : any
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern12.ts]
function fun([a, ...b] = new FooIterator) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern12.js]
function fun([a, ...b] = new FooIterator) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,52 @@
=== 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
class Foo extends Bar { y }
>Foo : Foo
>Bar : Bar
>y : any
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern13.ts]
function fun([a, ...b]) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern13.js]
function fun([a, ...b]) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,50 @@
=== 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
class Foo extends Bar { y }
>Foo : Foo
>Bar : Bar
>y : any
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern14.ts]
function fun(...[a, ...b]) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern14.js]
function fun(...[a, ...b]) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,50 @@
=== tests/cases/conformance/es6/destructuring/iterableArrayPattern14.ts ===
function fun(...[a, ...b]) { }
>fun : (...[a, ...b]: any[]) => void
>a : any
>b : any[]
fun(new FooIterator);
>fun(new FooIterator) : void
>fun : (...[a, ...b]: any[]) => void
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
class Bar { x }
>Bar : Bar
>x : any
class Foo extends Bar { y }
>Foo : Foo
>Bar : Bar
>y : any
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern15.ts]
function fun(...[a, b]: Bar[]) { }
fun(...new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern15.js]
function fun(...[a, b]) { }
fun(...new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,52 @@
=== tests/cases/conformance/es6/destructuring/iterableArrayPattern15.ts ===
function fun(...[a, b]: Bar[]) { }
>fun : (...[a, b]: Bar[]) => void
>a : Bar
>b : Bar
>Bar : Bar
fun(...new FooIterator);
>fun(...new FooIterator) : void
>fun : (...[a, b]: Bar[]) => void
>...new FooIterator : Foo
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
class Bar { x }
>Bar : Bar
>x : any
class Foo extends Bar { y }
>Foo : Foo
>Bar : Bar
>y : any
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View File

@@ -0,0 +1,37 @@
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 (1 errors) ====
function fun(...[a, b]: [Bar, Bar][]) { }
fun(...new FooIteratorIterator);
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type 'FooIterator' is not assignable to parameter of type '[Bar, Bar]'.
!!! error TS2345: Property '0' is missing in type 'FooIterator'.
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
class FooIteratorIterator {
next() {
return {
value: new FooIterator,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,60 @@
//// [iterableArrayPattern16.ts]
function fun(...[a, b]: [Bar, Bar][]) { }
fun(...new FooIteratorIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
class FooIteratorIterator {
next() {
return {
value: new FooIterator,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern16.js]
function fun(...[a, b]) { }
fun(...new FooIteratorIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
class FooIteratorIterator {
next() {
return {
value: new FooIterator,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,24 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern17.ts(2,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 (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 'x' is missing in type 'FooIterator'.
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern17.ts]
function fun(...[a, b]: Bar[]) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern17.js]
function fun(...[a, b]) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,24 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern18.ts(2,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 {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern18.ts]
function fun([a, b]: Bar[]) { }
fun(new FooIterator);
class Bar { x }
class Foo extends Bar { y }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern18.js]
function fun([a, b]) { }
fun(new FooIterator);
class Bar {
}
class Foo extends Bar {
}
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,24 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern19.ts(2,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 {
next() {
return {
value: [new Foo],
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
//// [iterableArrayPattern19.ts]
function fun([[a], b]: Bar[][]) { }
fun(new FooArrayIterator);
class Bar { x }
class Foo extends Bar { y }
class FooArrayIterator {
next() {
return {
value: [new Foo],
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern19.js]
function fun([[a], b]) { }
fun(new FooArrayIterator);
class Bar {
}
class Foo extends Bar {
}
class FooArrayIterator {
next() {
return {
value: [new Foo],
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,28 @@
//// [iterableArrayPattern2.ts]
var [a, ...b] = new SymbolIterator;
class SymbolIterator {
next() {
return {
value: Symbol(),
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [iterableArrayPattern2.js]
var [a, ...b] = new SymbolIterator;
class SymbolIterator {
next() {
return {
value: Symbol(),
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View File

@@ -0,0 +1,36 @@
=== 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
next() {
>next : () => { value: symbol; done: boolean; }
return {
>{ value: Symbol(), done: false } : { value: symbol; done: boolean; }
value: Symbol(),
>value : symbol
>Symbol() : symbol
>Symbol : SymbolConstructor
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : SymbolIterator
}
}

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