|
| 1 | +//// [tests/cases/compiler/mergedInstantiationAssignment.ts] //// |
| 2 | + |
| 3 | +=== mergedInstantiationAssignment.ts === |
| 4 | +// https://github.com/microsoft/TypeScript/issues/56320 |
| 5 | + |
| 6 | +class GenericObject<T = number> { |
| 7 | +>GenericObject : Symbol(GenericObject, Decl(mergedInstantiationAssignment.ts, 0, 0)) |
| 8 | +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 2, 20)) |
| 9 | + |
| 10 | + set x(x: T) {} |
| 11 | +>x : Symbol(GenericObject.x, Decl(mergedInstantiationAssignment.ts, 2, 33)) |
| 12 | +>x : Symbol(x, Decl(mergedInstantiationAssignment.ts, 3, 8)) |
| 13 | +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 2, 20)) |
| 14 | +} |
| 15 | + |
| 16 | +const v1 = new GenericObject() as GenericObject & |
| 17 | +>v1 : Symbol(v1, Decl(mergedInstantiationAssignment.ts, 6, 5)) |
| 18 | +>GenericObject : Symbol(GenericObject, Decl(mergedInstantiationAssignment.ts, 0, 0)) |
| 19 | +>GenericObject : Symbol(GenericObject, Decl(mergedInstantiationAssignment.ts, 0, 0)) |
| 20 | + |
| 21 | + ({ a?: string } | { b?: number }); |
| 22 | +>a : Symbol(a, Decl(mergedInstantiationAssignment.ts, 7, 4)) |
| 23 | +>b : Symbol(b, Decl(mergedInstantiationAssignment.ts, 7, 21)) |
| 24 | + |
| 25 | +v1.x = 432; |
| 26 | +>v1.x : Symbol(GenericObject.x, Decl(mergedInstantiationAssignment.ts, 2, 33)) |
| 27 | +>v1 : Symbol(v1, Decl(mergedInstantiationAssignment.ts, 6, 5)) |
| 28 | +>x : Symbol(GenericObject.x, Decl(mergedInstantiationAssignment.ts, 2, 33)) |
| 29 | + |
| 30 | +class GenericObjectWithoutSetter<T = number> { |
| 31 | +>GenericObjectWithoutSetter : Symbol(GenericObjectWithoutSetter, Decl(mergedInstantiationAssignment.ts, 8, 11)) |
| 32 | +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 10, 33)) |
| 33 | + |
| 34 | + declare x: T; |
| 35 | +>x : Symbol(GenericObjectWithoutSetter.x, Decl(mergedInstantiationAssignment.ts, 10, 46)) |
| 36 | +>T : Symbol(T, Decl(mergedInstantiationAssignment.ts, 10, 33)) |
| 37 | +} |
| 38 | + |
| 39 | +const v2 = new GenericObjectWithoutSetter() as GenericObjectWithoutSetter & |
| 40 | +>v2 : Symbol(v2, Decl(mergedInstantiationAssignment.ts, 14, 5)) |
| 41 | +>GenericObjectWithoutSetter : Symbol(GenericObjectWithoutSetter, Decl(mergedInstantiationAssignment.ts, 8, 11)) |
| 42 | +>GenericObjectWithoutSetter : Symbol(GenericObjectWithoutSetter, Decl(mergedInstantiationAssignment.ts, 8, 11)) |
| 43 | + |
| 44 | + ({ a?: string } | { b?: number }); |
| 45 | +>a : Symbol(a, Decl(mergedInstantiationAssignment.ts, 15, 4)) |
| 46 | +>b : Symbol(b, Decl(mergedInstantiationAssignment.ts, 15, 21)) |
| 47 | + |
| 48 | +v2.x = 42; |
| 49 | +>v2.x : Symbol(GenericObjectWithoutSetter.x, Decl(mergedInstantiationAssignment.ts, 10, 46)) |
| 50 | +>v2 : Symbol(v2, Decl(mergedInstantiationAssignment.ts, 14, 5)) |
| 51 | +>x : Symbol(GenericObjectWithoutSetter.x, Decl(mergedInstantiationAssignment.ts, 10, 46)) |
| 52 | + |
| 53 | +class NormalObject { |
| 54 | +>NormalObject : Symbol(NormalObject, Decl(mergedInstantiationAssignment.ts, 16, 10)) |
| 55 | + |
| 56 | + set x(x: number) {} |
| 57 | +>x : Symbol(NormalObject.x, Decl(mergedInstantiationAssignment.ts, 18, 20)) |
| 58 | +>x : Symbol(x, Decl(mergedInstantiationAssignment.ts, 19, 8)) |
| 59 | +} |
| 60 | + |
| 61 | +const v3 = new NormalObject() as NormalObject & |
| 62 | +>v3 : Symbol(v3, Decl(mergedInstantiationAssignment.ts, 22, 5)) |
| 63 | +>NormalObject : Symbol(NormalObject, Decl(mergedInstantiationAssignment.ts, 16, 10)) |
| 64 | +>NormalObject : Symbol(NormalObject, Decl(mergedInstantiationAssignment.ts, 16, 10)) |
| 65 | + |
| 66 | + ({ a?: string } | { b?: number }); |
| 67 | +>a : Symbol(a, Decl(mergedInstantiationAssignment.ts, 23, 4)) |
| 68 | +>b : Symbol(b, Decl(mergedInstantiationAssignment.ts, 23, 21)) |
| 69 | + |
| 70 | +v3.x = 42; |
| 71 | +>v3.x : Symbol(NormalObject.x, Decl(mergedInstantiationAssignment.ts, 18, 20)) |
| 72 | +>v3 : Symbol(v3, Decl(mergedInstantiationAssignment.ts, 22, 5)) |
| 73 | +>x : Symbol(NormalObject.x, Decl(mergedInstantiationAssignment.ts, 18, 20)) |
| 74 | + |
0 commit comments