Skip to content

Commit 65ef06e

Browse files
committed
Accept new baselines
1 parent a25104e commit 65ef06e

12 files changed

+250
-111
lines changed

tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts ===
2+
interface Show {
3+
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
4+
5+
show: (x: number) => string;
6+
>show : Symbol(Show.show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 16))
7+
>x : Symbol(x, Decl(contextuallyTypedBindingInitializerNegative.ts, 1, 11))
8+
}
9+
function f({ show: showRename = v => v }: Show) {}
10+
>f : Symbol(f, Decl(contextuallyTypedBindingInitializerNegative.ts, 2, 1))
11+
>show : Symbol(Show.show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 16))
12+
>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 12))
13+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 31))
14+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 31))
15+
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
16+
17+
function f2({ "show": showRename = v => v }: Show) {}
18+
>f2 : Symbol(f2, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 50))
19+
>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 13))
20+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 34))
21+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 34))
22+
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
23+
24+
function f3({ ["show"]: showRename = v => v }: Show) {}
25+
>f3 : Symbol(f3, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 53))
26+
>"show" : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 13))
27+
>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 13))
28+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 36))
29+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 36))
30+
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
31+
32+
interface Nested {
33+
>Nested : Symbol(Nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 55))
34+
35+
nested: Show
36+
>nested : Symbol(Nested.nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 7, 18))
37+
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
38+
}
39+
function ff({ nested: nestedRename = { show: v => v } }: Nested) {}
40+
>ff : Symbol(ff, Decl(contextuallyTypedBindingInitializerNegative.ts, 9, 1))
41+
>nested : Symbol(Nested.nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 7, 18))
42+
>nestedRename : Symbol(nestedRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 13))
43+
>show : Symbol(show, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 38))
44+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 44))
45+
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 44))
46+
>Nested : Symbol(Nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 55))
47+
48+
interface StringIdentity {
49+
>StringIdentity : Symbol(StringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 67))
50+
51+
stringIdentity(s: string): string;
52+
>stringIdentity : Symbol(StringIdentity.stringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 12, 26))
53+
>s : Symbol(s, Decl(contextuallyTypedBindingInitializerNegative.ts, 13, 19))
54+
}
55+
let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x};
56+
>stringIdentity : Symbol(StringIdentity.stringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 12, 26))
57+
>id : Symbol(id, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 5))
58+
>arg : Symbol(arg, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 26))
59+
>arg.length : Symbol(String.length, Decl(lib.d.ts, --, --))
60+
>arg : Symbol(arg, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 26))
61+
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
62+
>StringIdentity : Symbol(StringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 67))
63+
>stringIdentity : Symbol(stringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 66))
64+
>x : Symbol(x, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 82))
65+
>x : Symbol(x, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 82))
66+
67+
interface Tuples {
68+
>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 91))
69+
70+
prop: [string, number];
71+
>prop : Symbol(Tuples.prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 17, 18))
72+
}
73+
function g({ prop = [101, 1234] }: Tuples) {}
74+
>g : Symbol(g, Decl(contextuallyTypedBindingInitializerNegative.ts, 19, 1))
75+
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 12))
76+
>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 91))
77+
78+
interface StringUnion {
79+
>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 45))
80+
81+
prop: "foo" | "bar";
82+
>prop : Symbol(StringUnion.prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 22, 23))
83+
}
84+
function h({ prop = "baz" }: StringUnion) {}
85+
>h : Symbol(h, Decl(contextuallyTypedBindingInitializerNegative.ts, 24, 1))
86+
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 25, 12))
87+
>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 45))
88+
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts ===
2+
interface Show {
3+
>Show : Show
4+
5+
show: (x: number) => string;
6+
>show : (x: number) => string
7+
>x : number
8+
}
9+
function f({ show: showRename = v => v }: Show) {}
10+
>f : ({show: showRename}: Show) => void
11+
>show : any
12+
>showRename : ((x: number) => string) | ((v: number) => number)
13+
>v => v : (v: number) => number
14+
>v : number
15+
>v : number
16+
>Show : Show
17+
18+
function f2({ "show": showRename = v => v }: Show) {}
19+
>f2 : ({"show": showRename}: Show) => void
20+
>showRename : ((x: number) => string) | ((v: number) => number)
21+
>v => v : (v: number) => number
22+
>v : number
23+
>v : number
24+
>Show : Show
25+
26+
function f3({ ["show"]: showRename = v => v }: Show) {}
27+
>f3 : ({["show"]: showRename}: Show) => void
28+
>"show" : string
29+
>showRename : ((x: number) => string) | ((v: number) => number)
30+
>v => v : (v: number) => number
31+
>v : number
32+
>v : number
33+
>Show : Show
34+
35+
interface Nested {
36+
>Nested : Nested
37+
38+
nested: Show
39+
>nested : Show
40+
>Show : Show
41+
}
42+
function ff({ nested: nestedRename = { show: v => v } }: Nested) {}
43+
>ff : ({nested: nestedRename}: Nested) => void
44+
>nested : any
45+
>nestedRename : Show | { show: (v: number) => number; }
46+
>{ show: v => v } : { show: (v: number) => number; }
47+
>show : (v: number) => number
48+
>v => v : (v: number) => number
49+
>v : number
50+
>v : number
51+
>Nested : Nested
52+
53+
interface StringIdentity {
54+
>StringIdentity : StringIdentity
55+
56+
stringIdentity(s: string): string;
57+
>stringIdentity : (s: string) => string
58+
>s : string
59+
}
60+
let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x};
61+
>stringIdentity : any
62+
>id : ((s: string) => string) | ((arg: string) => number)
63+
>arg => arg.length : (arg: string) => number
64+
>arg : string
65+
>arg.length : number
66+
>arg : string
67+
>length : number
68+
>StringIdentity : StringIdentity
69+
>{ stringIdentity: x => x} : { stringIdentity: (x: string) => string; }
70+
>stringIdentity : (x: string) => string
71+
>x => x : (x: string) => string
72+
>x : string
73+
>x : string
74+
75+
interface Tuples {
76+
>Tuples : Tuples
77+
78+
prop: [string, number];
79+
>prop : [string, number]
80+
}
81+
function g({ prop = [101, 1234] }: Tuples) {}
82+
>g : ({prop}: Tuples) => void
83+
>prop : [string, number] | [number, number]
84+
>[101, 1234] : [number, number]
85+
>101 : number
86+
>1234 : number
87+
>Tuples : Tuples
88+
89+
interface StringUnion {
90+
>StringUnion : StringUnion
91+
92+
prop: "foo" | "bar";
93+
>prop : "foo" | "bar"
94+
}
95+
function h({ prop = "baz" }: StringUnion) {}
96+
>h : ({prop}: StringUnion) => void
97+
>prop : "foo" | "bar" | "baz"
98+
>"baz" : "baz"
99+
>StringUnion : StringUnion
100+

tests/baselines/reference/declarationsAndAssignments.errors.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25):
55
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
66
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
77
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
8-
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'.
8+
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | number', but here has type 'string'.
99
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
1010
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
1111
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
@@ -96,10 +96,10 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
9696

9797
function f7() {
9898
var [x = 0, y = 1] = [1, "hello"]; // Error, initializer for y must be string
99-
~
100-
!!! error TS2322: Type 'number' is not assignable to type 'string'.
10199
var x: number;
102100
var y: string;
101+
~
102+
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | number', but here has type 'string'.
103103
}
104104

105105
function f8() {

tests/baselines/reference/destructuringArrayBindingPatternAndAssignment2.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
33
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
44
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
55
Type 'number' is not assignable to type 'boolean'.
6-
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(17,6): error TS2322: Type 'string' is not assignable to type 'Number'.
76
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2322: Type 'number[]' is not assignable to type '[number, number]'.
87
Property '0' is missing in type 'number[]'.
98
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(23,5): error TS2322: Type 'number[]' is not assignable to type '[string, string]'.
109
Property '0' is missing in type 'number[]'.
1110
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(34,5): error TS2461: Type 'F' is not an array type.
1211

1312

14-
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts (8 errors) ====
13+
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts (7 errors) ====
1514
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
1615
// S is the type Any, or
1716
var [[a0], [[a1]]] = [] // Error
@@ -38,8 +37,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
3837
return <[number, number, number]>[1, 2, 3];
3938
}
4039
var [b3 = "string", b4, b5] = bar(); // Error
41-
~~
42-
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
4340

4441
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
4542
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.

tests/baselines/reference/destructuringVariableDeclaration1ES5.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }];
6262
>"hello" : string
6363

6464
var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined];
65-
>b5 : any
65+
>b5 : number
6666
>3 : number
67-
>b6 : any
67+
>b6 : boolean
6868
>true : boolean
69-
>b7 : any
69+
>b7 : { t1: boolean; t2: string; }
7070
>temp : { t1: boolean; t2: string; }
7171
>[undefined, undefined, undefined] : [undefined, undefined, undefined]
7272
>undefined : undefined

tests/baselines/reference/destructuringVariableDeclaration1ES6.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }];
6262
>"hello" : string
6363

6464
var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined];
65-
>b5 : any
65+
>b5 : number
6666
>3 : number
67-
>b6 : any
67+
>b6 : boolean
6868
>true : boolean
69-
>b7 : any
69+
>b7 : { t1: boolean; t2: string; }
7070
>temp : { t1: boolean; t2: string; }
7171
>[undefined, undefined, undefined] : [undefined, undefined, undefined]
7272
>undefined : undefined

0 commit comments

Comments
 (0)