2018-08-28 20:43:45 +02:00
|
|
|
// @strict: true
|
2017-09-13 18:02:33 +02:00
|
|
|
// @noUnusedLocals: true
|
|
|
|
// @noUnusedParameters: true
|
|
|
|
|
2018-08-28 20:43:45 +02:00
|
|
|
function f(x = 0, b = false) {
|
|
|
|
// None of these statements read from 'x', so it will be marked unused.
|
2017-09-13 18:02:33 +02:00
|
|
|
x = 1;
|
|
|
|
x++;
|
|
|
|
x /= 2;
|
2018-08-28 20:43:45 +02:00
|
|
|
([x] = [1]);
|
|
|
|
({ x } = { x: 1 });
|
|
|
|
({ x: x } = { x: 1 });
|
|
|
|
({ a: [{ b: x }] } = { a: [{ b: 1 }] });
|
|
|
|
({ x = 2 } = { x: b ? 1 : undefined });
|
|
|
|
let used = 1;
|
|
|
|
({ x = used } = { x: b ? 1 : undefined });
|
2017-09-13 18:02:33 +02:00
|
|
|
|
|
|
|
let y = 0;
|
|
|
|
// This is a write access to y, but not a write-*only* access.
|
|
|
|
f(y++);
|
2018-08-13 20:14:52 +02:00
|
|
|
|
|
|
|
let z = 0;
|
|
|
|
f(z = 1); // This effectively doesn't use `z`, values just pass through it.
|
2017-09-13 18:02:33 +02:00
|
|
|
}
|
2018-08-28 20:43:45 +02:00
|
|
|
function f2(_: ReadonlyArray<number>): void {}
|