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