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

345 lines
7.4 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignatures.ts ===
// object types are identical structurally
class A {
>A : A
foo<T>(x: T): T { return null; }
>foo : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
>null : null
}
class B<T> {
>B : B<T>
>T : T
foo(x: T): T { return null; }
>foo : (x: T) => T
>x : T
>T : T
>T : T
>null : null
}
class C<T> {
>C : C<T>
>T : T
foo(x: T): T { return null; }
>foo : (x: T) => T
>x : T
>T : T
>T : T
>null : null
}
interface I<T> {
>I : I<T>
>T : T
foo(x: T): T;
>foo : (x: T) => T
>x : T
>T : T
>T : T
}
interface I2 {
>I2 : I2
foo<T>(x: T): T;
>foo : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
}
var a: { foo<T>(x: T): T }
>a : { foo<T>(x: T): T; }
>foo : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
var b = { foo<T>(x: T) { return x; } };
>b : { foo<T>(x: T): T; }
>{ foo<T>(x: T) { return x; } } : { foo<T>(x: T): T; }
>foo : <T>(x: T) => T
>T : T
>x : T
>T : T
>x : T
function foo1(x: A);
>foo1 : { (x: A): any; (x: A): any; }
>x : A
>A : A
function foo1(x: A); // error
>foo1 : { (x: A): any; (x: A): any; }
>x : A
>A : A
function foo1(x: any) { }
>foo1 : { (x: A): any; (x: A): any; }
>x : any
function foo1b(x: B<string>);
>foo1b : { (x: B<string>): any; (x: B<string>): any; }
>x : B<string>
>B : B<T>
function foo1b(x: B<string>); // error
>foo1b : { (x: B<string>): any; (x: B<string>): any; }
>x : B<string>
>B : B<T>
function foo1b(x: any) { }
>foo1b : { (x: B<string>): any; (x: B<string>): any; }
>x : any
function foo1c(x: C<string>);
>foo1c : { (x: C<string>): any; (x: C<string>): any; }
>x : C<string>
>C : C<T>
function foo1c(x: C<string>); // error
>foo1c : { (x: C<string>): any; (x: C<string>): any; }
>x : C<string>
>C : C<T>
function foo1c(x: any) { }
>foo1c : { (x: C<string>): any; (x: C<string>): any; }
>x : any
function foo2(x: I<string>);
>foo2 : { (x: I<string>): any; (x: I<string>): any; }
>x : I<string>
>I : I<T>
function foo2(x: I<string>); // error
>foo2 : { (x: I<string>): any; (x: I<string>): any; }
>x : I<string>
>I : I<T>
function foo2(x: any) { }
>foo2 : { (x: I<string>): any; (x: I<string>): any; }
>x : any
function foo3(x: typeof a);
>foo3 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>a : { foo<T>(x: T): T; }
function foo3(x: typeof a); // error
>foo3 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>a : { foo<T>(x: T): T; }
function foo3(x: any) { }
>foo3 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo4(x: any) { }
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo5(x: A);
>foo5 : { (x: A): any; (x: B<string>): any; }
>x : A
>A : A
function foo5(x: B<string>); // ok
>foo5 : { (x: A): any; (x: B<string>): any; }
>x : B<string>
>B : B<T>
function foo5(x: any) { }
>foo5 : { (x: A): any; (x: B<string>): any; }
>x : any
function foo5b(x: A);
>foo5b : { (x: A): any; (x: C<string>): any; }
>x : A
>A : A
function foo5b(x: C<string>); // ok
>foo5b : { (x: A): any; (x: C<string>): any; }
>x : C<string>
>C : C<T>
function foo5b(x: any) { }
>foo5b : { (x: A): any; (x: C<string>): any; }
>x : any
function foo6(x: A);
>foo6 : { (x: A): any; (x: I<string>): any; }
>x : A
>A : A
function foo6(x: I<string>); // ok
>foo6 : { (x: A): any; (x: I<string>): any; }
>x : I<string>
>I : I<T>
function foo6(x: any) { }
>foo6 : { (x: A): any; (x: I<string>): any; }
>x : any
function foo7(x: A);
>foo7 : { (x: A): any; (x: { foo<T>(x: T): T; }): any; }
>x : A
>A : A
function foo7(x: typeof a); // error
>foo7 : { (x: A): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>a : { foo<T>(x: T): T; }
function foo7(x: any) { }
>foo7 : { (x: A): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo8(x: B<string>);
>foo8 : { (x: B<string>): any; (x: I<string>): any; }
>x : B<string>
>B : B<T>
function foo8(x: I<string>); // error
>foo8 : { (x: B<string>): any; (x: I<string>): any; }
>x : I<string>
>I : I<T>
function foo8(x: any) { }
>foo8 : { (x: B<string>): any; (x: I<string>): any; }
>x : any
function foo9(x: B<string>);
>foo9 : { (x: B<string>): any; (x: C<string>): any; }
>x : B<string>
>B : B<T>
function foo9(x: C<string>); // error
>foo9 : { (x: B<string>): any; (x: C<string>): any; }
>x : C<string>
>C : C<T>
function foo9(x: any) { }
>foo9 : { (x: B<string>): any; (x: C<string>): any; }
>x : any
function foo10(x: B<string>);
>foo10 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : B<string>
>B : B<T>
function foo10(x: typeof a); // ok
>foo10 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>a : { foo<T>(x: T): T; }
function foo10(x: any) { }
>foo10 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : B<string>
>B : B<T>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo12(x: I<string>);
>foo12 : { (x: I<string>): any; (x: C<string>): any; }
>x : I<string>
>I : I<T>
function foo12(x: C<string>); // error
>foo12 : { (x: I<string>): any; (x: C<string>): any; }
>x : C<string>
>C : C<T>
function foo12(x: any) { }
>foo12 : { (x: I<string>): any; (x: C<string>): any; }
>x : any
function foo12b(x: I2);
>foo12b : { (x: I2): any; (x: C<string>): any; }
>x : I2
>I2 : I2
function foo12b(x: C<string>); // ok
>foo12b : { (x: I2): any; (x: C<string>): any; }
>x : C<string>
>C : C<T>
function foo12b(x: any) { }
>foo12b : { (x: I2): any; (x: C<string>): any; }
>x : any
function foo13(x: I<string>);
>foo13 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : I<string>
>I : I<T>
function foo13(x: typeof a); // ok
>foo13 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>a : { foo<T>(x: T): T; }
function foo13(x: any) { }
>foo13 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : I<string>
>I : I<T>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo15(x: I2);
>foo15 : { (x: I2): any; (x: C<number>): any; }
>x : I2
>I2 : I2
function foo15(x: C<number>); // ok
>foo15 : { (x: I2): any; (x: C<number>): any; }
>x : C<number>
>C : C<T>
function foo15(x: any) { }
>foo15 : { (x: I2): any; (x: C<number>): any; }
>x : any