|
| 1 | +//// [tests/cases/compiler/genericCallAtYieldExpressionInGenericCall1.ts] //// |
| 2 | + |
| 3 | +=== genericCallAtYieldExpressionInGenericCall1.ts === |
| 4 | +declare const inner: { |
| 5 | +>inner : Symbol(inner, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 0, 13)) |
| 6 | + |
| 7 | + <A>(value: A): { |
| 8 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 1, 3)) |
| 9 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 1, 6)) |
| 10 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 1, 3)) |
| 11 | + |
| 12 | + (): A; |
| 13 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 1, 3)) |
| 14 | + |
| 15 | + [Symbol.iterator](): { |
| 16 | +>[Symbol.iterator] : Symbol([Symbol.iterator], Decl(genericCallAtYieldExpressionInGenericCall1.ts, 2, 10)) |
| 17 | +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 18 | +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --)) |
| 19 | +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 20 | + |
| 21 | + next(...args: ReadonlyArray<any>): IteratorResult<any, A>; |
| 22 | +>next : Symbol(next, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 3, 26)) |
| 23 | +>args : Symbol(args, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 4, 11)) |
| 24 | +>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 3 more) |
| 25 | +>IteratorResult : Symbol(IteratorResult, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 26 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 1, 3)) |
| 27 | + |
| 28 | + }; |
| 29 | + }; |
| 30 | +}; |
| 31 | + |
| 32 | +declare function outer<A>(body: (value: A) => Generator<any, any, any>): void; |
| 33 | +>outer : Symbol(outer, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 7, 2)) |
| 34 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 9, 23)) |
| 35 | +>body : Symbol(body, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 9, 26)) |
| 36 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 9, 33)) |
| 37 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 9, 23)) |
| 38 | +>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --)) |
| 39 | + |
| 40 | +outer(function* <T>(value: T) { |
| 41 | +>outer : Symbol(outer, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 7, 2)) |
| 42 | +>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 11, 17)) |
| 43 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 11, 20)) |
| 44 | +>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 11, 17)) |
| 45 | + |
| 46 | + const result = yield* inner(value); // ok |
| 47 | +>result : Symbol(result, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 12, 7)) |
| 48 | +>inner : Symbol(inner, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 0, 13)) |
| 49 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 11, 20)) |
| 50 | + |
| 51 | +}); |
| 52 | + |
| 53 | +outer(function* <T>(value: T) { |
| 54 | +>outer : Symbol(outer, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 7, 2)) |
| 55 | +>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 15, 17)) |
| 56 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 15, 20)) |
| 57 | +>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 15, 17)) |
| 58 | + |
| 59 | + const x = inner(value); |
| 60 | +>x : Symbol(x, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 16, 7)) |
| 61 | +>inner : Symbol(inner, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 0, 13)) |
| 62 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 15, 20)) |
| 63 | + |
| 64 | + const result = yield* x; // ok |
| 65 | +>result : Symbol(result, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 17, 7)) |
| 66 | +>x : Symbol(x, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 16, 7)) |
| 67 | + |
| 68 | +}); |
| 69 | + |
| 70 | +declare const inner2: { |
| 71 | +>inner2 : Symbol(inner2, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 20, 13)) |
| 72 | + |
| 73 | + <A>(value: A): () => A; |
| 74 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 21, 3)) |
| 75 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 21, 6)) |
| 76 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 21, 3)) |
| 77 | +>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 21, 3)) |
| 78 | + |
| 79 | +}; |
| 80 | + |
| 81 | +outer(function* <T>(value: T) { |
| 82 | +>outer : Symbol(outer, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 7, 2)) |
| 83 | +>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 24, 17)) |
| 84 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 24, 20)) |
| 85 | +>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 24, 17)) |
| 86 | + |
| 87 | + const result = yield* inner2(value); // error |
| 88 | +>result : Symbol(result, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 25, 7)) |
| 89 | +>inner2 : Symbol(inner2, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 20, 13)) |
| 90 | +>value : Symbol(value, Decl(genericCallAtYieldExpressionInGenericCall1.ts, 24, 20)) |
| 91 | + |
| 92 | +}); |
| 93 | + |
0 commit comments