Skip to content

Commit 6f94314

Browse files
committed
Accept baselines
1 parent 6954cd2 commit 6f94314

19 files changed

+231
-19
lines changed

tests/baselines/reference/destructuringParameterDeclaration1ES5.errors.txt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.ts(32,4): error TS2345: Argument of type '[string, number, number]' is not assignable to parameter of type '[undefined, null, undefined]'.
2-
Types of property '0' are incompatible.
3-
Type 'string' is not assignable to type 'undefined'.
4-
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.ts(33,4): error TS2345: Argument of type '[[string], number, [[boolean, boolean]]]' is not assignable to parameter of type '[[undefined], undefined, [[undefined, undefined]]]'.
5-
Types of property '0' are incompatible.
6-
Type '[string]' is not assignable to type '[undefined]'.
7-
Types of property '0' are incompatible.
8-
Type 'string' is not assignable to type 'undefined'.
91
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.ts(62,10): error TS2393: Duplicate function implementation.
102
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.ts(63,10): error TS2393: Duplicate function implementation.
113

124

13-
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.ts (4 errors) ====
5+
==== tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.ts (2 errors) ====
146
// A parameter declaration may specify either an identifier or a binding pattern.
157
// The identifiers specified in parameter declarations and binding patterns
168
// in a parameter list must be unique within that parameter list.
@@ -43,17 +35,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration1ES5.
4335
b2("string", { x: 200, y: "string" });
4436
b2("string", { x: 200, y: true });
4537
b6(["string", 1, 2]); // Shouldn't be an error
46-
~~~~~~~~~~~~~~~~
47-
!!! error TS2345: Argument of type '[string, number, number]' is not assignable to parameter of type '[undefined, null, undefined]'.
48-
!!! error TS2345: Types of property '0' are incompatible.
49-
!!! error TS2345: Type 'string' is not assignable to type 'undefined'.
5038
b7([["string"], 1, [[true, false]]]); // Shouldn't be an error
51-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52-
!!! error TS2345: Argument of type '[[string], number, [[boolean, boolean]]]' is not assignable to parameter of type '[[undefined], undefined, [[undefined, undefined]]]'.
53-
!!! error TS2345: Types of property '0' are incompatible.
54-
!!! error TS2345: Type '[string]' is not assignable to type '[undefined]'.
55-
!!! error TS2345: Types of property '0' are incompatible.
56-
!!! error TS2345: Type 'string' is not assignable to type 'undefined'.
5739

5840

5941
// If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//// [wideningTuples1.ts]
2+
declare function foo<T extends [any]>(x: T): T;
3+
4+
var y = foo([undefined]);
5+
y = [""];
6+
7+
//// [wideningTuples1.js]
8+
var y = foo([undefined]);
9+
y = [""];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/conformance/types/tuple/wideningTuples1.ts ===
2+
declare function foo<T extends [any]>(x: T): T;
3+
>foo : Symbol(foo, Decl(wideningTuples1.ts, 0, 0))
4+
>T : Symbol(T, Decl(wideningTuples1.ts, 0, 21))
5+
>x : Symbol(x, Decl(wideningTuples1.ts, 0, 38))
6+
>T : Symbol(T, Decl(wideningTuples1.ts, 0, 21))
7+
>T : Symbol(T, Decl(wideningTuples1.ts, 0, 21))
8+
9+
var y = foo([undefined]);
10+
>y : Symbol(y, Decl(wideningTuples1.ts, 2, 3))
11+
>foo : Symbol(foo, Decl(wideningTuples1.ts, 0, 0))
12+
>undefined : Symbol(undefined)
13+
14+
y = [""];
15+
>y : Symbol(y, Decl(wideningTuples1.ts, 2, 3))
16+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=== tests/cases/conformance/types/tuple/wideningTuples1.ts ===
2+
declare function foo<T extends [any]>(x: T): T;
3+
>foo : <T extends [any]>(x: T) => T
4+
>T : T
5+
>x : T
6+
>T : T
7+
>T : T
8+
9+
var y = foo([undefined]);
10+
>y : [any]
11+
>foo([undefined]) : [any]
12+
>foo : <T extends [any]>(x: T) => T
13+
>[undefined] : [undefined]
14+
>undefined : undefined
15+
16+
y = [""];
17+
>y = [""] : [string]
18+
>y : [any]
19+
>[""] : [string]
20+
>"" : string
21+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//// [wideningTuples2.ts]
2+
var foo: () => [any] = function bar() {
3+
let intermediate = bar();
4+
intermediate = [""];
5+
return [undefined];
6+
};
7+
8+
//// [wideningTuples2.js]
9+
var foo = function bar() {
10+
var intermediate = bar();
11+
intermediate = [""];
12+
return [undefined];
13+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/conformance/types/tuple/wideningTuples2.ts ===
2+
var foo: () => [any] = function bar() {
3+
>foo : Symbol(foo, Decl(wideningTuples2.ts, 0, 3))
4+
>bar : Symbol(bar, Decl(wideningTuples2.ts, 0, 22))
5+
6+
let intermediate = bar();
7+
>intermediate : Symbol(intermediate, Decl(wideningTuples2.ts, 1, 7))
8+
>bar : Symbol(bar, Decl(wideningTuples2.ts, 0, 22))
9+
10+
intermediate = [""];
11+
>intermediate : Symbol(intermediate, Decl(wideningTuples2.ts, 1, 7))
12+
13+
return [undefined];
14+
>undefined : Symbol(undefined)
15+
16+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/conformance/types/tuple/wideningTuples2.ts ===
2+
var foo: () => [any] = function bar() {
3+
>foo : () => [any]
4+
>function bar() { let intermediate = bar(); intermediate = [""]; return [undefined];} : () => [any]
5+
>bar : () => [any]
6+
7+
let intermediate = bar();
8+
>intermediate : [any]
9+
>bar() : [any]
10+
>bar : () => [any]
11+
12+
intermediate = [""];
13+
>intermediate = [""] : [string]
14+
>intermediate : [any]
15+
>[""] : [string]
16+
>"" : string
17+
18+
return [undefined];
19+
>[undefined] : [undefined]
20+
>undefined : undefined
21+
22+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tests/cases/conformance/types/tuple/wideningTuples3.ts(3,5): error TS7005: Variable 'b' implicitly has an '[any, any]' type.
2+
3+
4+
==== tests/cases/conformance/types/tuple/wideningTuples3.ts (1 errors) ====
5+
var a: [any];
6+
7+
var b = a = [undefined, null];
8+
~
9+
!!! error TS7005: Variable 'b' implicitly has an '[any, any]' type.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//// [wideningTuples3.ts]
2+
var a: [any];
3+
4+
var b = a = [undefined, null];
5+
6+
//// [wideningTuples3.js]
7+
var a;
8+
var b = a = [undefined, null];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//// [wideningTuples4.ts]
2+
var a: [any];
3+
4+
var b = a = [undefined, null];
5+
b = ["", ""];
6+
7+
//// [wideningTuples4.js]
8+
var a;
9+
var b = a = [undefined, null];
10+
b = ["", ""];

0 commit comments

Comments
 (0)