Skip to content

Commit 71b7429

Browse files
committed
Update baselines
After merging with master, even erroneous tests generate types and symbols baselines
1 parent dd0fa41 commit 71b7429

4 files changed

Lines changed: 366 additions & 0 deletions

tests/baselines/reference/keyofAndIndexedAccessErrors.symbols

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,34 @@ function f20<T, U>(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) {
268268
>k2 : Symbol(k2, Decl(keyofAndIndexedAccessErrors.ts, 69, 37))
269269
>k1 : Symbol(k1, Decl(keyofAndIndexedAccessErrors.ts, 69, 19))
270270
}
271+
272+
// Repro from #17166
273+
function f3<T, K extends keyof T>(obj: T, k: K, value: T[K]): void {
274+
>f3 : Symbol(f3, Decl(keyofAndIndexedAccessErrors.ts, 78, 1))
275+
>T : Symbol(T, Decl(keyofAndIndexedAccessErrors.ts, 81, 12))
276+
>K : Symbol(K, Decl(keyofAndIndexedAccessErrors.ts, 81, 14))
277+
>T : Symbol(T, Decl(keyofAndIndexedAccessErrors.ts, 81, 12))
278+
>obj : Symbol(obj, Decl(keyofAndIndexedAccessErrors.ts, 81, 34))
279+
>T : Symbol(T, Decl(keyofAndIndexedAccessErrors.ts, 81, 12))
280+
>k : Symbol(k, Decl(keyofAndIndexedAccessErrors.ts, 81, 41))
281+
>K : Symbol(K, Decl(keyofAndIndexedAccessErrors.ts, 81, 14))
282+
>value : Symbol(value, Decl(keyofAndIndexedAccessErrors.ts, 81, 47))
283+
>T : Symbol(T, Decl(keyofAndIndexedAccessErrors.ts, 81, 12))
284+
>K : Symbol(K, Decl(keyofAndIndexedAccessErrors.ts, 81, 14))
285+
286+
for (let key in obj) {
287+
>key : Symbol(key, Decl(keyofAndIndexedAccessErrors.ts, 82, 12))
288+
>obj : Symbol(obj, Decl(keyofAndIndexedAccessErrors.ts, 81, 34))
289+
290+
k = key // error, keyof T =/=> K
291+
>k : Symbol(k, Decl(keyofAndIndexedAccessErrors.ts, 81, 41))
292+
>key : Symbol(key, Decl(keyofAndIndexedAccessErrors.ts, 82, 12))
293+
294+
value = obj[key]; // error, T[keyof T] =/=> T[K]
295+
>value : Symbol(value, Decl(keyofAndIndexedAccessErrors.ts, 81, 47))
296+
>obj : Symbol(obj, Decl(keyofAndIndexedAccessErrors.ts, 81, 34))
297+
>key : Symbol(key, Decl(keyofAndIndexedAccessErrors.ts, 82, 12))
298+
}
299+
}
300+
301+

tests/baselines/reference/keyofAndIndexedAccessErrors.types

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,37 @@ function f20<T, U>(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) {
299299
>k2 : keyof (T & U)
300300
>k1 : keyof (T | U)
301301
}
302+
303+
// Repro from #17166
304+
function f3<T, K extends keyof T>(obj: T, k: K, value: T[K]): void {
305+
>f3 : <T, K extends keyof T>(obj: T, k: K, value: T[K]) => void
306+
>T : T
307+
>K : K
308+
>T : T
309+
>obj : T
310+
>T : T
311+
>k : K
312+
>K : K
313+
>value : T[K]
314+
>T : T
315+
>K : K
316+
317+
for (let key in obj) {
318+
>key : keyof T
319+
>obj : T
320+
321+
k = key // error, keyof T =/=> K
322+
>k = key : keyof T
323+
>k : K
324+
>key : keyof T
325+
326+
value = obj[key]; // error, T[keyof T] =/=> T[K]
327+
>value = obj[key] : T[keyof T]
328+
>value : T[K]
329+
>obj[key] : T[keyof T]
330+
>obj : T
331+
>key : keyof T
332+
}
333+
}
334+
335+
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts ===
2+
// test for #15371
3+
function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void {
4+
>f : Symbol(f, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 0, 0))
5+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 11))
6+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 28))
7+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 11))
8+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 48))
9+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 58))
10+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 11))
11+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 28))
12+
13+
tp = s;
14+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 58))
15+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 48))
16+
}
17+
function g<T extends null, P extends keyof T>(s: string, tp: T[P]): void {
18+
>g : Symbol(g, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 3, 1))
19+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 11))
20+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 26))
21+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 11))
22+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 46))
23+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 56))
24+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 11))
25+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 26))
26+
27+
tp = s;
28+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 56))
29+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 46))
30+
}
31+
function h<T extends undefined, P extends keyof T>(s: string, tp: T[P]): void {
32+
>h : Symbol(h, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 6, 1))
33+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 11))
34+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 31))
35+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 11))
36+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 51))
37+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 61))
38+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 11))
39+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 31))
40+
41+
tp = s;
42+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 61))
43+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 51))
44+
}
45+
function i<T extends void, P extends keyof T>(s: string, tp: T[P]): void {
46+
>i : Symbol(i, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 9, 1))
47+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 11))
48+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 26))
49+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 11))
50+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 46))
51+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 56))
52+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 11))
53+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 26))
54+
55+
tp = s;
56+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 56))
57+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 46))
58+
}
59+
function j<T extends never, P extends keyof T>(s: string, tp: T[P]): void {
60+
>j : Symbol(j, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 12, 1))
61+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 11))
62+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 27))
63+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 11))
64+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 47))
65+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 57))
66+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 11))
67+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 27))
68+
69+
tp = s;
70+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 57))
71+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 47))
72+
}
73+
function k<T extends number, P extends keyof T>(s: string, tp: T[P]): void {
74+
>k : Symbol(k, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 15, 1))
75+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 11))
76+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 28))
77+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 11))
78+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 48))
79+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 58))
80+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 11))
81+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 28))
82+
83+
tp = s;
84+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 58))
85+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 48))
86+
}
87+
function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void {
88+
>o : Symbol(o, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 18, 1))
89+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 11))
90+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 28))
91+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 11))
92+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 48))
93+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 58))
94+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 11))
95+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 28))
96+
97+
tp = s;
98+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 58))
99+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 48))
100+
}
101+
function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
102+
>l : Symbol(l, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 21, 1))
103+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 11))
104+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 24))
105+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 11))
106+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 44))
107+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 54))
108+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 11))
109+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 24))
110+
111+
tp = s;
112+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 54))
113+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 44))
114+
}
115+
function m<T extends { a: number }, P extends keyof T>(s: string, tp: T[P]): void {
116+
>m : Symbol(m, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 24, 1))
117+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 11))
118+
>a : Symbol(a, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 22))
119+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 35))
120+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 11))
121+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 55))
122+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 65))
123+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 11))
124+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 35))
125+
126+
tp = s;
127+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 65))
128+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 55))
129+
}
130+
function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void {
131+
>n : Symbol(n, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 27, 1))
132+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 11))
133+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 24))
134+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 45))
135+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 11))
136+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 65))
137+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 75))
138+
>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 11))
139+
>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 45))
140+
141+
tp = s;
142+
>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 75))
143+
>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 65))
144+
}
145+
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts ===
2+
// test for #15371
3+
function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void {
4+
>f : <T extends object, P extends keyof T>(s: string, tp: T[P]) => void
5+
>T : T
6+
>P : P
7+
>T : T
8+
>s : string
9+
>tp : T[P]
10+
>T : T
11+
>P : P
12+
13+
tp = s;
14+
>tp = s : string
15+
>tp : T[P]
16+
>s : string
17+
}
18+
function g<T extends null, P extends keyof T>(s: string, tp: T[P]): void {
19+
>g : <T extends null, P extends keyof T>(s: string, tp: T[P]) => void
20+
>T : T
21+
>null : null
22+
>P : P
23+
>T : T
24+
>s : string
25+
>tp : T[P]
26+
>T : T
27+
>P : P
28+
29+
tp = s;
30+
>tp = s : string
31+
>tp : T[P]
32+
>s : string
33+
}
34+
function h<T extends undefined, P extends keyof T>(s: string, tp: T[P]): void {
35+
>h : <T extends undefined, P extends keyof T>(s: string, tp: T[P]) => void
36+
>T : T
37+
>P : P
38+
>T : T
39+
>s : string
40+
>tp : T[P]
41+
>T : T
42+
>P : P
43+
44+
tp = s;
45+
>tp = s : string
46+
>tp : T[P]
47+
>s : string
48+
}
49+
function i<T extends void, P extends keyof T>(s: string, tp: T[P]): void {
50+
>i : <T extends void, P extends keyof T>(s: string, tp: T[P]) => void
51+
>T : T
52+
>P : P
53+
>T : T
54+
>s : string
55+
>tp : T[P]
56+
>T : T
57+
>P : P
58+
59+
tp = s;
60+
>tp = s : string
61+
>tp : T[P]
62+
>s : string
63+
}
64+
function j<T extends never, P extends keyof T>(s: string, tp: T[P]): void {
65+
>j : <T extends never, P extends keyof T>(s: string, tp: T[P]) => void
66+
>T : T
67+
>P : P
68+
>T : T
69+
>s : string
70+
>tp : T[P]
71+
>T : T
72+
>P : P
73+
74+
tp = s;
75+
>tp = s : string
76+
>tp : T[P]
77+
>s : string
78+
}
79+
function k<T extends number, P extends keyof T>(s: string, tp: T[P]): void {
80+
>k : <T extends number, P extends keyof T>(s: string, tp: T[P]) => void
81+
>T : T
82+
>P : P
83+
>T : T
84+
>s : string
85+
>tp : T[P]
86+
>T : T
87+
>P : P
88+
89+
tp = s;
90+
>tp = s : string
91+
>tp : T[P]
92+
>s : string
93+
}
94+
function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void {
95+
>o : <T extends string, P extends keyof T>(s: string, tp: T[P]) => void
96+
>T : T
97+
>P : P
98+
>T : T
99+
>s : string
100+
>tp : T[P]
101+
>T : T
102+
>P : P
103+
104+
tp = s;
105+
>tp = s : string
106+
>tp : T[P]
107+
>s : string
108+
}
109+
function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
110+
>l : <T extends {}, P extends keyof T>(s: string, tp: T[P]) => void
111+
>T : T
112+
>P : P
113+
>T : T
114+
>s : string
115+
>tp : T[P]
116+
>T : T
117+
>P : P
118+
119+
tp = s;
120+
>tp = s : string
121+
>tp : T[P]
122+
>s : string
123+
}
124+
function m<T extends { a: number }, P extends keyof T>(s: string, tp: T[P]): void {
125+
>m : <T extends { a: number; }, P extends keyof T>(s: string, tp: T[P]) => void
126+
>T : T
127+
>a : number
128+
>P : P
129+
>T : T
130+
>s : string
131+
>tp : T[P]
132+
>T : T
133+
>P : P
134+
135+
tp = s;
136+
>tp = s : string
137+
>tp : T[P]
138+
>s : string
139+
}
140+
function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void {
141+
>n : <T extends { [s: string]: number; }, P extends keyof T>(s: string, tp: T[P]) => void
142+
>T : T
143+
>s : string
144+
>P : P
145+
>T : T
146+
>s : string
147+
>tp : T[P]
148+
>T : T
149+
>P : P
150+
151+
tp = s;
152+
>tp = s : string
153+
>tp : T[P]
154+
>s : string
155+
}
156+

0 commit comments

Comments
 (0)