2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/promisesWithConstraints.ts ===
|
|
|
|
interface Promise<T> {
|
|
|
|
>Promise : Promise<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
|
|
|
>then : <U>(cb: (x: T) => Promise<U>) => Promise<U>
|
|
|
|
>U : U
|
|
|
|
>cb : (x: T) => Promise<U>
|
|
|
|
>x : T
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
}
|
|
|
|
|
|
|
|
interface CPromise<T extends { x: any; }> {
|
|
|
|
>CPromise : CPromise<T>
|
|
|
|
>T : T
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
then<U extends { x: any; }>(cb: (x: T) => Promise<U>): Promise<U>;
|
|
|
|
>then : <U extends { x: any; }>(cb: (x: T) => Promise<U>) => Promise<U>
|
|
|
|
>U : U
|
|
|
|
>x : any
|
|
|
|
>cb : (x: T) => Promise<U>
|
|
|
|
>x : T
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Foo { x; }
|
|
|
|
>Foo : Foo
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
interface Bar { x; y; }
|
|
|
|
>Bar : Bar
|
|
|
|
>x : any
|
|
|
|
>y : any
|
|
|
|
|
|
|
|
var a: Promise<Foo>;
|
|
|
|
>a : Promise<Foo>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Foo : Foo
|
|
|
|
|
|
|
|
var b: Promise<Bar>;
|
|
|
|
>b : Promise<Bar>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Bar : Bar
|
|
|
|
|
|
|
|
a = b; // ok
|
|
|
|
>a = b : Promise<Bar>
|
|
|
|
>a : Promise<Foo>
|
|
|
|
>b : Promise<Bar>
|
|
|
|
|
|
|
|
b = a; // ok
|
|
|
|
>b = a : Promise<Foo>
|
|
|
|
>b : Promise<Bar>
|
|
|
|
>a : Promise<Foo>
|
|
|
|
|
|
|
|
var a2: CPromise<Foo>;
|
|
|
|
>a2 : CPromise<Foo>
|
2014-08-19 04:56:03 +02:00
|
|
|
>CPromise : CPromise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Foo : Foo
|
|
|
|
|
|
|
|
var b2: CPromise<Bar>;
|
|
|
|
>b2 : CPromise<Bar>
|
2014-08-19 04:56:03 +02:00
|
|
|
>CPromise : CPromise<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>Bar : Bar
|
|
|
|
|
|
|
|
a2 = b2; // ok
|
|
|
|
>a2 = b2 : CPromise<Bar>
|
|
|
|
>a2 : CPromise<Foo>
|
|
|
|
>b2 : CPromise<Bar>
|
|
|
|
|
|
|
|
b2 = a2; // was error
|
|
|
|
>b2 = a2 : CPromise<Foo>
|
|
|
|
>b2 : CPromise<Bar>
|
|
|
|
>a2 : CPromise<Foo>
|
|
|
|
|