205 lines
11 KiB
Text
205 lines
11 KiB
Text
=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentity2.ts ===
|
|
// object types are identical structurally
|
|
|
|
class A {
|
|
>A : A, Symbol(A,Decl(objectTypesIdentity2.ts,0,0))
|
|
|
|
foo: number;
|
|
>foo : number, Symbol(foo,Decl(objectTypesIdentity2.ts,2,9))
|
|
}
|
|
|
|
class B {
|
|
>B : B, Symbol(B,Decl(objectTypesIdentity2.ts,4,1))
|
|
|
|
foo: boolean;
|
|
>foo : boolean, Symbol(foo,Decl(objectTypesIdentity2.ts,6,9))
|
|
}
|
|
|
|
class C<T> {
|
|
>C : C<T>, Symbol(C,Decl(objectTypesIdentity2.ts,8,1))
|
|
>T : T, Symbol(T,Decl(objectTypesIdentity2.ts,10,8))
|
|
|
|
foo: T;
|
|
>foo : T, Symbol(foo,Decl(objectTypesIdentity2.ts,10,12))
|
|
>T : T, Symbol(T,Decl(objectTypesIdentity2.ts,10,8))
|
|
}
|
|
|
|
interface I {
|
|
>I : I, Symbol(I,Decl(objectTypesIdentity2.ts,12,1))
|
|
|
|
foo: Date;
|
|
>foo : Date, Symbol(foo,Decl(objectTypesIdentity2.ts,14,13))
|
|
>Date : Date, Symbol(Date,Decl(lib.d.ts,633,23),Decl(lib.d.ts,815,11))
|
|
}
|
|
|
|
var a: { foo: RegExp; }
|
|
>a : { foo: RegExp; }, Symbol(a,Decl(objectTypesIdentity2.ts,18,3))
|
|
>foo : RegExp, Symbol(foo,Decl(objectTypesIdentity2.ts,18,8))
|
|
>RegExp : RegExp, Symbol(RegExp,Decl(lib.d.ts,825,1),Decl(lib.d.ts,876,11))
|
|
|
|
enum E { A }
|
|
>E : E, Symbol(E,Decl(objectTypesIdentity2.ts,18,23))
|
|
>A : E, Symbol(E.A,Decl(objectTypesIdentity2.ts,19,8))
|
|
|
|
var b = { foo: E.A };
|
|
>b : { foo: E; }, Symbol(b,Decl(objectTypesIdentity2.ts,20,3))
|
|
>{ foo: E.A } : { foo: E; }
|
|
>foo : E, Symbol(foo,Decl(objectTypesIdentity2.ts,20,9))
|
|
>E.A : E, Symbol(E.A,Decl(objectTypesIdentity2.ts,19,8))
|
|
>E : typeof E, Symbol(E,Decl(objectTypesIdentity2.ts,18,23))
|
|
>A : E, Symbol(E.A,Decl(objectTypesIdentity2.ts,19,8))
|
|
|
|
function foo5(x: A);
|
|
>foo5 : { (x: A): any; (x: B): any; }, Symbol(foo5,Decl(objectTypesIdentity2.ts,20,21),Decl(objectTypesIdentity2.ts,22,20),Decl(objectTypesIdentity2.ts,23,20))
|
|
>x : A, Symbol(x,Decl(objectTypesIdentity2.ts,22,14))
|
|
>A : A, Symbol(A,Decl(objectTypesIdentity2.ts,0,0))
|
|
|
|
function foo5(x: B); // ok
|
|
>foo5 : { (x: A): any; (x: B): any; }, Symbol(foo5,Decl(objectTypesIdentity2.ts,20,21),Decl(objectTypesIdentity2.ts,22,20),Decl(objectTypesIdentity2.ts,23,20))
|
|
>x : B, Symbol(x,Decl(objectTypesIdentity2.ts,23,14))
|
|
>B : B, Symbol(B,Decl(objectTypesIdentity2.ts,4,1))
|
|
|
|
function foo5(x: any) { }
|
|
>foo5 : { (x: A): any; (x: B): any; }, Symbol(foo5,Decl(objectTypesIdentity2.ts,20,21),Decl(objectTypesIdentity2.ts,22,20),Decl(objectTypesIdentity2.ts,23,20))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,24,14))
|
|
|
|
function foo5b(x: A);
|
|
>foo5b : { (x: A): any; (x: C<string>): any; }, Symbol(foo5b,Decl(objectTypesIdentity2.ts,24,25),Decl(objectTypesIdentity2.ts,26,21),Decl(objectTypesIdentity2.ts,27,29))
|
|
>x : A, Symbol(x,Decl(objectTypesIdentity2.ts,26,15))
|
|
>A : A, Symbol(A,Decl(objectTypesIdentity2.ts,0,0))
|
|
|
|
function foo5b(x: C<string>); // ok
|
|
>foo5b : { (x: A): any; (x: C<string>): any; }, Symbol(foo5b,Decl(objectTypesIdentity2.ts,24,25),Decl(objectTypesIdentity2.ts,26,21),Decl(objectTypesIdentity2.ts,27,29))
|
|
>x : C<string>, Symbol(x,Decl(objectTypesIdentity2.ts,27,15))
|
|
>C : C<T>, Symbol(C,Decl(objectTypesIdentity2.ts,8,1))
|
|
|
|
function foo5b(x: any) { }
|
|
>foo5b : { (x: A): any; (x: C<string>): any; }, Symbol(foo5b,Decl(objectTypesIdentity2.ts,24,25),Decl(objectTypesIdentity2.ts,26,21),Decl(objectTypesIdentity2.ts,27,29))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,28,15))
|
|
|
|
function foo6(x: A);
|
|
>foo6 : { (x: A): any; (x: I): any; }, Symbol(foo6,Decl(objectTypesIdentity2.ts,28,26),Decl(objectTypesIdentity2.ts,30,20),Decl(objectTypesIdentity2.ts,31,20))
|
|
>x : A, Symbol(x,Decl(objectTypesIdentity2.ts,30,14))
|
|
>A : A, Symbol(A,Decl(objectTypesIdentity2.ts,0,0))
|
|
|
|
function foo6(x: I); // ok
|
|
>foo6 : { (x: A): any; (x: I): any; }, Symbol(foo6,Decl(objectTypesIdentity2.ts,28,26),Decl(objectTypesIdentity2.ts,30,20),Decl(objectTypesIdentity2.ts,31,20))
|
|
>x : I, Symbol(x,Decl(objectTypesIdentity2.ts,31,14))
|
|
>I : I, Symbol(I,Decl(objectTypesIdentity2.ts,12,1))
|
|
|
|
function foo6(x: any) { }
|
|
>foo6 : { (x: A): any; (x: I): any; }, Symbol(foo6,Decl(objectTypesIdentity2.ts,28,26),Decl(objectTypesIdentity2.ts,30,20),Decl(objectTypesIdentity2.ts,31,20))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,32,14))
|
|
|
|
function foo7(x: A);
|
|
>foo7 : { (x: A): any; (x: { foo: RegExp; }): any; }, Symbol(foo7,Decl(objectTypesIdentity2.ts,32,25),Decl(objectTypesIdentity2.ts,34,20),Decl(objectTypesIdentity2.ts,35,27))
|
|
>x : A, Symbol(x,Decl(objectTypesIdentity2.ts,34,14))
|
|
>A : A, Symbol(A,Decl(objectTypesIdentity2.ts,0,0))
|
|
|
|
function foo7(x: typeof a); // ok
|
|
>foo7 : { (x: A): any; (x: { foo: RegExp; }): any; }, Symbol(foo7,Decl(objectTypesIdentity2.ts,32,25),Decl(objectTypesIdentity2.ts,34,20),Decl(objectTypesIdentity2.ts,35,27))
|
|
>x : { foo: RegExp; }, Symbol(x,Decl(objectTypesIdentity2.ts,35,14))
|
|
>a : { foo: RegExp; }, Symbol(a,Decl(objectTypesIdentity2.ts,18,3))
|
|
|
|
function foo7(x: any) { }
|
|
>foo7 : { (x: A): any; (x: { foo: RegExp; }): any; }, Symbol(foo7,Decl(objectTypesIdentity2.ts,32,25),Decl(objectTypesIdentity2.ts,34,20),Decl(objectTypesIdentity2.ts,35,27))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,36,14))
|
|
|
|
function foo8(x: B);
|
|
>foo8 : { (x: B): any; (x: I): any; }, Symbol(foo8,Decl(objectTypesIdentity2.ts,36,25),Decl(objectTypesIdentity2.ts,38,20),Decl(objectTypesIdentity2.ts,39,20))
|
|
>x : B, Symbol(x,Decl(objectTypesIdentity2.ts,38,14))
|
|
>B : B, Symbol(B,Decl(objectTypesIdentity2.ts,4,1))
|
|
|
|
function foo8(x: I); // ok
|
|
>foo8 : { (x: B): any; (x: I): any; }, Symbol(foo8,Decl(objectTypesIdentity2.ts,36,25),Decl(objectTypesIdentity2.ts,38,20),Decl(objectTypesIdentity2.ts,39,20))
|
|
>x : I, Symbol(x,Decl(objectTypesIdentity2.ts,39,14))
|
|
>I : I, Symbol(I,Decl(objectTypesIdentity2.ts,12,1))
|
|
|
|
function foo8(x: any) { }
|
|
>foo8 : { (x: B): any; (x: I): any; }, Symbol(foo8,Decl(objectTypesIdentity2.ts,36,25),Decl(objectTypesIdentity2.ts,38,20),Decl(objectTypesIdentity2.ts,39,20))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,40,14))
|
|
|
|
function foo9(x: B);
|
|
>foo9 : { (x: B): any; (x: C<string>): any; }, Symbol(foo9,Decl(objectTypesIdentity2.ts,40,25),Decl(objectTypesIdentity2.ts,42,20),Decl(objectTypesIdentity2.ts,43,28))
|
|
>x : B, Symbol(x,Decl(objectTypesIdentity2.ts,42,14))
|
|
>B : B, Symbol(B,Decl(objectTypesIdentity2.ts,4,1))
|
|
|
|
function foo9(x: C<string>); // ok
|
|
>foo9 : { (x: B): any; (x: C<string>): any; }, Symbol(foo9,Decl(objectTypesIdentity2.ts,40,25),Decl(objectTypesIdentity2.ts,42,20),Decl(objectTypesIdentity2.ts,43,28))
|
|
>x : C<string>, Symbol(x,Decl(objectTypesIdentity2.ts,43,14))
|
|
>C : C<T>, Symbol(C,Decl(objectTypesIdentity2.ts,8,1))
|
|
|
|
function foo9(x: any) { }
|
|
>foo9 : { (x: B): any; (x: C<string>): any; }, Symbol(foo9,Decl(objectTypesIdentity2.ts,40,25),Decl(objectTypesIdentity2.ts,42,20),Decl(objectTypesIdentity2.ts,43,28))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,44,14))
|
|
|
|
function foo10(x: B);
|
|
>foo10 : { (x: B): any; (x: { foo: RegExp; }): any; }, Symbol(foo10,Decl(objectTypesIdentity2.ts,44,25),Decl(objectTypesIdentity2.ts,46,21),Decl(objectTypesIdentity2.ts,47,28))
|
|
>x : B, Symbol(x,Decl(objectTypesIdentity2.ts,46,15))
|
|
>B : B, Symbol(B,Decl(objectTypesIdentity2.ts,4,1))
|
|
|
|
function foo10(x: typeof a); // ok
|
|
>foo10 : { (x: B): any; (x: { foo: RegExp; }): any; }, Symbol(foo10,Decl(objectTypesIdentity2.ts,44,25),Decl(objectTypesIdentity2.ts,46,21),Decl(objectTypesIdentity2.ts,47,28))
|
|
>x : { foo: RegExp; }, Symbol(x,Decl(objectTypesIdentity2.ts,47,15))
|
|
>a : { foo: RegExp; }, Symbol(a,Decl(objectTypesIdentity2.ts,18,3))
|
|
|
|
function foo10(x: any) { }
|
|
>foo10 : { (x: B): any; (x: { foo: RegExp; }): any; }, Symbol(foo10,Decl(objectTypesIdentity2.ts,44,25),Decl(objectTypesIdentity2.ts,46,21),Decl(objectTypesIdentity2.ts,47,28))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,48,15))
|
|
|
|
function foo11(x: B);
|
|
>foo11 : { (x: B): any; (x: { foo: E; }): any; }, Symbol(foo11,Decl(objectTypesIdentity2.ts,48,26),Decl(objectTypesIdentity2.ts,50,21),Decl(objectTypesIdentity2.ts,51,28))
|
|
>x : B, Symbol(x,Decl(objectTypesIdentity2.ts,50,15))
|
|
>B : B, Symbol(B,Decl(objectTypesIdentity2.ts,4,1))
|
|
|
|
function foo11(x: typeof b); // ok
|
|
>foo11 : { (x: B): any; (x: { foo: E; }): any; }, Symbol(foo11,Decl(objectTypesIdentity2.ts,48,26),Decl(objectTypesIdentity2.ts,50,21),Decl(objectTypesIdentity2.ts,51,28))
|
|
>x : { foo: E; }, Symbol(x,Decl(objectTypesIdentity2.ts,51,15))
|
|
>b : { foo: E; }, Symbol(b,Decl(objectTypesIdentity2.ts,20,3))
|
|
|
|
function foo11(x: any) { }
|
|
>foo11 : { (x: B): any; (x: { foo: E; }): any; }, Symbol(foo11,Decl(objectTypesIdentity2.ts,48,26),Decl(objectTypesIdentity2.ts,50,21),Decl(objectTypesIdentity2.ts,51,28))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,52,15))
|
|
|
|
function foo12(x: I);
|
|
>foo12 : { (x: I): any; (x: C<string>): any; }, Symbol(foo12,Decl(objectTypesIdentity2.ts,52,26),Decl(objectTypesIdentity2.ts,54,21),Decl(objectTypesIdentity2.ts,55,29))
|
|
>x : I, Symbol(x,Decl(objectTypesIdentity2.ts,54,15))
|
|
>I : I, Symbol(I,Decl(objectTypesIdentity2.ts,12,1))
|
|
|
|
function foo12(x: C<string>); // ok
|
|
>foo12 : { (x: I): any; (x: C<string>): any; }, Symbol(foo12,Decl(objectTypesIdentity2.ts,52,26),Decl(objectTypesIdentity2.ts,54,21),Decl(objectTypesIdentity2.ts,55,29))
|
|
>x : C<string>, Symbol(x,Decl(objectTypesIdentity2.ts,55,15))
|
|
>C : C<T>, Symbol(C,Decl(objectTypesIdentity2.ts,8,1))
|
|
|
|
function foo12(x: any) { }
|
|
>foo12 : { (x: I): any; (x: C<string>): any; }, Symbol(foo12,Decl(objectTypesIdentity2.ts,52,26),Decl(objectTypesIdentity2.ts,54,21),Decl(objectTypesIdentity2.ts,55,29))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,56,15))
|
|
|
|
function foo13(x: I);
|
|
>foo13 : { (x: I): any; (x: { foo: RegExp; }): any; }, Symbol(foo13,Decl(objectTypesIdentity2.ts,56,26),Decl(objectTypesIdentity2.ts,58,21),Decl(objectTypesIdentity2.ts,59,28))
|
|
>x : I, Symbol(x,Decl(objectTypesIdentity2.ts,58,15))
|
|
>I : I, Symbol(I,Decl(objectTypesIdentity2.ts,12,1))
|
|
|
|
function foo13(x: typeof a); // ok
|
|
>foo13 : { (x: I): any; (x: { foo: RegExp; }): any; }, Symbol(foo13,Decl(objectTypesIdentity2.ts,56,26),Decl(objectTypesIdentity2.ts,58,21),Decl(objectTypesIdentity2.ts,59,28))
|
|
>x : { foo: RegExp; }, Symbol(x,Decl(objectTypesIdentity2.ts,59,15))
|
|
>a : { foo: RegExp; }, Symbol(a,Decl(objectTypesIdentity2.ts,18,3))
|
|
|
|
function foo13(x: any) { }
|
|
>foo13 : { (x: I): any; (x: { foo: RegExp; }): any; }, Symbol(foo13,Decl(objectTypesIdentity2.ts,56,26),Decl(objectTypesIdentity2.ts,58,21),Decl(objectTypesIdentity2.ts,59,28))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,60,15))
|
|
|
|
function foo14(x: I);
|
|
>foo14 : { (x: I): any; (x: { foo: E; }): any; }, Symbol(foo14,Decl(objectTypesIdentity2.ts,60,26),Decl(objectTypesIdentity2.ts,62,21),Decl(objectTypesIdentity2.ts,63,28))
|
|
>x : I, Symbol(x,Decl(objectTypesIdentity2.ts,62,15))
|
|
>I : I, Symbol(I,Decl(objectTypesIdentity2.ts,12,1))
|
|
|
|
function foo14(x: typeof b); // ok
|
|
>foo14 : { (x: I): any; (x: { foo: E; }): any; }, Symbol(foo14,Decl(objectTypesIdentity2.ts,60,26),Decl(objectTypesIdentity2.ts,62,21),Decl(objectTypesIdentity2.ts,63,28))
|
|
>x : { foo: E; }, Symbol(x,Decl(objectTypesIdentity2.ts,63,15))
|
|
>b : { foo: E; }, Symbol(b,Decl(objectTypesIdentity2.ts,20,3))
|
|
|
|
function foo14(x: any) { }
|
|
>foo14 : { (x: I): any; (x: { foo: E; }): any; }, Symbol(foo14,Decl(objectTypesIdentity2.ts,60,26),Decl(objectTypesIdentity2.ts,62,21),Decl(objectTypesIdentity2.ts,63,28))
|
|
>x : any, Symbol(x,Decl(objectTypesIdentity2.ts,64,15))
|
|
|