mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-11 06:02:53 -05:00
Fixed incorrect tests.
This commit is contained in:
@@ -2,18 +2,15 @@ tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(22
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(22,35): error TS2339: Property 'y' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(22,43): error TS2339: Property 'y' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(22,52): error TS2339: Property 'z' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,26): error TS2339: Property 'x' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,35): error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,43): error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,52): error TS2339: Property 'z' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(28,23): error TS1005: ':' expected.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,26): error TS2339: Property 'x' does not exist on type 'C3'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,35): error TS2339: Property 'y' does not exist on type 'C3'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,43): error TS2339: Property 'y' does not exist on type 'C3'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,52): error TS2339: Property 'z' does not exist on type 'C3'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,30): error TS2339: Property 'x' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,36): error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(25,42): error TS2339: Property 'z' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,30): error TS2339: Property 'x' does not exist on type 'C3'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,36): error TS2339: Property 'y' does not exist on type 'C3'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29,42): error TS2339: Property 'z' does not exist on type 'C3'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts (13 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts (10 errors) ====
|
||||
class C1 {
|
||||
constructor(public [x, y, z]: string[]) {
|
||||
}
|
||||
@@ -46,26 +43,20 @@ tests/cases/conformance/es6/destructuring/destructuringPropertyParameters1.ts(29
|
||||
!!! error TS2339: Property 'z' does not exist on type 'C1'.
|
||||
|
||||
var c2 = new C2(["10", 10, !!10]);
|
||||
var useC2Properties = c2.x === c2.y && c2.y === c2.z;
|
||||
~
|
||||
var [c2_x, c2_y, c2_z] = [c2.x, c2.y, c2.z];
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'C2'.
|
||||
~
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
~
|
||||
~
|
||||
!!! error TS2339: Property 'z' does not exist on type 'C2'.
|
||||
|
||||
var c3 = new C3({x: 0, y: "", z: false});
|
||||
c3 = new C3({x: 0, "y", z: true});
|
||||
~
|
||||
!!! error TS1005: ':' expected.
|
||||
var useC3Properties = c3.x === c3.y && c3.y === c3.z;
|
||||
~
|
||||
c3 = new C3({x: 0, "y": "y", z: true});
|
||||
var [c3_x, c3_y, c3_z] = [c3.x, c3.y, c3.z];
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'C3'.
|
||||
~
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'C3'.
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'C3'.
|
||||
~
|
||||
~
|
||||
!!! error TS2339: Property 'z' does not exist on type 'C3'.
|
||||
@@ -0,0 +1,61 @@
|
||||
//// [destructuringPropertyParameters1.ts]
|
||||
class C1 {
|
||||
constructor(public [x, y, z]: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
type TupleType1 = [string, number, boolean];
|
||||
|
||||
class C2 {
|
||||
constructor(public [x, y, z]: TupleType1) {
|
||||
}
|
||||
}
|
||||
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
|
||||
class C3 {
|
||||
constructor(public { x, y, z }: ObjType1) {
|
||||
}
|
||||
}
|
||||
|
||||
var c1 = new C1([]);
|
||||
c1 = new C1(["larry", "{curly}", "moe"]);
|
||||
var useC1Properties = c1.x === c1.y && c1.y === c1.z;
|
||||
|
||||
var c2 = new C2(["10", 10, !!10]);
|
||||
var [c2_x, c2_y, c2_z] = [c2.x, c2.y, c2.z];
|
||||
|
||||
var c3 = new C3({x: 0, y: "", z: false});
|
||||
c3 = new C3({x: 0, "y": "y", z: true});
|
||||
var [c3_x, c3_y, c3_z] = [c3.x, c3.y, c3.z];
|
||||
|
||||
//// [destructuringPropertyParameters1.js]
|
||||
var C1 = (function () {
|
||||
function C1(_a) {
|
||||
var x = _a[0], y = _a[1], z = _a[2];
|
||||
this.[x, y, z] = [x, y, z];
|
||||
}
|
||||
return C1;
|
||||
})();
|
||||
var C2 = (function () {
|
||||
function C2(_a) {
|
||||
var x = _a[0], y = _a[1], z = _a[2];
|
||||
this.[x, y, z] = [x, y, z];
|
||||
}
|
||||
return C2;
|
||||
})();
|
||||
var C3 = (function () {
|
||||
function C3(_a) {
|
||||
var x = _a.x, y = _a.y, z = _a.z;
|
||||
this.{ x, y, z } = { x, y, z };
|
||||
}
|
||||
return C3;
|
||||
})();
|
||||
var c1 = new C1([]);
|
||||
c1 = new C1(["larry", "{curly}", "moe"]);
|
||||
var useC1Properties = c1.x === c1.y && c1.y === c1.z;
|
||||
var c2 = new C2(["10", 10, !!10]);
|
||||
var _a = [c2.x, c2.y, c2.z], c2_x = _a[0], c2_y = _a[1], c2_z = _a[2];
|
||||
var c3 = new C3({ x: 0, y: "", z: false });
|
||||
c3 = new C3({ x: 0, "y": "y", z: true });
|
||||
var _b = [c3.x, c3.y, c3.z], c3_x = _b[0], c3_y = _b[1], c3_z = _b[2];
|
||||
@@ -4,9 +4,9 @@ tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(5,
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(10,21): error TS2339: Property 'a' does not exist on type 'C1<T, U, V>'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(14,21): error TS2339: Property 'b' does not exist on type 'C1<T, U, V>'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(18,21): error TS2339: Property 'c' does not exist on type 'C1<T, U, V>'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24,24): error TS2339: Property 'x' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24,34): error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24,44): error TS2339: Property 'z' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24,24): error TS2339: Property 'a' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24,34): error TS2339: Property 'b' does not exist on type 'C2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24,44): error TS2339: Property 'c' does not exist on type 'C2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts (9 errors) ====
|
||||
@@ -45,13 +45,13 @@ tests/cases/conformance/es6/destructuring/destructuringPropertyParameters4.ts(24
|
||||
|
||||
class C2 extends C1<number, string, boolean> {
|
||||
public doSomethingWithSuperProperties() {
|
||||
return `${this.x} ${this.y} ${this.z}`;
|
||||
return `${this.a} ${this.b} ${this.c}`;
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'C2'.
|
||||
!!! error TS2339: Property 'a' does not exist on type 'C2'.
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'C2'.
|
||||
!!! error TS2339: Property 'b' does not exist on type 'C2'.
|
||||
~
|
||||
!!! error TS2339: Property 'z' does not exist on type 'C2'.
|
||||
!!! error TS2339: Property 'c' does not exist on type 'C2'.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class C1<T, U, V> {
|
||||
|
||||
class C2 extends C1<number, string, boolean> {
|
||||
public doSomethingWithSuperProperties() {
|
||||
return `${this.x} ${this.y} ${this.z}`;
|
||||
return `${this.a} ${this.b} ${this.c}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ var C2 = (function (_super) {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
C2.prototype.doSomethingWithSuperProperties = function () {
|
||||
return `${this.x} ${this.y} ${this.z}`;
|
||||
return `${this.a} ${this.b} ${this.c}`;
|
||||
};
|
||||
return C2;
|
||||
})(C1);
|
||||
|
||||
@@ -10,10 +10,9 @@ tests/cases/conformance/es6/destructuring/destructuringPropertyParameters5.ts(11
|
||||
Types of property '0' are incompatible.
|
||||
Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
|
||||
Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringPropertyParameters5.ts(11,56): error TS1005: ',' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringPropertyParameters5.ts (10 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringPropertyParameters5.ts (9 errors) ====
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
type TupleType1 = [ObjType1, number, string]
|
||||
|
||||
@@ -40,12 +39,10 @@ tests/cases/conformance/es6/destructuring/destructuringPropertyParameters5.ts(11
|
||||
}
|
||||
}
|
||||
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
|
||||
!!! error TS2345: Types of property '0' are incompatible.
|
||||
!!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
|
||||
!!! error TS2345: Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [destructuringPropertyParameters5.ts]
|
||||
type ObjType1 = { x: number; y: string; z: boolean }
|
||||
type TupleType1 = [ObjType1, number, string]
|
||||
|
||||
class C1 {
|
||||
constructor(public [{ x1, x2, x3 }, y, z]: TupleType1) {
|
||||
var foo: any = x1 || x2 || x3 || y || z;
|
||||
var bar: any = this.x1 || this.x2 || this.x3 || this.y || this.z;
|
||||
}
|
||||
}
|
||||
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
|
||||
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
|
||||
//// [destructuringPropertyParameters5.js]
|
||||
var C1 = (function () {
|
||||
function C1(_a) {
|
||||
var _b = _a[0], x1 = _b.x1, x2 = _b.x2, x3 = _b.x3, y = _a[1], z = _a[2];
|
||||
this.[{ x1, x2, x3 }, y, z] = [{ x1, x2, x3 }, y, z];
|
||||
var foo = x1 || x2 || x3 || y || z;
|
||||
var bar = this.x1 || this.x2 || this.x3 || this.y || this.z;
|
||||
}
|
||||
return C1;
|
||||
})();
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
|
||||
var _a = [a.x1, a.x2, a.x3, a.y, a.z], a_x1 = _a[0], a_x2 = _a[1], a_x3 = _a[2], a_y = _a[3], a_z = _a[4];
|
||||
@@ -22,8 +22,8 @@ c1 = new C1(["larry", "{curly}", "moe"]);
|
||||
var useC1Properties = c1.x === c1.y && c1.y === c1.z;
|
||||
|
||||
var c2 = new C2(["10", 10, !!10]);
|
||||
var useC2Properties = c2.x === c2.y && c2.y === c2.z;
|
||||
var [c2_x, c2_y, c2_z] = [c2.x, c2.y, c2.z];
|
||||
|
||||
var c3 = new C3({x: 0, y: "", z: false});
|
||||
c3 = new C3({x: 0, "y", z: true});
|
||||
var useC3Properties = c3.x === c3.y && c3.y === c3.z;
|
||||
c3 = new C3({x: 0, "y": "y", z: true});
|
||||
var [c3_x, c3_y, c3_z] = [c3.x, c3.y, c3.z];
|
||||
@@ -22,6 +22,6 @@ class C1<T, U, V> {
|
||||
|
||||
class C2 extends C1<number, string, boolean> {
|
||||
public doSomethingWithSuperProperties() {
|
||||
return `${this.x} ${this.y} ${this.z}`;
|
||||
return `${this.a} ${this.b} ${this.c}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ class C1 {
|
||||
}
|
||||
}
|
||||
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false);
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
|
||||
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|
||||
Reference in New Issue
Block a user