TypeScript/tests/baselines/reference/objectTypesIdentityWithPrivates2.types
2015-04-13 14:29:37 -07:00

120 lines
8.6 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates2.ts ===
// object types are identical structurally
class C<T> {
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
>T : T, Symbol(T, Decl(objectTypesIdentityWithPrivates2.ts, 2, 8))
private foo: T;
>foo : T, Symbol(foo, Decl(objectTypesIdentityWithPrivates2.ts, 2, 12))
>T : T, Symbol(T, Decl(objectTypesIdentityWithPrivates2.ts, 2, 8))
}
class D<T> extends C<T> {
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
>T : T, Symbol(T, Decl(objectTypesIdentityWithPrivates2.ts, 6, 8))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
>T : T, Symbol(T, Decl(objectTypesIdentityWithPrivates2.ts, 6, 8))
}
function foo1(x: C<string>);
>foo1 : { (x: C<string>): any; (x: C<number>): any; }, Symbol(foo1, Decl(objectTypesIdentityWithPrivates2.ts, 7, 1), Decl(objectTypesIdentityWithPrivates2.ts, 9, 28), Decl(objectTypesIdentityWithPrivates2.ts, 10, 28))
>x : C<string>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 9, 14))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
function foo1(x: C<number>); // ok
>foo1 : { (x: C<string>): any; (x: C<number>): any; }, Symbol(foo1, Decl(objectTypesIdentityWithPrivates2.ts, 7, 1), Decl(objectTypesIdentityWithPrivates2.ts, 9, 28), Decl(objectTypesIdentityWithPrivates2.ts, 10, 28))
>x : C<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 10, 14))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
function foo1(x: any) { }
>foo1 : { (x: C<string>): any; (x: C<number>): any; }, Symbol(foo1, Decl(objectTypesIdentityWithPrivates2.ts, 7, 1), Decl(objectTypesIdentityWithPrivates2.ts, 9, 28), Decl(objectTypesIdentityWithPrivates2.ts, 10, 28))
>x : any, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 11, 14))
function foo2(x: D<string>);
>foo2 : { (x: D<string>): any; (x: D<number>): any; }, Symbol(foo2, Decl(objectTypesIdentityWithPrivates2.ts, 11, 25), Decl(objectTypesIdentityWithPrivates2.ts, 13, 28), Decl(objectTypesIdentityWithPrivates2.ts, 14, 28))
>x : D<string>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 13, 14))
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo2(x: D<number>); // ok
>foo2 : { (x: D<string>): any; (x: D<number>): any; }, Symbol(foo2, Decl(objectTypesIdentityWithPrivates2.ts, 11, 25), Decl(objectTypesIdentityWithPrivates2.ts, 13, 28), Decl(objectTypesIdentityWithPrivates2.ts, 14, 28))
>x : D<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 14, 14))
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo2(x: any) { }
>foo2 : { (x: D<string>): any; (x: D<number>): any; }, Symbol(foo2, Decl(objectTypesIdentityWithPrivates2.ts, 11, 25), Decl(objectTypesIdentityWithPrivates2.ts, 13, 28), Decl(objectTypesIdentityWithPrivates2.ts, 14, 28))
>x : any, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 15, 14))
function foo3(x: C<string>);
>foo3 : { (x: C<string>): any; (x: D<number>): any; }, Symbol(foo3, Decl(objectTypesIdentityWithPrivates2.ts, 15, 25), Decl(objectTypesIdentityWithPrivates2.ts, 17, 28), Decl(objectTypesIdentityWithPrivates2.ts, 18, 28))
>x : C<string>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 17, 14))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
function foo3(x: D<number>); // ok
>foo3 : { (x: C<string>): any; (x: D<number>): any; }, Symbol(foo3, Decl(objectTypesIdentityWithPrivates2.ts, 15, 25), Decl(objectTypesIdentityWithPrivates2.ts, 17, 28), Decl(objectTypesIdentityWithPrivates2.ts, 18, 28))
>x : D<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 18, 14))
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo3(x: any) { }
>foo3 : { (x: C<string>): any; (x: D<number>): any; }, Symbol(foo3, Decl(objectTypesIdentityWithPrivates2.ts, 15, 25), Decl(objectTypesIdentityWithPrivates2.ts, 17, 28), Decl(objectTypesIdentityWithPrivates2.ts, 18, 28))
>x : any, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 19, 14))
function foo4(x: C<number>): number;
>foo4 : { (x: C<number>): number; (x: D<number>): string; }, Symbol(foo4, Decl(objectTypesIdentityWithPrivates2.ts, 19, 25), Decl(objectTypesIdentityWithPrivates2.ts, 21, 36), Decl(objectTypesIdentityWithPrivates2.ts, 22, 36))
>x : C<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 21, 14))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
function foo4(x: D<number>): string; // BUG 831926
>foo4 : { (x: C<number>): number; (x: D<number>): string; }, Symbol(foo4, Decl(objectTypesIdentityWithPrivates2.ts, 19, 25), Decl(objectTypesIdentityWithPrivates2.ts, 21, 36), Decl(objectTypesIdentityWithPrivates2.ts, 22, 36))
>x : D<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 22, 14))
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo4(x: any): any { }
>foo4 : { (x: C<number>): number; (x: D<number>): string; }, Symbol(foo4, Decl(objectTypesIdentityWithPrivates2.ts, 19, 25), Decl(objectTypesIdentityWithPrivates2.ts, 21, 36), Decl(objectTypesIdentityWithPrivates2.ts, 22, 36))
>x : any, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 23, 14))
var r = foo4(new C<number>());
>r : number, Symbol(r, Decl(objectTypesIdentityWithPrivates2.ts, 25, 3), Decl(objectTypesIdentityWithPrivates2.ts, 26, 3))
>foo4(new C<number>()) : number
>foo4 : { (x: C<number>): number; (x: D<number>): string; }, Symbol(foo4, Decl(objectTypesIdentityWithPrivates2.ts, 19, 25), Decl(objectTypesIdentityWithPrivates2.ts, 21, 36), Decl(objectTypesIdentityWithPrivates2.ts, 22, 36))
>new C<number>() : C<number>
>C : typeof C, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
var r = foo4(new D<number>());
>r : number, Symbol(r, Decl(objectTypesIdentityWithPrivates2.ts, 25, 3), Decl(objectTypesIdentityWithPrivates2.ts, 26, 3))
>foo4(new D<number>()) : number
>foo4 : { (x: C<number>): number; (x: D<number>): string; }, Symbol(foo4, Decl(objectTypesIdentityWithPrivates2.ts, 19, 25), Decl(objectTypesIdentityWithPrivates2.ts, 21, 36), Decl(objectTypesIdentityWithPrivates2.ts, 22, 36))
>new D<number>() : D<number>
>D : typeof D, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo5(x: C<number>): number;
>foo5 : { (x: C<number>): number; (x: C<number>): string; }, Symbol(foo5, Decl(objectTypesIdentityWithPrivates2.ts, 26, 30), Decl(objectTypesIdentityWithPrivates2.ts, 28, 36), Decl(objectTypesIdentityWithPrivates2.ts, 29, 36))
>x : C<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 28, 14))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
function foo5(x: C<number>): string; // error
>foo5 : { (x: C<number>): number; (x: C<number>): string; }, Symbol(foo5, Decl(objectTypesIdentityWithPrivates2.ts, 26, 30), Decl(objectTypesIdentityWithPrivates2.ts, 28, 36), Decl(objectTypesIdentityWithPrivates2.ts, 29, 36))
>x : C<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 29, 14))
>C : C<T>, Symbol(C, Decl(objectTypesIdentityWithPrivates2.ts, 0, 0))
function foo5(x: any): any { }
>foo5 : { (x: C<number>): number; (x: C<number>): string; }, Symbol(foo5, Decl(objectTypesIdentityWithPrivates2.ts, 26, 30), Decl(objectTypesIdentityWithPrivates2.ts, 28, 36), Decl(objectTypesIdentityWithPrivates2.ts, 29, 36))
>x : any, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 30, 14))
function foo6(x: D<number>): number;
>foo6 : { (x: D<number>): number; (x: D<number>): string; }, Symbol(foo6, Decl(objectTypesIdentityWithPrivates2.ts, 30, 30), Decl(objectTypesIdentityWithPrivates2.ts, 32, 36), Decl(objectTypesIdentityWithPrivates2.ts, 33, 36))
>x : D<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 32, 14))
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo6(x: D<number>): string; // error
>foo6 : { (x: D<number>): number; (x: D<number>): string; }, Symbol(foo6, Decl(objectTypesIdentityWithPrivates2.ts, 30, 30), Decl(objectTypesIdentityWithPrivates2.ts, 32, 36), Decl(objectTypesIdentityWithPrivates2.ts, 33, 36))
>x : D<number>, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 33, 14))
>D : D<T>, Symbol(D, Decl(objectTypesIdentityWithPrivates2.ts, 4, 1))
function foo6(x: any): any { }
>foo6 : { (x: D<number>): number; (x: D<number>): string; }, Symbol(foo6, Decl(objectTypesIdentityWithPrivates2.ts, 30, 30), Decl(objectTypesIdentityWithPrivates2.ts, 32, 36), Decl(objectTypesIdentityWithPrivates2.ts, 33, 36))
>x : any, Symbol(x, Decl(objectTypesIdentityWithPrivates2.ts, 34, 14))