Skip to content

Commit ed97443

Browse files
committed
Accept new baselines
1 parent 09bc750 commit ed97443

File tree

3 files changed

+89
-21
lines changed

3 files changed

+89
-21
lines changed

tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//// [badInferenceLowerPriorityThanGoodInference.ts]
2+
// Repro from #13118
3+
24
interface Foo<A> {
35
a: A;
46
b: (x: A) => void;
@@ -11,11 +13,24 @@ const result = canYouInferThis(() => ({
1113
b: x => { }
1214
}))
1315

14-
result.BLAH;
16+
result.BLAH;
17+
18+
// Repro from #26629
19+
20+
function goofus <ARGS extends any[]> (f: (...args: ARGS) => any ) {}
21+
22+
goofus((a: string) => ({ dog() { return a; } }));
23+
goofus((a: string) => ({ dog: function() { return a; } }));
24+
1525

1626
//// [badInferenceLowerPriorityThanGoodInference.js]
27+
// Repro from #13118
1728
var result = canYouInferThis(function () { return ({
1829
a: { BLAH: 33 },
1930
b: function (x) { }
2031
}); });
2132
result.BLAH;
33+
// Repro from #26629
34+
function goofus(f) { }
35+
goofus(function (a) { return ({ dog: function () { return a; } }); });
36+
goofus(function (a) { return ({ dog: function () { return a; } }); });
Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,65 @@
11
=== tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts ===
2+
// Repro from #13118
3+
24
interface Foo<A> {
35
>Foo : Symbol(Foo, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 0))
4-
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 14))
6+
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 2, 14))
57

68
a: A;
7-
>a : Symbol(Foo.a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 18))
8-
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 14))
9+
>a : Symbol(Foo.a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 2, 18))
10+
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 2, 14))
911

1012
b: (x: A) => void;
11-
>b : Symbol(Foo.b, Decl(badInferenceLowerPriorityThanGoodInference.ts, 1, 9))
12-
>x : Symbol(x, Decl(badInferenceLowerPriorityThanGoodInference.ts, 2, 8))
13-
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 14))
13+
>b : Symbol(Foo.b, Decl(badInferenceLowerPriorityThanGoodInference.ts, 3, 9))
14+
>x : Symbol(x, Decl(badInferenceLowerPriorityThanGoodInference.ts, 4, 8))
15+
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 2, 14))
1416
}
1517

1618
declare function canYouInferThis<A>(fn: () => Foo<A>): A;
17-
>canYouInferThis : Symbol(canYouInferThis, Decl(badInferenceLowerPriorityThanGoodInference.ts, 3, 1))
18-
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 5, 33))
19-
>fn : Symbol(fn, Decl(badInferenceLowerPriorityThanGoodInference.ts, 5, 36))
19+
>canYouInferThis : Symbol(canYouInferThis, Decl(badInferenceLowerPriorityThanGoodInference.ts, 5, 1))
20+
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 33))
21+
>fn : Symbol(fn, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 36))
2022
>Foo : Symbol(Foo, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 0))
21-
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 5, 33))
22-
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 5, 33))
23+
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 33))
24+
>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 33))
2325

2426
const result = canYouInferThis(() => ({
25-
>result : Symbol(result, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 5))
26-
>canYouInferThis : Symbol(canYouInferThis, Decl(badInferenceLowerPriorityThanGoodInference.ts, 3, 1))
27+
>result : Symbol(result, Decl(badInferenceLowerPriorityThanGoodInference.ts, 9, 5))
28+
>canYouInferThis : Symbol(canYouInferThis, Decl(badInferenceLowerPriorityThanGoodInference.ts, 5, 1))
2729

2830
a: { BLAH: 33 },
29-
>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 39))
30-
>BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 8, 8))
31+
>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 9, 39))
32+
>BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 10, 8))
3133

3234
b: x => { }
33-
>b : Symbol(b, Decl(badInferenceLowerPriorityThanGoodInference.ts, 8, 20))
34-
>x : Symbol(x, Decl(badInferenceLowerPriorityThanGoodInference.ts, 9, 6))
35+
>b : Symbol(b, Decl(badInferenceLowerPriorityThanGoodInference.ts, 10, 20))
36+
>x : Symbol(x, Decl(badInferenceLowerPriorityThanGoodInference.ts, 11, 6))
3537

3638
}))
3739

3840
result.BLAH;
39-
>result.BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 8, 8))
40-
>result : Symbol(result, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 5))
41-
>BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 8, 8))
41+
>result.BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 10, 8))
42+
>result : Symbol(result, Decl(badInferenceLowerPriorityThanGoodInference.ts, 9, 5))
43+
>BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 10, 8))
44+
45+
// Repro from #26629
46+
47+
function goofus <ARGS extends any[]> (f: (...args: ARGS) => any ) {}
48+
>goofus : Symbol(goofus, Decl(badInferenceLowerPriorityThanGoodInference.ts, 14, 12))
49+
>ARGS : Symbol(ARGS, Decl(badInferenceLowerPriorityThanGoodInference.ts, 18, 17))
50+
>f : Symbol(f, Decl(badInferenceLowerPriorityThanGoodInference.ts, 18, 38))
51+
>args : Symbol(args, Decl(badInferenceLowerPriorityThanGoodInference.ts, 18, 42))
52+
>ARGS : Symbol(ARGS, Decl(badInferenceLowerPriorityThanGoodInference.ts, 18, 17))
53+
54+
goofus((a: string) => ({ dog() { return a; } }));
55+
>goofus : Symbol(goofus, Decl(badInferenceLowerPriorityThanGoodInference.ts, 14, 12))
56+
>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 20, 8))
57+
>dog : Symbol(dog, Decl(badInferenceLowerPriorityThanGoodInference.ts, 20, 24))
58+
>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 20, 8))
59+
60+
goofus((a: string) => ({ dog: function() { return a; } }));
61+
>goofus : Symbol(goofus, Decl(badInferenceLowerPriorityThanGoodInference.ts, 14, 12))
62+
>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 21, 8))
63+
>dog : Symbol(dog, Decl(badInferenceLowerPriorityThanGoodInference.ts, 21, 24))
64+
>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 21, 8))
4265

tests/baselines/reference/badInferenceLowerPriorityThanGoodInference.types

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
=== tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts ===
2+
// Repro from #13118
3+
24
interface Foo<A> {
35
a: A;
46
>a : A
@@ -38,3 +40,31 @@ result.BLAH;
3840
>result : { BLAH: number; }
3941
>BLAH : number
4042

43+
// Repro from #26629
44+
45+
function goofus <ARGS extends any[]> (f: (...args: ARGS) => any ) {}
46+
>goofus : <ARGS extends any[]>(f: (...args: ARGS) => any) => void
47+
>f : (...args: ARGS) => any
48+
>args : ARGS
49+
50+
goofus((a: string) => ({ dog() { return a; } }));
51+
>goofus((a: string) => ({ dog() { return a; } })) : void
52+
>goofus : <ARGS extends any[]>(f: (...args: ARGS) => any) => void
53+
>(a: string) => ({ dog() { return a; } }) : (a: string) => { dog(): string; }
54+
>a : string
55+
>({ dog() { return a; } }) : { dog(): string; }
56+
>{ dog() { return a; } } : { dog(): string; }
57+
>dog : () => string
58+
>a : string
59+
60+
goofus((a: string) => ({ dog: function() { return a; } }));
61+
>goofus((a: string) => ({ dog: function() { return a; } })) : void
62+
>goofus : <ARGS extends any[]>(f: (...args: ARGS) => any) => void
63+
>(a: string) => ({ dog: function() { return a; } }) : (a: string) => { dog: () => string; }
64+
>a : string
65+
>({ dog: function() { return a; } }) : { dog: () => string; }
66+
>{ dog: function() { return a; } } : { dog: () => string; }
67+
>dog : () => string
68+
>function() { return a; } : () => string
69+
>a : string
70+

0 commit comments

Comments
 (0)