|
| 1 | +=== tests/cases/compiler/unionOfEnumInference.ts === |
| 2 | +// Repro from #42932 |
| 3 | + |
| 4 | +enum Enum { A, B, C } |
| 5 | +>Enum : Symbol(Enum, Decl(unionOfEnumInference.ts, 0, 0)) |
| 6 | +>A : Symbol(Enum.A, Decl(unionOfEnumInference.ts, 2, 11)) |
| 7 | +>B : Symbol(Enum.B, Decl(unionOfEnumInference.ts, 2, 14)) |
| 8 | +>C : Symbol(Enum.C, Decl(unionOfEnumInference.ts, 2, 17)) |
| 9 | + |
| 10 | +interface Interface<T extends Enum> { |
| 11 | +>Interface : Symbol(Interface, Decl(unionOfEnumInference.ts, 2, 21)) |
| 12 | +>T : Symbol(T, Decl(unionOfEnumInference.ts, 4, 20)) |
| 13 | +>Enum : Symbol(Enum, Decl(unionOfEnumInference.ts, 0, 0)) |
| 14 | + |
| 15 | + type: T; |
| 16 | +>type : Symbol(Interface.type, Decl(unionOfEnumInference.ts, 4, 37)) |
| 17 | +>T : Symbol(T, Decl(unionOfEnumInference.ts, 4, 20)) |
| 18 | +} |
| 19 | + |
| 20 | +function foo<T extends Enum>(x: Interface<T>) { } |
| 21 | +>foo : Symbol(foo, Decl(unionOfEnumInference.ts, 6, 1)) |
| 22 | +>T : Symbol(T, Decl(unionOfEnumInference.ts, 8, 13)) |
| 23 | +>Enum : Symbol(Enum, Decl(unionOfEnumInference.ts, 0, 0)) |
| 24 | +>x : Symbol(x, Decl(unionOfEnumInference.ts, 8, 29)) |
| 25 | +>Interface : Symbol(Interface, Decl(unionOfEnumInference.ts, 2, 21)) |
| 26 | +>T : Symbol(T, Decl(unionOfEnumInference.ts, 8, 13)) |
| 27 | + |
| 28 | +function bar(x: Interface<Enum.A | Enum.B> | Interface<Enum.C>) { |
| 29 | +>bar : Symbol(bar, Decl(unionOfEnumInference.ts, 8, 49)) |
| 30 | +>x : Symbol(x, Decl(unionOfEnumInference.ts, 10, 13)) |
| 31 | +>Interface : Symbol(Interface, Decl(unionOfEnumInference.ts, 2, 21)) |
| 32 | +>Enum : Symbol(Enum, Decl(unionOfEnumInference.ts, 0, 0)) |
| 33 | +>A : Symbol(Enum.A, Decl(unionOfEnumInference.ts, 2, 11)) |
| 34 | +>Enum : Symbol(Enum, Decl(unionOfEnumInference.ts, 0, 0)) |
| 35 | +>B : Symbol(Enum.B, Decl(unionOfEnumInference.ts, 2, 14)) |
| 36 | +>Interface : Symbol(Interface, Decl(unionOfEnumInference.ts, 2, 21)) |
| 37 | +>Enum : Symbol(Enum, Decl(unionOfEnumInference.ts, 0, 0)) |
| 38 | +>C : Symbol(Enum.C, Decl(unionOfEnumInference.ts, 2, 17)) |
| 39 | + |
| 40 | + foo(x); |
| 41 | +>foo : Symbol(foo, Decl(unionOfEnumInference.ts, 6, 1)) |
| 42 | +>x : Symbol(x, Decl(unionOfEnumInference.ts, 10, 13)) |
| 43 | +} |
| 44 | + |
0 commit comments