|
| 1 | +//// [tests/cases/compiler/forAwaitForIntersection1.ts] //// |
| 2 | + |
| 3 | +=== forAwaitForIntersection1.ts === |
| 4 | +type Stream1<T_Sync, T_Async> = Iterable<T_Sync> & AsyncIterable<T_Async>; |
| 5 | +>Stream1 : Symbol(Stream1, Decl(forAwaitForIntersection1.ts, 0, 0)) |
| 6 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 0, 13)) |
| 7 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 0, 20)) |
| 8 | +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 9 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 0, 13)) |
| 10 | +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2018.asynciterable.d.ts, --, --)) |
| 11 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 0, 20)) |
| 12 | + |
| 13 | +class A1 {} |
| 14 | +>A1 : Symbol(A1, Decl(forAwaitForIntersection1.ts, 0, 74)) |
| 15 | + |
| 16 | +class B1 {} |
| 17 | +>B1 : Symbol(B1, Decl(forAwaitForIntersection1.ts, 2, 11)) |
| 18 | + |
| 19 | +async function loop1(stream: Stream1<A1, B1>) { |
| 20 | +>loop1 : Symbol(loop1, Decl(forAwaitForIntersection1.ts, 3, 11)) |
| 21 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 5, 21)) |
| 22 | +>Stream1 : Symbol(Stream1, Decl(forAwaitForIntersection1.ts, 0, 0)) |
| 23 | +>A1 : Symbol(A1, Decl(forAwaitForIntersection1.ts, 0, 74)) |
| 24 | +>B1 : Symbol(B1, Decl(forAwaitForIntersection1.ts, 2, 11)) |
| 25 | + |
| 26 | + for await (const b of stream) {} |
| 27 | +>b : Symbol(b, Decl(forAwaitForIntersection1.ts, 6, 18)) |
| 28 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 5, 21)) |
| 29 | +} |
| 30 | + |
| 31 | +type Stream2<T_Sync, T_Async> = Iterable<T_Sync> & AsyncIterable<T_Async>; |
| 32 | +>Stream2 : Symbol(Stream2, Decl(forAwaitForIntersection1.ts, 7, 1)) |
| 33 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 9, 13)) |
| 34 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 9, 20)) |
| 35 | +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 36 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 9, 13)) |
| 37 | +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2018.asynciterable.d.ts, --, --)) |
| 38 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 9, 20)) |
| 39 | + |
| 40 | +class A2 {} |
| 41 | +>A2 : Symbol(A2, Decl(forAwaitForIntersection1.ts, 9, 74)) |
| 42 | + |
| 43 | +class B2 {} |
| 44 | +>B2 : Symbol(B2, Decl(forAwaitForIntersection1.ts, 11, 11)) |
| 45 | + |
| 46 | +async function loop2(stream: Stream2<A2, B2>) { |
| 47 | +>loop2 : Symbol(loop2, Decl(forAwaitForIntersection1.ts, 12, 11)) |
| 48 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 14, 21)) |
| 49 | +>Stream2 : Symbol(Stream2, Decl(forAwaitForIntersection1.ts, 7, 1)) |
| 50 | +>A2 : Symbol(A2, Decl(forAwaitForIntersection1.ts, 9, 74)) |
| 51 | +>B2 : Symbol(B2, Decl(forAwaitForIntersection1.ts, 11, 11)) |
| 52 | + |
| 53 | + for (const a of stream) {} |
| 54 | +>a : Symbol(a, Decl(forAwaitForIntersection1.ts, 15, 12)) |
| 55 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 14, 21)) |
| 56 | +} |
| 57 | + |
| 58 | +type Stream3<T_Sync, T_Async> = Iterable<T_Sync> & AsyncIterable<T_Async>; |
| 59 | +>Stream3 : Symbol(Stream3, Decl(forAwaitForIntersection1.ts, 16, 1)) |
| 60 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 18, 13)) |
| 61 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 18, 20)) |
| 62 | +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 63 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 18, 13)) |
| 64 | +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2018.asynciterable.d.ts, --, --)) |
| 65 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 18, 20)) |
| 66 | + |
| 67 | +class A3 {} |
| 68 | +>A3 : Symbol(A3, Decl(forAwaitForIntersection1.ts, 18, 74)) |
| 69 | + |
| 70 | +class B3 {} |
| 71 | +>B3 : Symbol(B3, Decl(forAwaitForIntersection1.ts, 20, 11)) |
| 72 | + |
| 73 | +async function loop3(stream: Stream3<A3, B3>) { |
| 74 | +>loop3 : Symbol(loop3, Decl(forAwaitForIntersection1.ts, 21, 11)) |
| 75 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 23, 21)) |
| 76 | +>Stream3 : Symbol(Stream3, Decl(forAwaitForIntersection1.ts, 16, 1)) |
| 77 | +>A3 : Symbol(A3, Decl(forAwaitForIntersection1.ts, 18, 74)) |
| 78 | +>B3 : Symbol(B3, Decl(forAwaitForIntersection1.ts, 20, 11)) |
| 79 | + |
| 80 | + for await (const b of stream) {} |
| 81 | +>b : Symbol(b, Decl(forAwaitForIntersection1.ts, 24, 18)) |
| 82 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 23, 21)) |
| 83 | + |
| 84 | + for (const a of stream) {} |
| 85 | +>a : Symbol(a, Decl(forAwaitForIntersection1.ts, 26, 12)) |
| 86 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 23, 21)) |
| 87 | +} |
| 88 | + |
| 89 | +type Stream4<T_Sync, T_Async> = Iterable<T_Sync> & AsyncIterable<T_Async>; |
| 90 | +>Stream4 : Symbol(Stream4, Decl(forAwaitForIntersection1.ts, 27, 1)) |
| 91 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 29, 13)) |
| 92 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 29, 20)) |
| 93 | +>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --)) |
| 94 | +>T_Sync : Symbol(T_Sync, Decl(forAwaitForIntersection1.ts, 29, 13)) |
| 95 | +>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2018.asynciterable.d.ts, --, --)) |
| 96 | +>T_Async : Symbol(T_Async, Decl(forAwaitForIntersection1.ts, 29, 20)) |
| 97 | + |
| 98 | +class A4 {} |
| 99 | +>A4 : Symbol(A4, Decl(forAwaitForIntersection1.ts, 29, 74)) |
| 100 | + |
| 101 | +class B4 {} |
| 102 | +>B4 : Symbol(B4, Decl(forAwaitForIntersection1.ts, 31, 11)) |
| 103 | + |
| 104 | +// verify that resolving sync iteration first doesn't spoil the type for async iteration |
| 105 | +async function loop4(stream: Stream4<A4, B4>) { |
| 106 | +>loop4 : Symbol(loop4, Decl(forAwaitForIntersection1.ts, 32, 11)) |
| 107 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 35, 21)) |
| 108 | +>Stream4 : Symbol(Stream4, Decl(forAwaitForIntersection1.ts, 27, 1)) |
| 109 | +>A4 : Symbol(A4, Decl(forAwaitForIntersection1.ts, 29, 74)) |
| 110 | +>B4 : Symbol(B4, Decl(forAwaitForIntersection1.ts, 31, 11)) |
| 111 | + |
| 112 | + for (const a of stream) {} |
| 113 | +>a : Symbol(a, Decl(forAwaitForIntersection1.ts, 36, 12)) |
| 114 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 35, 21)) |
| 115 | + |
| 116 | + for await (const b of stream) {} |
| 117 | +>b : Symbol(b, Decl(forAwaitForIntersection1.ts, 38, 18)) |
| 118 | +>stream : Symbol(stream, Decl(forAwaitForIntersection1.ts, 35, 21)) |
| 119 | +} |
0 commit comments