115 lines
5.4 KiB
Plaintext
115 lines
5.4 KiB
Plaintext
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs2.ts ===
|
|
class Base {
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
|
|
x: string;
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 0, 12))
|
|
}
|
|
class Derived extends Base {
|
|
>Derived : Symbol(Derived, Decl(genericCallWithObjectTypeArgs2.ts, 2, 1))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
|
|
y: string;
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 3, 28))
|
|
}
|
|
class Derived2 extends Base {
|
|
>Derived2 : Symbol(Derived2, Decl(genericCallWithObjectTypeArgs2.ts, 5, 1))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
|
|
z: string;
|
|
>z : Symbol(z, Decl(genericCallWithObjectTypeArgs2.ts, 6, 29))
|
|
}
|
|
|
|
// returns {}[]
|
|
function f<T extends Base, U extends Base>(a: { x: T; y: U }) {
|
|
>f : Symbol(f, Decl(genericCallWithObjectTypeArgs2.ts, 8, 1))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 11, 11))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
>U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 11, 26))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
>a : Symbol(a, Decl(genericCallWithObjectTypeArgs2.ts, 11, 43))
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 11, 47))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 11, 11))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 11, 53))
|
|
>U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 11, 26))
|
|
|
|
return [a.x, a.y];
|
|
>a.x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 11, 47))
|
|
>a : Symbol(a, Decl(genericCallWithObjectTypeArgs2.ts, 11, 43))
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 11, 47))
|
|
>a.y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 11, 53))
|
|
>a : Symbol(a, Decl(genericCallWithObjectTypeArgs2.ts, 11, 43))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 11, 53))
|
|
}
|
|
|
|
var r = f({ x: new Derived(), y: new Derived2() }); // {}[]
|
|
>r : Symbol(r, Decl(genericCallWithObjectTypeArgs2.ts, 15, 3))
|
|
>f : Symbol(f, Decl(genericCallWithObjectTypeArgs2.ts, 8, 1))
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 15, 11))
|
|
>Derived : Symbol(Derived, Decl(genericCallWithObjectTypeArgs2.ts, 2, 1))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 15, 29))
|
|
>Derived2 : Symbol(Derived2, Decl(genericCallWithObjectTypeArgs2.ts, 5, 1))
|
|
|
|
var r2 = f({ x: new Base(), y: new Derived2() }); // {}[]
|
|
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgs2.ts, 16, 3))
|
|
>f : Symbol(f, Decl(genericCallWithObjectTypeArgs2.ts, 8, 1))
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 16, 12))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 16, 27))
|
|
>Derived2 : Symbol(Derived2, Decl(genericCallWithObjectTypeArgs2.ts, 5, 1))
|
|
|
|
|
|
function f2<T extends Base, U extends Base>(a: { x: T; y: U }) {
|
|
>f2 : Symbol(f2, Decl(genericCallWithObjectTypeArgs2.ts, 16, 49))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 19, 12))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
>U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 19, 27))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
>a : Symbol(a, Decl(genericCallWithObjectTypeArgs2.ts, 19, 44))
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 19, 48))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 19, 12))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 19, 54))
|
|
>U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 19, 27))
|
|
|
|
return (x: T) => a.y;
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 20, 12))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 19, 12))
|
|
>a.y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 19, 54))
|
|
>a : Symbol(a, Decl(genericCallWithObjectTypeArgs2.ts, 19, 44))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 19, 54))
|
|
}
|
|
|
|
var r3 = f2({ x: new Derived(), y: new Derived2() }); // Derived => Derived2
|
|
>r3 : Symbol(r3, Decl(genericCallWithObjectTypeArgs2.ts, 23, 3))
|
|
>f2 : Symbol(f2, Decl(genericCallWithObjectTypeArgs2.ts, 16, 49))
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 23, 13))
|
|
>Derived : Symbol(Derived, Decl(genericCallWithObjectTypeArgs2.ts, 2, 1))
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 23, 31))
|
|
>Derived2 : Symbol(Derived2, Decl(genericCallWithObjectTypeArgs2.ts, 5, 1))
|
|
|
|
interface I<T, U> {
|
|
>I : Symbol(I, Decl(genericCallWithObjectTypeArgs2.ts, 23, 53))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 25, 12))
|
|
>U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 25, 14))
|
|
|
|
x: T;
|
|
>x : Symbol(x, Decl(genericCallWithObjectTypeArgs2.ts, 25, 19))
|
|
>T : Symbol(T, Decl(genericCallWithObjectTypeArgs2.ts, 25, 12))
|
|
|
|
y: U;
|
|
>y : Symbol(y, Decl(genericCallWithObjectTypeArgs2.ts, 26, 9))
|
|
>U : Symbol(U, Decl(genericCallWithObjectTypeArgs2.ts, 25, 14))
|
|
}
|
|
|
|
var i: I<Base, Derived>;
|
|
>i : Symbol(i, Decl(genericCallWithObjectTypeArgs2.ts, 30, 3))
|
|
>I : Symbol(I, Decl(genericCallWithObjectTypeArgs2.ts, 23, 53))
|
|
>Base : Symbol(Base, Decl(genericCallWithObjectTypeArgs2.ts, 0, 0))
|
|
>Derived : Symbol(Derived, Decl(genericCallWithObjectTypeArgs2.ts, 2, 1))
|
|
|
|
var r4 = f2(i); // Base => Derived
|
|
>r4 : Symbol(r4, Decl(genericCallWithObjectTypeArgs2.ts, 31, 3))
|
|
>f2 : Symbol(f2, Decl(genericCallWithObjectTypeArgs2.ts, 16, 49))
|
|
>i : Symbol(i, Decl(genericCallWithObjectTypeArgs2.ts, 30, 3))
|
|
|