|
| 1 | +=== tests/cases/conformance/controlFlow/controlFlowNullishCoalesce.ts === |
| 2 | +// assignments in shortcutting rhs |
| 3 | +let a: number; |
| 4 | +>a : Symbol(a, Decl(controlFlowNullishCoalesce.ts, 1, 3)) |
| 5 | + |
| 6 | +o ?? (a = 1); |
| 7 | +>o : Symbol(o, Decl(controlFlowNullishCoalesce.ts, 6, 13)) |
| 8 | +>a : Symbol(a, Decl(controlFlowNullishCoalesce.ts, 1, 3)) |
| 9 | + |
| 10 | +a.toString(); |
| 11 | +>a.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) |
| 12 | +>a : Symbol(a, Decl(controlFlowNullishCoalesce.ts, 1, 3)) |
| 13 | +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) |
| 14 | + |
| 15 | +// assignment flow |
| 16 | +declare const o: { x: number } | undefined; |
| 17 | +>o : Symbol(o, Decl(controlFlowNullishCoalesce.ts, 6, 13)) |
| 18 | +>x : Symbol(x, Decl(controlFlowNullishCoalesce.ts, 6, 18)) |
| 19 | + |
| 20 | +let x: { x: number } | boolean; |
| 21 | +>x : Symbol(x, Decl(controlFlowNullishCoalesce.ts, 7, 3)) |
| 22 | +>x : Symbol(x, Decl(controlFlowNullishCoalesce.ts, 7, 8)) |
| 23 | + |
| 24 | +if (x = o ?? true) { |
| 25 | +>x : Symbol(x, Decl(controlFlowNullishCoalesce.ts, 7, 3)) |
| 26 | +>o : Symbol(o, Decl(controlFlowNullishCoalesce.ts, 6, 13)) |
| 27 | + |
| 28 | + x; |
| 29 | +>x : Symbol(x, Decl(controlFlowNullishCoalesce.ts, 7, 3)) |
| 30 | +} |
| 31 | + |
| 32 | + |
0 commit comments