2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.ts ===
|
|
|
|
// object types are identical structurally
|
|
|
|
|
|
|
|
class B<U> {
|
|
|
|
>B : B<U>
|
|
|
|
>U : U
|
|
|
|
|
|
|
|
constructor(x: U) { return null; }
|
|
|
|
>x : U
|
|
|
|
>U : U
|
|
|
|
}
|
|
|
|
|
|
|
|
class C<V> {
|
|
|
|
>C : C<V>
|
|
|
|
>V : V
|
|
|
|
|
|
|
|
constructor(x: V) { return null; }
|
|
|
|
>x : V
|
|
|
|
>V : V
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I<X> {
|
|
|
|
>I : I<X>
|
|
|
|
>X : X
|
|
|
|
|
|
|
|
new(x: X): B<X>;
|
|
|
|
>x : X
|
|
|
|
>X : X
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
>X : X
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I2 {
|
|
|
|
>I2 : I2
|
|
|
|
|
|
|
|
new<Y>(x: Y): C<Y>;
|
|
|
|
>Y : Y
|
|
|
|
>x : Y
|
|
|
|
>Y : Y
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<V>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Y : Y
|
|
|
|
}
|
|
|
|
|
|
|
|
var a: { new<Z>(x: Z): B<Z> }
|
|
|
|
>a : new <Z>(x: Z) => B<Z>
|
|
|
|
>Z : Z
|
|
|
|
>x : Z
|
|
|
|
>Z : Z
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Z : Z
|
|
|
|
|
|
|
|
var b = { new<A>(x: A) { return new C<A>(x); } };
|
2014-12-03 12:05:37 +01:00
|
|
|
>b : { new<A>(x: A): C<A>; }
|
|
|
|
>{ new<A>(x: A) { return new C<A>(x); } } : { new<A>(x: A): C<A>; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>new : <A>(x: A) => C<A>
|
|
|
|
>A : A
|
|
|
|
>x : A
|
|
|
|
>A : A
|
|
|
|
>new C<A>(x) : C<A>
|
|
|
|
>C : typeof C
|
|
|
|
>A : A
|
|
|
|
>x : A
|
|
|
|
|
|
|
|
function foo1b(x: B<string>);
|
|
|
|
>foo1b : { (x: B<string>): any; (x: B<string>): any; }
|
|
|
|
>x : B<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo1b(x: B<string>); // error
|
|
|
|
>foo1b : { (x: B<string>): any; (x: B<string>): any; }
|
|
|
|
>x : B<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo1c(x: C<string>); // error
|
|
|
|
>foo1c : { (x: C<string>): any; (x: C<string>): any; }
|
|
|
|
>x : C<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<X>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo2(x: I<string>); // error
|
|
|
|
>foo2 : { (x: I<string>): any; (x: I<string>): any; }
|
|
|
|
>x : I<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<X>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo2(x: any) { }
|
|
|
|
>foo2 : { (x: I<string>): any; (x: I<string>): any; }
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
function foo3(x: typeof a);
|
|
|
|
>foo3 : { (x: new <Z>(x: Z) => B<Z>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : new <Z>(x: Z) => B<Z>
|
|
|
|
>a : new <Z>(x: Z) => B<Z>
|
|
|
|
|
|
|
|
function foo3(x: typeof a); // error
|
|
|
|
>foo3 : { (x: new <Z>(x: Z) => B<Z>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : new <Z>(x: Z) => B<Z>
|
|
|
|
>a : new <Z>(x: Z) => B<Z>
|
|
|
|
|
|
|
|
function foo3(x: any) { }
|
|
|
|
>foo3 : { (x: new <Z>(x: Z) => B<Z>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
function foo4(x: typeof b);
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
|
|
|
|
>x : { new<A>(x: A): C<A>; }
|
|
|
|
>b : { new<A>(x: A): C<A>; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo4(x: typeof b); // error
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
|
|
|
|
>x : { new<A>(x: A): C<A>; }
|
|
|
|
>b : { new<A>(x: A): C<A>; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo4(x: any) { }
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : any
|
|
|
|
|
|
|
|
function foo8(x: B<string>);
|
|
|
|
>foo8 : { (x: B<string>): any; (x: I<string>): any; }
|
|
|
|
>x : B<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo8(x: I<string>); // BUG 832086
|
|
|
|
>foo8 : { (x: B<string>): any; (x: I<string>): any; }
|
|
|
|
>x : I<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<X>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo9(x: C<string>); // error
|
|
|
|
>foo9 : { (x: B<string>): any; (x: C<string>): any; }
|
|
|
|
>x : C<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : B<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo10(x: typeof a); // BUG 832086
|
|
|
|
>foo10 : { (x: B<string>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : new <Z>(x: Z) => B<Z>
|
|
|
|
>a : new <Z>(x: Z) => B<Z>
|
|
|
|
|
|
|
|
function foo10(x: any) { }
|
|
|
|
>foo10 : { (x: B<string>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
function foo11(x: B<string>);
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : B<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>B : B<U>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo11(x: typeof b); // ok
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
|
|
|
>x : { new<A>(x: A): C<A>; }
|
|
|
|
>b : { new<A>(x: A): C<A>; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo11(x: any) { }
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : any
|
|
|
|
|
|
|
|
function foo12(x: I<string>);
|
|
|
|
>foo12 : { (x: I<string>): any; (x: C<string>): any; }
|
|
|
|
>x : I<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<X>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo12(x: C<string>); // error
|
|
|
|
>foo12 : { (x: I<string>): any; (x: C<string>): any; }
|
|
|
|
>x : C<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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>); // BUG 832086
|
|
|
|
>foo12b : { (x: I2): any; (x: C<string>): any; }
|
|
|
|
>x : C<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C : C<V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : I<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<X>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo13(x: typeof a); // BUG 832086
|
|
|
|
>foo13 : { (x: I<string>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : new <Z>(x: Z) => B<Z>
|
|
|
|
>a : new <Z>(x: Z) => B<Z>
|
|
|
|
|
|
|
|
function foo13(x: any) { }
|
|
|
|
>foo13 : { (x: I<string>): any; (x: new <Z>(x: Z) => B<Z>): any; }
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
function foo14(x: I<string>);
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : I<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>I : I<X>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo14(x: typeof b); // ok
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
|
|
|
>x : { new<A>(x: A): C<A>; }
|
|
|
|
>b : { new<A>(x: A): C<A>; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo14(x: any) { }
|
2014-12-03 12:05:37 +01:00
|
|
|
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : any
|
|
|
|
|