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

377 lines
11 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.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<U, V> {
>B : B<U, V>
>U : U
>V : V
foo(x: U): U { return null; }
>foo : (x: U) => U
>x : U
>U : U
>U : U
>null : null
}
class C<V, W, X> {
>C : C<V, W, X>
>V : V
>W : W
>X : X
foo(x: V): V { return null; }
>foo : (x: V) => V
>x : V
>V : V
>V : V
>null : null
}
interface I<X, Y, Z, A> {
>I : I<X, Y, Z, A>
>X : X
>Y : Y
>Z : Z
>A : A
foo(x: X): X;
>foo : (x: X) => X
>x : X
>X : X
>X : X
}
interface I2 {
>I2 : I2
foo<Y, Z, A, B>(x: Y): Y;
>foo : <Y, Z, A, B>(x: Y) => Y
>Y : Y
>Z : Z
>A : A
>B : B
>x : Y
>Y : Y
>Y : Y
}
var a: { foo<Z, A, B, C, D>(x: Z): Z }
>a : { foo<Z, A, B, C, D>(x: Z): Z; }
>foo : <Z, A, B, C, D>(x: Z) => Z
>Z : Z
>A : A
>B : B
>C : C
>D : D
>x : Z
>Z : Z
>Z : Z
var b = { foo<A, B, C, D, E, F>(x: A) { return x; } };
>b : { foo<A, B, C, D, E, F>(x: A): A; }
>{ foo<A, B, C, D, E, F>(x: A) { return x; } } : { foo<A, B, C, D, E, F>(x: A): A; }
>foo : <A, B, C, D, E, F>(x: A) => A
>A : A
>B : B
>C : C
>D : D
>E : E
>F : F
>x : A
>A : A
>x : A
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, string>);
>foo1b : { (x: B<string, string>): any; (x: B<string, string>): any; }
>x : B<string, string>
>B : B<U, V>
function foo1b(x: B<string, string>); // error
>foo1b : { (x: B<string, string>): any; (x: B<string, string>): any; }
>x : B<string, string>
>B : B<U, V>
function foo1b(x: any) { }
>foo1b : { (x: B<string, string>): any; (x: B<string, string>): any; }
>x : any
function foo1c(x: C<string, number, boolean>);
>foo1c : { (x: C<string, number, boolean>): any; (x: C<string, number, boolean>): any; }
>x : C<string, number, boolean>
>C : C<V, W, X>
function foo1c(x: C<string, number, boolean>); // error
>foo1c : { (x: C<string, number, boolean>): any; (x: C<string, number, boolean>): any; }
>x : C<string, number, boolean>
>C : C<V, W, X>
function foo1c(x: any) { }
>foo1c : { (x: C<string, number, boolean>): any; (x: C<string, number, boolean>): any; }
>x : any
function foo2(x: I<string, boolean, number, string>);
>foo2 : { (x: I<string, boolean, number, string>): any; (x: I<string, boolean, number, string>): any; }
>x : I<string, boolean, number, string>
>I : I<X, Y, Z, A>
function foo2(x: I<string, boolean, number, string>); // error
>foo2 : { (x: I<string, boolean, number, string>): any; (x: I<string, boolean, number, string>): any; }
>x : I<string, boolean, number, string>
>I : I<X, Y, Z, A>
function foo2(x: any) { }
>foo2 : { (x: I<string, boolean, number, string>): any; (x: I<string, boolean, number, string>): any; }
>x : any
function foo3(x: typeof a);
>foo3 : { (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : { foo<Z, A, B, C, D>(x: Z): Z; }
>a : { foo<Z, A, B, C, D>(x: Z): Z; }
function foo3(x: typeof a); // error
>foo3 : { (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : { foo<Z, A, B, C, D>(x: Z): Z; }
>a : { foo<Z, A, B, C, D>(x: Z): Z; }
function foo3(x: any) { }
>foo3 : { (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo4(x: any) { }
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo5(x: A);
>foo5 : { (x: A): any; (x: B<string, string>): any; }
>x : A
>A : A
function foo5(x: B<string, string>); // ok
>foo5 : { (x: A): any; (x: B<string, string>): any; }
>x : B<string, string>
>B : B<U, V>
function foo5(x: any) { }
>foo5 : { (x: A): any; (x: B<string, string>): any; }
>x : any
function foo5b(x: A);
>foo5b : { (x: A): any; (x: C<string, number, boolean>): any; }
>x : A
>A : A
function foo5b(x: C<string, number, boolean>); // ok
>foo5b : { (x: A): any; (x: C<string, number, boolean>): any; }
>x : C<string, number, boolean>
>C : C<V, W, X>
function foo5b(x: any) { }
>foo5b : { (x: A): any; (x: C<string, number, boolean>): any; }
>x : any
function foo6(x: A);
>foo6 : { (x: A): any; (x: I<string, number, boolean, Date>): any; }
>x : A
>A : A
function foo6(x: I<string, number, boolean, Date>); // ok
>foo6 : { (x: A): any; (x: I<string, number, boolean, Date>): any; }
>x : I<string, number, boolean, Date>
>I : I<X, Y, Z, A>
>Date : Date
function foo6(x: any) { }
>foo6 : { (x: A): any; (x: I<string, number, boolean, Date>): any; }
>x : any
function foo7(x: A);
>foo7 : { (x: A): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : A
>A : A
function foo7(x: typeof a); // no error, bug?
>foo7 : { (x: A): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : { foo<Z, A, B, C, D>(x: Z): Z; }
>a : { foo<Z, A, B, C, D>(x: Z): Z; }
function foo7(x: any) { }
>foo7 : { (x: A): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : any
function foo8(x: B<string, string>);
>foo8 : { (x: B<string, string>): any; (x: I<string, string, boolean, Date>): any; }
>x : B<string, string>
>B : B<U, V>
function foo8(x: I<string, string, boolean, Date>); // error
>foo8 : { (x: B<string, string>): any; (x: I<string, string, boolean, Date>): any; }
>x : I<string, string, boolean, Date>
>I : I<X, Y, Z, A>
>Date : Date
function foo8(x: any) { }
>foo8 : { (x: B<string, string>): any; (x: I<string, string, boolean, Date>): any; }
>x : any
function foo9(x: B<string, number>);
>foo9 : { (x: B<string, number>): any; (x: C<string, number, B<string, string>>): any; }
>x : B<string, number>
>B : B<U, V>
function foo9(x: C<string, number, B<string, string>>); // error
>foo9 : { (x: B<string, number>): any; (x: C<string, number, B<string, string>>): any; }
>x : C<string, number, B<string, string>>
>C : C<V, W, X>
>B : B<U, V>
function foo9(x: any) { }
>foo9 : { (x: B<string, number>): any; (x: C<string, number, B<string, string>>): any; }
>x : any
function foo10(x: B<string, boolean>);
>foo10 : { (x: B<string, boolean>): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : B<string, boolean>
>B : B<U, V>
function foo10(x: typeof a); // ok
>foo10 : { (x: B<string, boolean>): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : { foo<Z, A, B, C, D>(x: Z): Z; }
>a : { foo<Z, A, B, C, D>(x: Z): Z; }
function foo10(x: any) { }
>foo10 : { (x: B<string, boolean>): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : any
function foo11(x: B<string, boolean>);
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : B<string, boolean>
>B : B<U, V>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo11(x: any) { }
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo12(x: I<B<string, number>, number, Date, string>);
>foo12 : { (x: I<B<string, number>, number, Date, string>): any; (x: C<B<string, number>, number, Date>): any; }
>x : I<B<string, number>, number, Date, string>
>I : I<X, Y, Z, A>
>B : B<U, V>
>Date : Date
function foo12(x: C<B<string, number>, number, Date>); // error
>foo12 : { (x: I<B<string, number>, number, Date, string>): any; (x: C<B<string, number>, number, Date>): any; }
>x : C<B<string, number>, number, Date>
>C : C<V, W, X>
>B : B<U, V>
>Date : Date
function foo12(x: any) { }
>foo12 : { (x: I<B<string, number>, number, Date, string>): any; (x: C<B<string, number>, number, Date>): any; }
>x : any
function foo12b(x: I2);
>foo12b : { (x: I2): any; (x: C<string, string, boolean>): any; }
>x : I2
>I2 : I2
function foo12b(x: C<string, string, boolean>); // ok
>foo12b : { (x: I2): any; (x: C<string, string, boolean>): any; }
>x : C<string, string, boolean>
>C : C<V, W, X>
function foo12b(x: any) { }
>foo12b : { (x: I2): any; (x: C<string, string, boolean>): any; }
>x : any
function foo13(x: I<string, Date, RegExp, Date>);
>foo13 : { (x: I<string, Date, RegExp, Date>): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : I<string, Date, RegExp, Date>
>I : I<X, Y, Z, A>
>Date : Date
>RegExp : RegExp
>Date : Date
function foo13(x: typeof a); // ok
>foo13 : { (x: I<string, Date, RegExp, Date>): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : { foo<Z, A, B, C, D>(x: Z): Z; }
>a : { foo<Z, A, B, C, D>(x: Z): Z; }
function foo13(x: any) { }
>foo13 : { (x: I<string, Date, RegExp, Date>): any; (x: { foo<Z, A, B, C, D>(x: Z): Z; }): any; }
>x : any
function foo14(x: I<string, Date, RegExp, boolean>);
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : I<string, Date, RegExp, boolean>
>I : I<X, Y, Z, A>
>Date : Date
>RegExp : RegExp
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo14(x: any) { }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo15(x: I2);
>foo15 : { (x: I2): any; (x: C<number, B<string, string>, B<number, string>>): any; }
>x : I2
>I2 : I2
function foo15(x: C<number, B<string, string>, B<number, string>>); // ok
>foo15 : { (x: I2): any; (x: C<number, B<string, string>, B<number, string>>): any; }
>x : C<number, B<string, string>, B<number, string>>
>C : C<V, W, X>
>B : B<U, V>
>B : B<U, V>
function foo15(x: any) { }
>foo15 : { (x: I2): any; (x: C<number, B<string, string>, B<number, string>>): any; }
>x : any