TypeScript/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints.symbols
2015-04-15 16:44:20 -07:00

103 lines
5.1 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints.ts ===
// Generic call with constraints infering type parameter from object member properties
// No errors expected
class C {
>C : Symbol(C, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 0, 0))
x: string;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 3, 9))
}
class D {
>D : Symbol(D, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 5, 1))
x: string;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 7, 9))
y: string;
>y : Symbol(y, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 8, 14))
}
class X<T> {
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 8))
x: T;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 12))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 12, 8))
}
function foo<T extends { x: string }>(t: X<T>, t2: X<T>) {
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 14, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 13))
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 24))
>t : Symbol(t, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 38))
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 13))
>t2 : Symbol(t2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 46))
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 13))
var x: T;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 17, 7))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 16, 13))
return x;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 17, 7))
}
var c1 = new X<C>();
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>C : Symbol(C, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 0, 0))
var d1 = new X<D>();
>d1 : Symbol(d1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 22, 3))
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>D : Symbol(D, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 5, 1))
var r = foo(c1, d1);
>r : Symbol(r, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 23, 3), Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 31, 3))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 14, 1))
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))
>d1 : Symbol(d1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 22, 3))
var r2 = foo(c1, c1);
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 24, 3), Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 32, 3))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 14, 1))
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))
function foo2<T extends C>(t: X<T>, t2: X<T>) {
>foo2 : Symbol(foo2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 24, 21))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 26, 14))
>C : Symbol(C, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 0, 0))
>t : Symbol(t, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 26, 27))
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 26, 14))
>t2 : Symbol(t2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 26, 35))
>X : Symbol(X, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 10, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 26, 14))
var x: T;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 27, 7))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 26, 14))
return x;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 27, 7))
}
var r = foo2(c1, d1);
>r : Symbol(r, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 23, 3), Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 31, 3))
>foo2 : Symbol(foo2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 24, 21))
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))
>d1 : Symbol(d1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 22, 3))
var r2 = foo2(c1, c1);
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 24, 3), Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 32, 3))
>foo2 : Symbol(foo2, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 24, 21))
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))
>c1 : Symbol(c1, Decl(genericCallWithObjectTypeArgsAndConstraints.ts, 21, 3))