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

71 lines
5.3 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures.ts ===
module ConstructSignature {
>ConstructSignature : typeof ConstructSignature, Symbol(ConstructSignature, Decl(subtypingWithConstructSignatures.ts, 0, 0))
declare function foo1(cb: new (x: number) => void): typeof cb;
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>cb : new (x: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 1, 26))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 1, 35))
>cb : new (x: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 1, 26))
declare function foo1(cb: any): any;
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>cb : any, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 2, 26))
var rarg1: new (x: number) => number;
>rarg1 : new (x: number) => number, Symbol(rarg1, Decl(subtypingWithConstructSignatures.ts, 3, 7))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 3, 20))
var r = foo1(rarg1); // ok because base returns void
>r : new (x: number) => void, Symbol(r, Decl(subtypingWithConstructSignatures.ts, 4, 7))
>foo1(rarg1) : new (x: number) => void
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>rarg1 : new (x: number) => number, Symbol(rarg1, Decl(subtypingWithConstructSignatures.ts, 3, 7))
var rarg2: new <T>(x: T) => string;
>rarg2 : new <T>(x: T) => string, Symbol(rarg2, Decl(subtypingWithConstructSignatures.ts, 5, 7))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 5, 20))
>x : T, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 5, 23))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 5, 20))
var r2 = foo1(rarg2); // ok because base returns void
>r2 : new (x: number) => void, Symbol(r2, Decl(subtypingWithConstructSignatures.ts, 6, 7))
>foo1(rarg2) : new (x: number) => void
>foo1 : { (cb: new (x: number) => void): new (x: number) => void; (cb: any): any; }, Symbol(foo1, Decl(subtypingWithConstructSignatures.ts, 0, 27), Decl(subtypingWithConstructSignatures.ts, 1, 66))
>rarg2 : new <T>(x: T) => string, Symbol(rarg2, Decl(subtypingWithConstructSignatures.ts, 5, 7))
declare function foo2(cb: new (x: number, y: number) => void): typeof cb;
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>cb : new (x: number, y: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 8, 26))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 8, 35))
>y : number, Symbol(y, Decl(subtypingWithConstructSignatures.ts, 8, 45))
>cb : new (x: number, y: number) => void, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 8, 26))
declare function foo2(cb: any): any;
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>cb : any, Symbol(cb, Decl(subtypingWithConstructSignatures.ts, 9, 26))
var r3arg1: new (x: number, y: number) => number;
>r3arg1 : new (x: number, y: number) => number, Symbol(r3arg1, Decl(subtypingWithConstructSignatures.ts, 10, 7))
>x : number, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 10, 21))
>y : number, Symbol(y, Decl(subtypingWithConstructSignatures.ts, 10, 31))
var r3 = foo2(r3arg1); // ok because base returns void
>r3 : new (x: number, y: number) => void, Symbol(r3, Decl(subtypingWithConstructSignatures.ts, 11, 7))
>foo2(r3arg1) : new (x: number, y: number) => void
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>r3arg1 : new (x: number, y: number) => number, Symbol(r3arg1, Decl(subtypingWithConstructSignatures.ts, 10, 7))
var r4arg1: new <T>(x: T) => string;
>r4arg1 : new <T>(x: T) => string, Symbol(r4arg1, Decl(subtypingWithConstructSignatures.ts, 12, 7))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 12, 21))
>x : T, Symbol(x, Decl(subtypingWithConstructSignatures.ts, 12, 24))
>T : T, Symbol(T, Decl(subtypingWithConstructSignatures.ts, 12, 21))
var r4 = foo2(r4arg1); // ok because base returns void
>r4 : new (x: number, y: number) => void, Symbol(r4, Decl(subtypingWithConstructSignatures.ts, 13, 7))
>foo2(r4arg1) : new (x: number, y: number) => void
>foo2 : { (cb: new (x: number, y: number) => void): new (x: number, y: number) => void; (cb: any): any; }, Symbol(foo2, Decl(subtypingWithConstructSignatures.ts, 6, 25), Decl(subtypingWithConstructSignatures.ts, 8, 77))
>r4arg1 : new <T>(x: T) => string, Symbol(r4arg1, Decl(subtypingWithConstructSignatures.ts, 12, 7))
}