|
| 1 | +//// [tests/cases/compiler/promiseTypeInferenceUnion.ts] //// |
| 2 | + |
| 3 | +=== promiseTypeInferenceUnion.ts === |
| 4 | +function f1(x: number): number | Promise<number> { |
| 5 | +>f1 : Symbol(f1, Decl(promiseTypeInferenceUnion.ts, 0, 0)) |
| 6 | +>x : Symbol(x, Decl(promiseTypeInferenceUnion.ts, 0, 12)) |
| 7 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 8 | + |
| 9 | + return Promise.resolve(x); |
| 10 | +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 11 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 12 | +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 13 | +>x : Symbol(x, Decl(promiseTypeInferenceUnion.ts, 0, 12)) |
| 14 | +} |
| 15 | + |
| 16 | +function f2(x: number): number | PromiseLike<number> { |
| 17 | +>f2 : Symbol(f2, Decl(promiseTypeInferenceUnion.ts, 2, 1)) |
| 18 | +>x : Symbol(x, Decl(promiseTypeInferenceUnion.ts, 4, 12)) |
| 19 | +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) |
| 20 | + |
| 21 | + return Promise.resolve(x); |
| 22 | +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 23 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 24 | +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 25 | +>x : Symbol(x, Decl(promiseTypeInferenceUnion.ts, 4, 12)) |
| 26 | +} |
| 27 | + |
| 28 | +function f3(x: number): number | Promise<number> | PromiseLike<number> { |
| 29 | +>f3 : Symbol(f3, Decl(promiseTypeInferenceUnion.ts, 6, 1)) |
| 30 | +>x : Symbol(x, Decl(promiseTypeInferenceUnion.ts, 8, 12)) |
| 31 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 32 | +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) |
| 33 | + |
| 34 | + return Promise.resolve(x); |
| 35 | +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 36 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 37 | +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 38 | +>x : Symbol(x, Decl(promiseTypeInferenceUnion.ts, 8, 12)) |
| 39 | +} |
| 40 | + |
| 41 | +const g1: Promise<number> = Promise.resolve(f1(42)); |
| 42 | +>g1 : Symbol(g1, Decl(promiseTypeInferenceUnion.ts, 12, 5)) |
| 43 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 44 | +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 45 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 46 | +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 47 | +>f1 : Symbol(f1, Decl(promiseTypeInferenceUnion.ts, 0, 0)) |
| 48 | + |
| 49 | +const g2: Promise<number> = Promise.resolve(f2(42)); |
| 50 | +>g2 : Symbol(g2, Decl(promiseTypeInferenceUnion.ts, 13, 5)) |
| 51 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 52 | +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 53 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 54 | +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 55 | +>f2 : Symbol(f2, Decl(promiseTypeInferenceUnion.ts, 2, 1)) |
| 56 | + |
| 57 | +const g3: Promise<number> = Promise.resolve(f3(42)); |
| 58 | +>g3 : Symbol(g3, Decl(promiseTypeInferenceUnion.ts, 14, 5)) |
| 59 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 60 | +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 61 | +>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, --, --), Decl(lib.es2018.promise.d.ts, --, --)) |
| 62 | +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) |
| 63 | +>f3 : Symbol(f3, Decl(promiseTypeInferenceUnion.ts, 6, 1)) |
| 64 | + |
0 commit comments