|
| 1 | +=== tests/cases/compiler/overrideBaseIntersectionMethod.ts === |
| 2 | + |
| 3 | +// Repro from #14615 |
| 4 | + |
| 5 | +type Constructor<T> = new (...args: any[]) => T; |
| 6 | +>Constructor : Symbol(Constructor, Decl(overrideBaseIntersectionMethod.ts, 0, 0)) |
| 7 | +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 3, 17)) |
| 8 | +>args : Symbol(args, Decl(overrideBaseIntersectionMethod.ts, 3, 27)) |
| 9 | +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 3, 17)) |
| 10 | + |
| 11 | +const WithLocation = <T extends Constructor<Point>>(Base: T) => class extends Base { |
| 12 | +>WithLocation : Symbol(WithLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 5)) |
| 13 | +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 5, 22)) |
| 14 | +>Constructor : Symbol(Constructor, Decl(overrideBaseIntersectionMethod.ts, 0, 0)) |
| 15 | +>Point : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) |
| 16 | +>Base : Symbol(Base, Decl(overrideBaseIntersectionMethod.ts, 5, 52)) |
| 17 | +>T : Symbol(T, Decl(overrideBaseIntersectionMethod.ts, 5, 22)) |
| 18 | +>Base : Symbol(Base, Decl(overrideBaseIntersectionMethod.ts, 5, 52)) |
| 19 | + |
| 20 | + getLocation(): [number, number] { |
| 21 | +>getLocation : Symbol((Anonymous class).getLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 84)) |
| 22 | + |
| 23 | + const [x,y] = super.getLocation(); |
| 24 | +>x : Symbol(x, Decl(overrideBaseIntersectionMethod.ts, 7, 11)) |
| 25 | +>y : Symbol(y, Decl(overrideBaseIntersectionMethod.ts, 7, 13)) |
| 26 | +>super.getLocation : Symbol(Point.getLocation, Decl(overrideBaseIntersectionMethod.ts, 13, 53)) |
| 27 | +>super : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) |
| 28 | +>getLocation : Symbol(Point.getLocation, Decl(overrideBaseIntersectionMethod.ts, 13, 53)) |
| 29 | + |
| 30 | + return [this.x | x, this.y | y]; |
| 31 | +>this.x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) |
| 32 | +>this : Symbol((Anonymous class), Decl(overrideBaseIntersectionMethod.ts, 5, 63)) |
| 33 | +>x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) |
| 34 | +>x : Symbol(x, Decl(overrideBaseIntersectionMethod.ts, 7, 11)) |
| 35 | +>this.y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) |
| 36 | +>this : Symbol((Anonymous class), Decl(overrideBaseIntersectionMethod.ts, 5, 63)) |
| 37 | +>y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) |
| 38 | +>y : Symbol(y, Decl(overrideBaseIntersectionMethod.ts, 7, 13)) |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +class Point { |
| 43 | +>Point : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) |
| 44 | + |
| 45 | + constructor(public x: number, public y: number) { } |
| 46 | +>x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) |
| 47 | +>y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) |
| 48 | + |
| 49 | + getLocation(): [number, number] { |
| 50 | +>getLocation : Symbol(Point.getLocation, Decl(overrideBaseIntersectionMethod.ts, 13, 53)) |
| 51 | + |
| 52 | + return [0,0]; |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +class Foo extends WithLocation(Point) { |
| 57 | +>Foo : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) |
| 58 | +>WithLocation : Symbol(WithLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 5)) |
| 59 | +>Point : Symbol(Point, Decl(overrideBaseIntersectionMethod.ts, 10, 1)) |
| 60 | + |
| 61 | + calculate() { |
| 62 | +>calculate : Symbol(Foo.calculate, Decl(overrideBaseIntersectionMethod.ts, 19, 39)) |
| 63 | + |
| 64 | + return this.x + this.y; |
| 65 | +>this.x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) |
| 66 | +>this : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) |
| 67 | +>x : Symbol(Point.x, Decl(overrideBaseIntersectionMethod.ts, 13, 14)) |
| 68 | +>this.y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) |
| 69 | +>this : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) |
| 70 | +>y : Symbol(Point.y, Decl(overrideBaseIntersectionMethod.ts, 13, 31)) |
| 71 | + } |
| 72 | + getLocation() { |
| 73 | +>getLocation : Symbol(Foo.getLocation, Decl(overrideBaseIntersectionMethod.ts, 22, 3)) |
| 74 | + |
| 75 | + return super.getLocation() |
| 76 | +>super.getLocation : Symbol(getLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 84), Decl(overrideBaseIntersectionMethod.ts, 13, 53)) |
| 77 | +>getLocation : Symbol(getLocation, Decl(overrideBaseIntersectionMethod.ts, 5, 84), Decl(overrideBaseIntersectionMethod.ts, 13, 53)) |
| 78 | + } |
| 79 | + whereAmI() { |
| 80 | +>whereAmI : Symbol(Foo.whereAmI, Decl(overrideBaseIntersectionMethod.ts, 25, 3)) |
| 81 | + |
| 82 | + return this.getLocation(); |
| 83 | +>this.getLocation : Symbol(Foo.getLocation, Decl(overrideBaseIntersectionMethod.ts, 22, 3)) |
| 84 | +>this : Symbol(Foo, Decl(overrideBaseIntersectionMethod.ts, 17, 1)) |
| 85 | +>getLocation : Symbol(Foo.getLocation, Decl(overrideBaseIntersectionMethod.ts, 22, 3)) |
| 86 | + } |
| 87 | +} |
| 88 | + |
0 commit comments