|
| 1 | +=== tests/cases/compiler/badInferenceLowerPriorityThanGoodInference.ts === |
| 2 | +interface Foo<A> { |
| 3 | +>Foo : Symbol(Foo, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 0)) |
| 4 | +>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 14)) |
| 5 | + |
| 6 | + a: A; |
| 7 | +>a : Symbol(Foo.a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 18)) |
| 8 | +>A : Symbol(A, Decl(badInferenceLowerPriorityThanGoodInference.ts, 0, 14)) |
| 9 | + |
| 10 | + 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)) |
| 14 | +} |
| 15 | + |
| 16 | +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)) |
| 20 | +>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 | + |
| 24 | +const result = canYouInferThis(() => ({ |
| 25 | +>result : Symbol(result, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 5)) |
| 26 | +>canYouInferThis : Symbol(canYouInferThis, Decl(badInferenceLowerPriorityThanGoodInference.ts, 3, 1)) |
| 27 | + |
| 28 | + a: { BLAH: 33 }, |
| 29 | +>a : Symbol(a, Decl(badInferenceLowerPriorityThanGoodInference.ts, 7, 39)) |
| 30 | +>BLAH : Symbol(BLAH, Decl(badInferenceLowerPriorityThanGoodInference.ts, 8, 8)) |
| 31 | + |
| 32 | + b: x => { } |
| 33 | +>b : Symbol(b, Decl(badInferenceLowerPriorityThanGoodInference.ts, 8, 20)) |
| 34 | +>x : Symbol(x, Decl(badInferenceLowerPriorityThanGoodInference.ts, 9, 6)) |
| 35 | + |
| 36 | +})) |
| 37 | + |
| 38 | +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)) |
| 42 | + |
0 commit comments