diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 7cf2c00248c8b..1536166667772 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1378,8 +1378,13 @@ declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike | awaited T) => void, reject: (reason?: any) => void) => void) => PromiseLike; +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; +/** + * A "Promise-like" is an object that has a callable `then` method that accepts fulfillment and rejection handlers. + * A "Promise-like" implementation may or may not be compatible with native ES2015 or Promise/A+, but provides a similar- + * enough implementation that a native of Promise/A+ -compatible promise implementation could adopt its result. + */ interface PromiseLike { /** * Attaches callbacks for the resolution and/or rejection of the Promise. @@ -1387,11 +1392,11 @@ interface PromiseLike { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: ((value: awaited T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; + then(onfulfilled?: ((value: T | awaited T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; } /** - * Represents the completion of an asynchronous operation + * Represents the completion of an asynchronous operation. */ interface Promise { /** diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt index efb23e304fc50..7e3595ec6f4e0 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. The types returned by 'then(...)' are incompatible between these types. - Type 'void' is not assignable to type 'PromiseLike'. + Type 'void' is not assignable to type 'PromiseLike'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member. @@ -39,7 +39,7 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 !!! error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. !!! error TS1055: Construct signature return types 'Thenable' and 'PromiseLike' are incompatible. !!! error TS1055: The types returned by 'then(...)' are incompatible between these types. -!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. +!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. async function fn7() { return; } // valid: Promise async function fn8() { return 1; } // valid: Promise async function fn9() { return null; } // valid: Promise diff --git a/tests/baselines/reference/awaitedVariance.errors.txt b/tests/baselines/reference/awaitedVariance.errors.txt index 694ca4c62f96a..96938b0bdcbd5 100644 --- a/tests/baselines/reference/awaitedVariance.errors.txt +++ b/tests/baselines/reference/awaitedVariance.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/awaited/awaitedVariance.ts(74,1): error TS2322: Type 'C>' is not assignable to type 'C'. +tests/cases/conformance/types/awaited/awaitedVariance.ts(58,1): error TS2322: Type 'C>' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'number' is not assignable to type '{ _tag: string; } & number'. Type 'number' is not assignable to type '{ _tag: string; }'. -tests/cases/conformance/types/awaited/awaitedVariance.ts(84,1): error TS2322: Type 'D>' is not assignable to type 'D'. +tests/cases/conformance/types/awaited/awaitedVariance.ts(68,1): error TS2322: Type 'D>' is not assignable to type 'D'. Types of property 'a' are incompatible. Type 'C>' is not assignable to type 'C'. @@ -30,22 +30,6 @@ tests/cases/conformance/types/awaited/awaitedVariance.ts(84,1): error TS2322: Ty declare let pl0: PromiseLike; declare let pl1: PromiseLike>; declare let pl2: PromiseLike; - pl0 = pl1; - pl0 = pl2; - pl1 = pl0; - pl1 = pl2; - pl2 = pl0; - pl2 = pl1; - - function fn2(pl0: PromiseLike, pl1: PromiseLike>, pl2: PromiseLike) { - pl0 = pl1; - pl0 = pl2; - pl1 = pl0; - pl1 = pl2; - pl2 = pl0; - pl2 = pl1; - } - pl0 = p0; pl0 = p1; pl0 = p2; diff --git a/tests/baselines/reference/awaitedVariance.js b/tests/baselines/reference/awaitedVariance.js index 1edaf909e67b2..32ade8117566e 100644 --- a/tests/baselines/reference/awaitedVariance.js +++ b/tests/baselines/reference/awaitedVariance.js @@ -21,22 +21,6 @@ function fn1(p0: Promise, p1: Promise>, p2: Promise) declare let pl0: PromiseLike; declare let pl1: PromiseLike>; declare let pl2: PromiseLike; -pl0 = pl1; -pl0 = pl2; -pl1 = pl0; -pl1 = pl2; -pl2 = pl0; -pl2 = pl1; - -function fn2(pl0: PromiseLike, pl1: PromiseLike>, pl2: PromiseLike) { - pl0 = pl1; - pl0 = pl2; - pl1 = pl0; - pl1 = pl2; - pl2 = pl0; - pl2 = pl1; -} - pl0 = p0; pl0 = p1; pl0 = p2; @@ -136,20 +120,6 @@ function fn1(p0, p1, p2) { p2 = p0; p2 = p1; } -pl0 = pl1; -pl0 = pl2; -pl1 = pl0; -pl1 = pl2; -pl2 = pl0; -pl2 = pl1; -function fn2(pl0, pl1, pl2) { - pl0 = pl1; - pl0 = pl2; - pl1 = pl0; - pl1 = pl2; - pl2 = pl0; - pl2 = pl1; -} pl0 = p0; pl0 = p1; pl0 = p2; diff --git a/tests/baselines/reference/awaitedVariance.symbols b/tests/baselines/reference/awaitedVariance.symbols index 521dc557ad0e3..33a87ad2f73b1 100644 --- a/tests/baselines/reference/awaitedVariance.symbols +++ b/tests/baselines/reference/awaitedVariance.symbols @@ -88,69 +88,6 @@ declare let pl2: PromiseLike; >pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 21, 11)) >PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) -pl0 = pl1; ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 19, 11)) ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 20, 11)) - -pl0 = pl2; ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 19, 11)) ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 21, 11)) - -pl1 = pl0; ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 20, 11)) ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 19, 11)) - -pl1 = pl2; ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 20, 11)) ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 21, 11)) - -pl2 = pl0; ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 21, 11)) ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 19, 11)) - -pl2 = pl1; ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 21, 11)) ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 20, 11)) - -function fn2(pl0: PromiseLike, pl1: PromiseLike>, pl2: PromiseLike) { ->fn2 : Symbol(fn2, Decl(awaitedVariance.ts, 27, 10)) ->T : Symbol(T, Decl(awaitedVariance.ts, 29, 13)) ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 29, 16)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) ->T : Symbol(T, Decl(awaitedVariance.ts, 29, 13)) ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 29, 36)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) ->T : Symbol(T, Decl(awaitedVariance.ts, 29, 13)) ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 29, 70)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) ->T : Symbol(T, Decl(awaitedVariance.ts, 29, 13)) - - pl0 = pl1; ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 29, 16)) ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 29, 36)) - - pl0 = pl2; ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 29, 16)) ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 29, 70)) - - pl1 = pl0; ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 29, 36)) ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 29, 16)) - - pl1 = pl2; ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 29, 36)) ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 29, 70)) - - pl2 = pl0; ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 29, 70)) ->pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 29, 16)) - - pl2 = pl1; ->pl2 : Symbol(pl2, Decl(awaitedVariance.ts, 29, 70)) ->pl1 : Symbol(pl1, Decl(awaitedVariance.ts, 29, 36)) -} - pl0 = p0; >pl0 : Symbol(pl0, Decl(awaitedVariance.ts, 19, 11)) >p0 : Symbol(p0, Decl(awaitedVariance.ts, 0, 11)) @@ -188,228 +125,228 @@ pl2 = p2; >p2 : Symbol(p2, Decl(awaitedVariance.ts, 2, 11)) interface A { ->A : Symbol(A, Decl(awaitedVariance.ts, 46, 9)) ->T : Symbol(T, Decl(awaitedVariance.ts, 48, 12)) +>A : Symbol(A, Decl(awaitedVariance.ts, 30, 9)) +>T : Symbol(T, Decl(awaitedVariance.ts, 32, 12)) x: awaited T; ->x : Symbol(A.x, Decl(awaitedVariance.ts, 48, 16)) ->T : Symbol(T, Decl(awaitedVariance.ts, 48, 12)) +>x : Symbol(A.x, Decl(awaitedVariance.ts, 32, 16)) +>T : Symbol(T, Decl(awaitedVariance.ts, 32, 12)) } declare let a1: A; ->a1 : Symbol(a1, Decl(awaitedVariance.ts, 52, 11)) ->A : Symbol(A, Decl(awaitedVariance.ts, 46, 9)) +>a1 : Symbol(a1, Decl(awaitedVariance.ts, 36, 11)) +>A : Symbol(A, Decl(awaitedVariance.ts, 30, 9)) declare let a2: A>; ->a2 : Symbol(a2, Decl(awaitedVariance.ts, 53, 11)) ->A : Symbol(A, Decl(awaitedVariance.ts, 46, 9)) +>a2 : Symbol(a2, Decl(awaitedVariance.ts, 37, 11)) +>A : Symbol(A, Decl(awaitedVariance.ts, 30, 9)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) a1 = a2; ->a1 : Symbol(a1, Decl(awaitedVariance.ts, 52, 11)) ->a2 : Symbol(a2, Decl(awaitedVariance.ts, 53, 11)) +>a1 : Symbol(a1, Decl(awaitedVariance.ts, 36, 11)) +>a2 : Symbol(a2, Decl(awaitedVariance.ts, 37, 11)) a2 = a1; ->a2 : Symbol(a2, Decl(awaitedVariance.ts, 53, 11)) ->a1 : Symbol(a1, Decl(awaitedVariance.ts, 52, 11)) +>a2 : Symbol(a2, Decl(awaitedVariance.ts, 37, 11)) +>a1 : Symbol(a1, Decl(awaitedVariance.ts, 36, 11)) interface B { ->B : Symbol(B, Decl(awaitedVariance.ts, 55, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 57, 12)) +>B : Symbol(B, Decl(awaitedVariance.ts, 39, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 41, 12)) a: A; ->a : Symbol(B.a, Decl(awaitedVariance.ts, 57, 16)) ->A : Symbol(A, Decl(awaitedVariance.ts, 46, 9)) ->T : Symbol(T, Decl(awaitedVariance.ts, 57, 12)) +>a : Symbol(B.a, Decl(awaitedVariance.ts, 41, 16)) +>A : Symbol(A, Decl(awaitedVariance.ts, 30, 9)) +>T : Symbol(T, Decl(awaitedVariance.ts, 41, 12)) } declare let b1: B; ->b1 : Symbol(b1, Decl(awaitedVariance.ts, 61, 11)) ->B : Symbol(B, Decl(awaitedVariance.ts, 55, 8)) +>b1 : Symbol(b1, Decl(awaitedVariance.ts, 45, 11)) +>B : Symbol(B, Decl(awaitedVariance.ts, 39, 8)) declare let b2: B>; ->b2 : Symbol(b2, Decl(awaitedVariance.ts, 62, 11)) ->B : Symbol(B, Decl(awaitedVariance.ts, 55, 8)) +>b2 : Symbol(b2, Decl(awaitedVariance.ts, 46, 11)) +>B : Symbol(B, Decl(awaitedVariance.ts, 39, 8)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) b1 = b2; ->b1 : Symbol(b1, Decl(awaitedVariance.ts, 61, 11)) ->b2 : Symbol(b2, Decl(awaitedVariance.ts, 62, 11)) +>b1 : Symbol(b1, Decl(awaitedVariance.ts, 45, 11)) +>b2 : Symbol(b2, Decl(awaitedVariance.ts, 46, 11)) b2 = b1; ->b2 : Symbol(b2, Decl(awaitedVariance.ts, 62, 11)) ->b1 : Symbol(b1, Decl(awaitedVariance.ts, 61, 11)) +>b2 : Symbol(b2, Decl(awaitedVariance.ts, 46, 11)) +>b1 : Symbol(b1, Decl(awaitedVariance.ts, 45, 11)) interface C { ->C : Symbol(C, Decl(awaitedVariance.ts, 64, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 66, 12)) +>C : Symbol(C, Decl(awaitedVariance.ts, 48, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 50, 12)) x: awaited ({_tag: string} & T); ->x : Symbol(C.x, Decl(awaitedVariance.ts, 66, 16)) ->_tag : Symbol(_tag, Decl(awaitedVariance.ts, 67, 17)) ->T : Symbol(T, Decl(awaitedVariance.ts, 66, 12)) +>x : Symbol(C.x, Decl(awaitedVariance.ts, 50, 16)) +>_tag : Symbol(_tag, Decl(awaitedVariance.ts, 51, 17)) +>T : Symbol(T, Decl(awaitedVariance.ts, 50, 12)) } declare let c1: C; ->c1 : Symbol(c1, Decl(awaitedVariance.ts, 70, 11)) ->C : Symbol(C, Decl(awaitedVariance.ts, 64, 8)) +>c1 : Symbol(c1, Decl(awaitedVariance.ts, 54, 11)) +>C : Symbol(C, Decl(awaitedVariance.ts, 48, 8)) declare let c2: C>; ->c2 : Symbol(c2, Decl(awaitedVariance.ts, 71, 11)) ->C : Symbol(C, Decl(awaitedVariance.ts, 64, 8)) +>c2 : Symbol(c2, Decl(awaitedVariance.ts, 55, 11)) +>C : Symbol(C, Decl(awaitedVariance.ts, 48, 8)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) // Not assignable since `awaited ({_tag: string} & Promise)` is `number`, which isn't assignable to `({_tag: string} & number)`. c1 = c2; ->c1 : Symbol(c1, Decl(awaitedVariance.ts, 70, 11)) ->c2 : Symbol(c2, Decl(awaitedVariance.ts, 71, 11)) +>c1 : Symbol(c1, Decl(awaitedVariance.ts, 54, 11)) +>c2 : Symbol(c2, Decl(awaitedVariance.ts, 55, 11)) c2 = c1; ->c2 : Symbol(c2, Decl(awaitedVariance.ts, 71, 11)) ->c1 : Symbol(c1, Decl(awaitedVariance.ts, 70, 11)) +>c2 : Symbol(c2, Decl(awaitedVariance.ts, 55, 11)) +>c1 : Symbol(c1, Decl(awaitedVariance.ts, 54, 11)) interface D { ->D : Symbol(D, Decl(awaitedVariance.ts, 74, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 76, 12)) +>D : Symbol(D, Decl(awaitedVariance.ts, 58, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 60, 12)) a: C; ->a : Symbol(D.a, Decl(awaitedVariance.ts, 76, 16)) ->C : Symbol(C, Decl(awaitedVariance.ts, 64, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 76, 12)) +>a : Symbol(D.a, Decl(awaitedVariance.ts, 60, 16)) +>C : Symbol(C, Decl(awaitedVariance.ts, 48, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 60, 12)) } declare let d1: D; ->d1 : Symbol(d1, Decl(awaitedVariance.ts, 80, 11)) ->D : Symbol(D, Decl(awaitedVariance.ts, 74, 8)) +>d1 : Symbol(d1, Decl(awaitedVariance.ts, 64, 11)) +>D : Symbol(D, Decl(awaitedVariance.ts, 58, 8)) declare let d2: D>; ->d2 : Symbol(d2, Decl(awaitedVariance.ts, 81, 11)) ->D : Symbol(D, Decl(awaitedVariance.ts, 74, 8)) +>d2 : Symbol(d2, Decl(awaitedVariance.ts, 65, 11)) +>D : Symbol(D, Decl(awaitedVariance.ts, 58, 8)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) // Not assignable since `awaited ({_tag: string} & Promise)` is `number`, which isn't assignable to `({_tag: string} & number)`. d1 = d2; ->d1 : Symbol(d1, Decl(awaitedVariance.ts, 80, 11)) ->d2 : Symbol(d2, Decl(awaitedVariance.ts, 81, 11)) +>d1 : Symbol(d1, Decl(awaitedVariance.ts, 64, 11)) +>d2 : Symbol(d2, Decl(awaitedVariance.ts, 65, 11)) d2 = d1; ->d2 : Symbol(d2, Decl(awaitedVariance.ts, 81, 11)) ->d1 : Symbol(d1, Decl(awaitedVariance.ts, 80, 11)) +>d2 : Symbol(d2, Decl(awaitedVariance.ts, 65, 11)) +>d1 : Symbol(d1, Decl(awaitedVariance.ts, 64, 11)) interface E { ->E : Symbol(E, Decl(awaitedVariance.ts, 84, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 86, 12)) +>E : Symbol(E, Decl(awaitedVariance.ts, 68, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 70, 12)) x: awaited (T | {otherOption: string}); ->x : Symbol(E.x, Decl(awaitedVariance.ts, 86, 16)) ->T : Symbol(T, Decl(awaitedVariance.ts, 86, 12)) ->otherOption : Symbol(otherOption, Decl(awaitedVariance.ts, 87, 21)) +>x : Symbol(E.x, Decl(awaitedVariance.ts, 70, 16)) +>T : Symbol(T, Decl(awaitedVariance.ts, 70, 12)) +>otherOption : Symbol(otherOption, Decl(awaitedVariance.ts, 71, 21)) } declare let e1: E; ->e1 : Symbol(e1, Decl(awaitedVariance.ts, 90, 11)) ->E : Symbol(E, Decl(awaitedVariance.ts, 84, 8)) +>e1 : Symbol(e1, Decl(awaitedVariance.ts, 74, 11)) +>E : Symbol(E, Decl(awaitedVariance.ts, 68, 8)) declare let e2: E>; ->e2 : Symbol(e2, Decl(awaitedVariance.ts, 91, 11)) ->E : Symbol(E, Decl(awaitedVariance.ts, 84, 8)) +>e2 : Symbol(e2, Decl(awaitedVariance.ts, 75, 11)) +>E : Symbol(E, Decl(awaitedVariance.ts, 68, 8)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) e1 = e2; ->e1 : Symbol(e1, Decl(awaitedVariance.ts, 90, 11)) ->e2 : Symbol(e2, Decl(awaitedVariance.ts, 91, 11)) +>e1 : Symbol(e1, Decl(awaitedVariance.ts, 74, 11)) +>e2 : Symbol(e2, Decl(awaitedVariance.ts, 75, 11)) e2 = e1; ->e2 : Symbol(e2, Decl(awaitedVariance.ts, 91, 11)) ->e1 : Symbol(e1, Decl(awaitedVariance.ts, 90, 11)) +>e2 : Symbol(e2, Decl(awaitedVariance.ts, 75, 11)) +>e1 : Symbol(e1, Decl(awaitedVariance.ts, 74, 11)) interface F { ->F : Symbol(F, Decl(awaitedVariance.ts, 93, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 95, 12)) +>F : Symbol(F, Decl(awaitedVariance.ts, 77, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 79, 12)) a: E; ->a : Symbol(F.a, Decl(awaitedVariance.ts, 95, 16)) ->E : Symbol(E, Decl(awaitedVariance.ts, 84, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 95, 12)) +>a : Symbol(F.a, Decl(awaitedVariance.ts, 79, 16)) +>E : Symbol(E, Decl(awaitedVariance.ts, 68, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 79, 12)) } declare let f1: F; ->f1 : Symbol(f1, Decl(awaitedVariance.ts, 99, 11)) ->F : Symbol(F, Decl(awaitedVariance.ts, 93, 8)) +>f1 : Symbol(f1, Decl(awaitedVariance.ts, 83, 11)) +>F : Symbol(F, Decl(awaitedVariance.ts, 77, 8)) declare let f2: F>; ->f2 : Symbol(f2, Decl(awaitedVariance.ts, 100, 11)) ->F : Symbol(F, Decl(awaitedVariance.ts, 93, 8)) +>f2 : Symbol(f2, Decl(awaitedVariance.ts, 84, 11)) +>F : Symbol(F, Decl(awaitedVariance.ts, 77, 8)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) f1 = f2; ->f1 : Symbol(f1, Decl(awaitedVariance.ts, 99, 11)) ->f2 : Symbol(f2, Decl(awaitedVariance.ts, 100, 11)) +>f1 : Symbol(f1, Decl(awaitedVariance.ts, 83, 11)) +>f2 : Symbol(f2, Decl(awaitedVariance.ts, 84, 11)) f2 = f1; ->f2 : Symbol(f2, Decl(awaitedVariance.ts, 100, 11)) ->f1 : Symbol(f1, Decl(awaitedVariance.ts, 99, 11)) +>f2 : Symbol(f2, Decl(awaitedVariance.ts, 84, 11)) +>f1 : Symbol(f1, Decl(awaitedVariance.ts, 83, 11)) interface G { ->G : Symbol(G, Decl(awaitedVariance.ts, 102, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 104, 12)) ->K : Symbol(K, Decl(awaitedVariance.ts, 104, 14)) ->T : Symbol(T, Decl(awaitedVariance.ts, 104, 12)) +>G : Symbol(G, Decl(awaitedVariance.ts, 86, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 88, 12)) +>K : Symbol(K, Decl(awaitedVariance.ts, 88, 14)) +>T : Symbol(T, Decl(awaitedVariance.ts, 88, 12)) x: awaited T[K]; ->x : Symbol(G.x, Decl(awaitedVariance.ts, 104, 35)) ->T : Symbol(T, Decl(awaitedVariance.ts, 104, 12)) ->K : Symbol(K, Decl(awaitedVariance.ts, 104, 14)) +>x : Symbol(G.x, Decl(awaitedVariance.ts, 88, 35)) +>T : Symbol(T, Decl(awaitedVariance.ts, 88, 12)) +>K : Symbol(K, Decl(awaitedVariance.ts, 88, 14)) } declare let g1: G<{x: number}, "x">; ->g1 : Symbol(g1, Decl(awaitedVariance.ts, 108, 11)) ->G : Symbol(G, Decl(awaitedVariance.ts, 102, 8)) ->x : Symbol(x, Decl(awaitedVariance.ts, 108, 19)) +>g1 : Symbol(g1, Decl(awaitedVariance.ts, 92, 11)) +>G : Symbol(G, Decl(awaitedVariance.ts, 86, 8)) +>x : Symbol(x, Decl(awaitedVariance.ts, 92, 19)) declare let g2: G<{x: Promise}, "x">; ->g2 : Symbol(g2, Decl(awaitedVariance.ts, 109, 11)) ->G : Symbol(G, Decl(awaitedVariance.ts, 102, 8)) ->x : Symbol(x, Decl(awaitedVariance.ts, 109, 19)) +>g2 : Symbol(g2, Decl(awaitedVariance.ts, 93, 11)) +>G : Symbol(G, Decl(awaitedVariance.ts, 86, 8)) +>x : Symbol(x, Decl(awaitedVariance.ts, 93, 19)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) g1 = g2; ->g1 : Symbol(g1, Decl(awaitedVariance.ts, 108, 11)) ->g2 : Symbol(g2, Decl(awaitedVariance.ts, 109, 11)) +>g1 : Symbol(g1, Decl(awaitedVariance.ts, 92, 11)) +>g2 : Symbol(g2, Decl(awaitedVariance.ts, 93, 11)) g2 = g1; ->g2 : Symbol(g2, Decl(awaitedVariance.ts, 109, 11)) ->g1 : Symbol(g1, Decl(awaitedVariance.ts, 108, 11)) +>g2 : Symbol(g2, Decl(awaitedVariance.ts, 93, 11)) +>g1 : Symbol(g1, Decl(awaitedVariance.ts, 92, 11)) interface H { ->H : Symbol(H, Decl(awaitedVariance.ts, 111, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 113, 12)) ->K : Symbol(K, Decl(awaitedVariance.ts, 113, 14)) ->T : Symbol(T, Decl(awaitedVariance.ts, 113, 12)) +>H : Symbol(H, Decl(awaitedVariance.ts, 95, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 97, 12)) +>K : Symbol(K, Decl(awaitedVariance.ts, 97, 14)) +>T : Symbol(T, Decl(awaitedVariance.ts, 97, 12)) a: G; ->a : Symbol(H.a, Decl(awaitedVariance.ts, 113, 35)) ->G : Symbol(G, Decl(awaitedVariance.ts, 102, 8)) ->T : Symbol(T, Decl(awaitedVariance.ts, 113, 12)) ->K : Symbol(K, Decl(awaitedVariance.ts, 113, 14)) +>a : Symbol(H.a, Decl(awaitedVariance.ts, 97, 35)) +>G : Symbol(G, Decl(awaitedVariance.ts, 86, 8)) +>T : Symbol(T, Decl(awaitedVariance.ts, 97, 12)) +>K : Symbol(K, Decl(awaitedVariance.ts, 97, 14)) } declare let h1: H<{x: number}, "x">; ->h1 : Symbol(h1, Decl(awaitedVariance.ts, 117, 11)) ->H : Symbol(H, Decl(awaitedVariance.ts, 111, 8)) ->x : Symbol(x, Decl(awaitedVariance.ts, 117, 19)) +>h1 : Symbol(h1, Decl(awaitedVariance.ts, 101, 11)) +>H : Symbol(H, Decl(awaitedVariance.ts, 95, 8)) +>x : Symbol(x, Decl(awaitedVariance.ts, 101, 19)) declare let h2: H<{x: Promise}, "x">; ->h2 : Symbol(h2, Decl(awaitedVariance.ts, 118, 11)) ->H : Symbol(H, Decl(awaitedVariance.ts, 111, 8)) ->x : Symbol(x, Decl(awaitedVariance.ts, 118, 19)) +>h2 : Symbol(h2, Decl(awaitedVariance.ts, 102, 11)) +>H : Symbol(H, Decl(awaitedVariance.ts, 95, 8)) +>x : Symbol(x, Decl(awaitedVariance.ts, 102, 19)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) h1 = h2; ->h1 : Symbol(h1, Decl(awaitedVariance.ts, 117, 11)) ->h2 : Symbol(h2, Decl(awaitedVariance.ts, 118, 11)) +>h1 : Symbol(h1, Decl(awaitedVariance.ts, 101, 11)) +>h2 : Symbol(h2, Decl(awaitedVariance.ts, 102, 11)) h2 = h1; ->h2 : Symbol(h2, Decl(awaitedVariance.ts, 118, 11)) ->h1 : Symbol(h1, Decl(awaitedVariance.ts, 117, 11)) +>h2 : Symbol(h2, Decl(awaitedVariance.ts, 102, 11)) +>h1 : Symbol(h1, Decl(awaitedVariance.ts, 101, 11)) diff --git a/tests/baselines/reference/awaitedVariance.types b/tests/baselines/reference/awaitedVariance.types index a063fb380caa0..94b94363cd392 100644 --- a/tests/baselines/reference/awaitedVariance.types +++ b/tests/baselines/reference/awaitedVariance.types @@ -84,73 +84,6 @@ declare let pl1: PromiseLike>; declare let pl2: PromiseLike; >pl2 : PromiseLike -pl0 = pl1; ->pl0 = pl1 : PromiseLike> ->pl0 : PromiseLike ->pl1 : PromiseLike> - -pl0 = pl2; ->pl0 = pl2 : PromiseLike ->pl0 : PromiseLike ->pl2 : PromiseLike - -pl1 = pl0; ->pl1 = pl0 : PromiseLike ->pl1 : PromiseLike> ->pl0 : PromiseLike - -pl1 = pl2; ->pl1 = pl2 : PromiseLike ->pl1 : PromiseLike> ->pl2 : PromiseLike - -pl2 = pl0; ->pl2 = pl0 : PromiseLike ->pl2 : PromiseLike ->pl0 : PromiseLike - -pl2 = pl1; ->pl2 = pl1 : PromiseLike> ->pl2 : PromiseLike ->pl1 : PromiseLike> - -function fn2(pl0: PromiseLike, pl1: PromiseLike>, pl2: PromiseLike) { ->fn2 : (pl0: PromiseLike, pl1: PromiseLike>, pl2: PromiseLike) => void ->pl0 : PromiseLike ->pl1 : PromiseLike> ->pl2 : PromiseLike - - pl0 = pl1; ->pl0 = pl1 : PromiseLike> ->pl0 : PromiseLike ->pl1 : PromiseLike> - - pl0 = pl2; ->pl0 = pl2 : PromiseLike ->pl0 : PromiseLike ->pl2 : PromiseLike - - pl1 = pl0; ->pl1 = pl0 : PromiseLike ->pl1 : PromiseLike> ->pl0 : PromiseLike - - pl1 = pl2; ->pl1 = pl2 : PromiseLike ->pl1 : PromiseLike> ->pl2 : PromiseLike - - pl2 = pl0; ->pl2 = pl0 : PromiseLike ->pl2 : PromiseLike ->pl0 : PromiseLike - - pl2 = pl1; ->pl2 = pl1 : PromiseLike> ->pl2 : PromiseLike ->pl1 : PromiseLike> -} - pl0 = p0; >pl0 = p0 : Promise >pl0 : PromiseLike diff --git a/tests/cases/conformance/types/awaited/awaitedVariance.ts b/tests/cases/conformance/types/awaited/awaitedVariance.ts index 6aa4584412daf..4476a2f45b632 100644 --- a/tests/cases/conformance/types/awaited/awaitedVariance.ts +++ b/tests/cases/conformance/types/awaited/awaitedVariance.ts @@ -22,22 +22,6 @@ function fn1(p0: Promise, p1: Promise>, p2: Promise) declare let pl0: PromiseLike; declare let pl1: PromiseLike>; declare let pl2: PromiseLike; -pl0 = pl1; -pl0 = pl2; -pl1 = pl0; -pl1 = pl2; -pl2 = pl0; -pl2 = pl1; - -function fn2(pl0: PromiseLike, pl1: PromiseLike>, pl2: PromiseLike) { - pl0 = pl1; - pl0 = pl2; - pl1 = pl0; - pl1 = pl2; - pl2 = pl0; - pl2 = pl1; -} - pl0 = p0; pl0 = p1; pl0 = p2;