Skip to content

Commit f38a4aa

Browse files
committed
Accept new baselines
1 parent 51712fb commit f38a4aa

File tree

3 files changed

+323
-0
lines changed

3 files changed

+323
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//// [arrayLiteralInference.ts]
2+
// Repro from #31204
3+
4+
export enum AppType {
5+
HeaderDetail = 'HeaderDetail',
6+
HeaderMultiDetail = 'HeaderMultiDetail',
7+
AdvancedList = 'AdvancedList',
8+
Standard = 'Standard',
9+
Relationship = 'Relationship',
10+
Report = 'Report',
11+
Composite = 'Composite',
12+
ListOnly = 'ListOnly',
13+
ModuleSettings = 'ModuleSettings'
14+
}
15+
16+
export enum AppStyle {
17+
Tree,
18+
TreeEntity,
19+
Standard,
20+
MiniApp,
21+
PivotTable
22+
}
23+
24+
const appTypeStylesWithError: Map<AppType, Array<AppStyle>> = new Map([
25+
[AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]],
26+
[AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]],
27+
[AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]
28+
]);
29+
30+
// Repro from #31204
31+
32+
declare function foo<T>(...args: T[]): T[];
33+
let b1: { x: boolean }[] = foo({ x: true }, { x: false });
34+
let b2: boolean[][] = foo([true], [false]);
35+
36+
37+
//// [arrayLiteralInference.js]
38+
// Repro from #31204
39+
export var AppType;
40+
(function (AppType) {
41+
AppType["HeaderDetail"] = "HeaderDetail";
42+
AppType["HeaderMultiDetail"] = "HeaderMultiDetail";
43+
AppType["AdvancedList"] = "AdvancedList";
44+
AppType["Standard"] = "Standard";
45+
AppType["Relationship"] = "Relationship";
46+
AppType["Report"] = "Report";
47+
AppType["Composite"] = "Composite";
48+
AppType["ListOnly"] = "ListOnly";
49+
AppType["ModuleSettings"] = "ModuleSettings";
50+
})(AppType || (AppType = {}));
51+
export var AppStyle;
52+
(function (AppStyle) {
53+
AppStyle[AppStyle["Tree"] = 0] = "Tree";
54+
AppStyle[AppStyle["TreeEntity"] = 1] = "TreeEntity";
55+
AppStyle[AppStyle["Standard"] = 2] = "Standard";
56+
AppStyle[AppStyle["MiniApp"] = 3] = "MiniApp";
57+
AppStyle[AppStyle["PivotTable"] = 4] = "PivotTable";
58+
})(AppStyle || (AppStyle = {}));
59+
const appTypeStylesWithError = new Map([
60+
[AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]],
61+
[AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]],
62+
[AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]
63+
]);
64+
let b1 = foo({ x: true }, { x: false });
65+
let b2 = foo([true], [false]);
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
=== tests/cases/conformance/expressions/arrayLiterals/arrayLiteralInference.ts ===
2+
// Repro from #31204
3+
4+
export enum AppType {
5+
>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0))
6+
7+
HeaderDetail = 'HeaderDetail',
8+
>HeaderDetail : Symbol(AppType.HeaderDetail, Decl(arrayLiteralInference.ts, 2, 21))
9+
10+
HeaderMultiDetail = 'HeaderMultiDetail',
11+
>HeaderMultiDetail : Symbol(AppType.HeaderMultiDetail, Decl(arrayLiteralInference.ts, 3, 34))
12+
13+
AdvancedList = 'AdvancedList',
14+
>AdvancedList : Symbol(AppType.AdvancedList, Decl(arrayLiteralInference.ts, 4, 44))
15+
16+
Standard = 'Standard',
17+
>Standard : Symbol(AppType.Standard, Decl(arrayLiteralInference.ts, 5, 34))
18+
19+
Relationship = 'Relationship',
20+
>Relationship : Symbol(AppType.Relationship, Decl(arrayLiteralInference.ts, 6, 26))
21+
22+
Report = 'Report',
23+
>Report : Symbol(AppType.Report, Decl(arrayLiteralInference.ts, 7, 34))
24+
25+
Composite = 'Composite',
26+
>Composite : Symbol(AppType.Composite, Decl(arrayLiteralInference.ts, 8, 22))
27+
28+
ListOnly = 'ListOnly',
29+
>ListOnly : Symbol(AppType.ListOnly, Decl(arrayLiteralInference.ts, 9, 28))
30+
31+
ModuleSettings = 'ModuleSettings'
32+
>ModuleSettings : Symbol(AppType.ModuleSettings, Decl(arrayLiteralInference.ts, 10, 26))
33+
}
34+
35+
export enum AppStyle {
36+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
37+
38+
Tree,
39+
>Tree : Symbol(AppStyle.Tree, Decl(arrayLiteralInference.ts, 14, 22))
40+
41+
TreeEntity,
42+
>TreeEntity : Symbol(AppStyle.TreeEntity, Decl(arrayLiteralInference.ts, 15, 9))
43+
44+
Standard,
45+
>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
46+
47+
MiniApp,
48+
>MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13))
49+
50+
PivotTable
51+
>PivotTable : Symbol(AppStyle.PivotTable, Decl(arrayLiteralInference.ts, 18, 12))
52+
}
53+
54+
const appTypeStylesWithError: Map<AppType, Array<AppStyle>> = new Map([
55+
>appTypeStylesWithError : Symbol(appTypeStylesWithError, Decl(arrayLiteralInference.ts, 22, 5))
56+
>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
57+
>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0))
58+
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
59+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
60+
>Map : Symbol(Map, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
61+
62+
[AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]],
63+
>AppType.Standard : Symbol(AppType.Standard, Decl(arrayLiteralInference.ts, 5, 34))
64+
>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0))
65+
>Standard : Symbol(AppType.Standard, Decl(arrayLiteralInference.ts, 5, 34))
66+
>AppStyle.Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
67+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
68+
>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
69+
>AppStyle.MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13))
70+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
71+
>MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13))
72+
73+
[AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]],
74+
>AppType.Relationship : Symbol(AppType.Relationship, Decl(arrayLiteralInference.ts, 6, 26))
75+
>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0))
76+
>Relationship : Symbol(AppType.Relationship, Decl(arrayLiteralInference.ts, 6, 26))
77+
>AppStyle.Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
78+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
79+
>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
80+
>AppStyle.Tree : Symbol(AppStyle.Tree, Decl(arrayLiteralInference.ts, 14, 22))
81+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
82+
>Tree : Symbol(AppStyle.Tree, Decl(arrayLiteralInference.ts, 14, 22))
83+
>AppStyle.TreeEntity : Symbol(AppStyle.TreeEntity, Decl(arrayLiteralInference.ts, 15, 9))
84+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
85+
>TreeEntity : Symbol(AppStyle.TreeEntity, Decl(arrayLiteralInference.ts, 15, 9))
86+
87+
[AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]
88+
>AppType.AdvancedList : Symbol(AppType.AdvancedList, Decl(arrayLiteralInference.ts, 4, 44))
89+
>AppType : Symbol(AppType, Decl(arrayLiteralInference.ts, 0, 0))
90+
>AdvancedList : Symbol(AppType.AdvancedList, Decl(arrayLiteralInference.ts, 4, 44))
91+
>AppStyle.Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
92+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
93+
>Standard : Symbol(AppStyle.Standard, Decl(arrayLiteralInference.ts, 16, 15))
94+
>AppStyle.MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13))
95+
>AppStyle : Symbol(AppStyle, Decl(arrayLiteralInference.ts, 12, 1))
96+
>MiniApp : Symbol(AppStyle.MiniApp, Decl(arrayLiteralInference.ts, 17, 13))
97+
98+
]);
99+
100+
// Repro from #31204
101+
102+
declare function foo<T>(...args: T[]): T[];
103+
>foo : Symbol(foo, Decl(arrayLiteralInference.ts, 26, 3))
104+
>T : Symbol(T, Decl(arrayLiteralInference.ts, 30, 21))
105+
>args : Symbol(args, Decl(arrayLiteralInference.ts, 30, 24))
106+
>T : Symbol(T, Decl(arrayLiteralInference.ts, 30, 21))
107+
>T : Symbol(T, Decl(arrayLiteralInference.ts, 30, 21))
108+
109+
let b1: { x: boolean }[] = foo({ x: true }, { x: false });
110+
>b1 : Symbol(b1, Decl(arrayLiteralInference.ts, 31, 3))
111+
>x : Symbol(x, Decl(arrayLiteralInference.ts, 31, 9))
112+
>foo : Symbol(foo, Decl(arrayLiteralInference.ts, 26, 3))
113+
>x : Symbol(x, Decl(arrayLiteralInference.ts, 31, 32))
114+
>x : Symbol(x, Decl(arrayLiteralInference.ts, 31, 45))
115+
116+
let b2: boolean[][] = foo([true], [false]);
117+
>b2 : Symbol(b2, Decl(arrayLiteralInference.ts, 32, 3))
118+
>foo : Symbol(foo, Decl(arrayLiteralInference.ts, 26, 3))
119+
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
=== tests/cases/conformance/expressions/arrayLiterals/arrayLiteralInference.ts ===
2+
// Repro from #31204
3+
4+
export enum AppType {
5+
>AppType : AppType
6+
7+
HeaderDetail = 'HeaderDetail',
8+
>HeaderDetail : AppType.HeaderDetail
9+
>'HeaderDetail' : "HeaderDetail"
10+
11+
HeaderMultiDetail = 'HeaderMultiDetail',
12+
>HeaderMultiDetail : AppType.HeaderMultiDetail
13+
>'HeaderMultiDetail' : "HeaderMultiDetail"
14+
15+
AdvancedList = 'AdvancedList',
16+
>AdvancedList : AppType.AdvancedList
17+
>'AdvancedList' : "AdvancedList"
18+
19+
Standard = 'Standard',
20+
>Standard : AppType.Standard
21+
>'Standard' : "Standard"
22+
23+
Relationship = 'Relationship',
24+
>Relationship : AppType.Relationship
25+
>'Relationship' : "Relationship"
26+
27+
Report = 'Report',
28+
>Report : AppType.Report
29+
>'Report' : "Report"
30+
31+
Composite = 'Composite',
32+
>Composite : AppType.Composite
33+
>'Composite' : "Composite"
34+
35+
ListOnly = 'ListOnly',
36+
>ListOnly : AppType.ListOnly
37+
>'ListOnly' : "ListOnly"
38+
39+
ModuleSettings = 'ModuleSettings'
40+
>ModuleSettings : AppType.ModuleSettings
41+
>'ModuleSettings' : "ModuleSettings"
42+
}
43+
44+
export enum AppStyle {
45+
>AppStyle : AppStyle
46+
47+
Tree,
48+
>Tree : AppStyle.Tree
49+
50+
TreeEntity,
51+
>TreeEntity : AppStyle.TreeEntity
52+
53+
Standard,
54+
>Standard : AppStyle.Standard
55+
56+
MiniApp,
57+
>MiniApp : AppStyle.MiniApp
58+
59+
PivotTable
60+
>PivotTable : AppStyle.PivotTable
61+
}
62+
63+
const appTypeStylesWithError: Map<AppType, Array<AppStyle>> = new Map([
64+
>appTypeStylesWithError : Map<AppType, AppStyle[]>
65+
>new Map([ [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]]) : Map<AppType.AdvancedList | AppType.Standard | AppType.Relationship, (AppStyle.Standard | AppStyle.MiniApp)[] | (AppStyle.Tree | AppStyle.TreeEntity | AppStyle.Standard)[]>
66+
>Map : MapConstructor
67+
>[ [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]] : ([AppType.Standard, (AppStyle.Standard | AppStyle.MiniApp)[]] | [AppType.Relationship, (AppStyle.Tree | AppStyle.TreeEntity | AppStyle.Standard)[]] | [AppType.AdvancedList, (AppStyle.Standard | AppStyle.MiniApp)[]])[]
68+
69+
[AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]],
70+
>[AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]] : [AppType.Standard, (AppStyle.Standard | AppStyle.MiniApp)[]]
71+
>AppType.Standard : AppType.Standard
72+
>AppType : typeof AppType
73+
>Standard : AppType.Standard
74+
>[AppStyle.Standard, AppStyle.MiniApp] : (AppStyle.Standard | AppStyle.MiniApp)[]
75+
>AppStyle.Standard : AppStyle.Standard
76+
>AppStyle : typeof AppStyle
77+
>Standard : AppStyle.Standard
78+
>AppStyle.MiniApp : AppStyle.MiniApp
79+
>AppStyle : typeof AppStyle
80+
>MiniApp : AppStyle.MiniApp
81+
82+
[AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]],
83+
>[AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]] : [AppType.Relationship, (AppStyle.Tree | AppStyle.TreeEntity | AppStyle.Standard)[]]
84+
>AppType.Relationship : AppType.Relationship
85+
>AppType : typeof AppType
86+
>Relationship : AppType.Relationship
87+
>[AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity] : (AppStyle.Tree | AppStyle.TreeEntity | AppStyle.Standard)[]
88+
>AppStyle.Standard : AppStyle.Standard
89+
>AppStyle : typeof AppStyle
90+
>Standard : AppStyle.Standard
91+
>AppStyle.Tree : AppStyle.Tree
92+
>AppStyle : typeof AppStyle
93+
>Tree : AppStyle.Tree
94+
>AppStyle.TreeEntity : AppStyle.TreeEntity
95+
>AppStyle : typeof AppStyle
96+
>TreeEntity : AppStyle.TreeEntity
97+
98+
[AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]
99+
>[AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]] : [AppType.AdvancedList, (AppStyle.Standard | AppStyle.MiniApp)[]]
100+
>AppType.AdvancedList : AppType.AdvancedList
101+
>AppType : typeof AppType
102+
>AdvancedList : AppType.AdvancedList
103+
>[AppStyle.Standard, AppStyle.MiniApp] : (AppStyle.Standard | AppStyle.MiniApp)[]
104+
>AppStyle.Standard : AppStyle.Standard
105+
>AppStyle : typeof AppStyle
106+
>Standard : AppStyle.Standard
107+
>AppStyle.MiniApp : AppStyle.MiniApp
108+
>AppStyle : typeof AppStyle
109+
>MiniApp : AppStyle.MiniApp
110+
111+
]);
112+
113+
// Repro from #31204
114+
115+
declare function foo<T>(...args: T[]): T[];
116+
>foo : <T>(...args: T[]) => T[]
117+
>args : T[]
118+
119+
let b1: { x: boolean }[] = foo({ x: true }, { x: false });
120+
>b1 : { x: boolean; }[]
121+
>x : boolean
122+
>foo({ x: true }, { x: false }) : ({ x: true; } | { x: false; })[]
123+
>foo : <T>(...args: T[]) => T[]
124+
>{ x: true } : { x: true; }
125+
>x : true
126+
>true : true
127+
>{ x: false } : { x: false; }
128+
>x : false
129+
>false : false
130+
131+
let b2: boolean[][] = foo([true], [false]);
132+
>b2 : boolean[][]
133+
>foo([true], [false]) : (true[] | false[])[]
134+
>foo : <T>(...args: T[]) => T[]
135+
>[true] : true[]
136+
>true : true
137+
>[false] : false[]
138+
>false : false
139+

0 commit comments

Comments
 (0)