* new_tests * move_all_clobbered_tests * remove all the tests that no longer exist * re-run flow tests * Move all the flow tests to tests/flow and prettier to tests/ * Move prettier tests to their own folders * Add jsfmt files * run prettier snapshot tests
33 lines
435 B
JavaScript
33 lines
435 B
JavaScript
/* @flow */
|
|
|
|
function foo(x : ?number) {
|
|
var y;
|
|
if (y = x) {
|
|
var z = y * 1000;
|
|
}
|
|
}
|
|
|
|
type Bar = {
|
|
parent: ?Bar;
|
|
doStuff: () => void
|
|
}
|
|
|
|
function bar0(x : Bar) {
|
|
while (x = x.parent) { // can't assign x to ?Bar
|
|
x.doStuff();
|
|
}
|
|
}
|
|
|
|
function bar1(x : ?Bar) {
|
|
while (x = x.parent) { // x.parent might be null
|
|
x.doStuff();
|
|
}
|
|
}
|
|
|
|
function bar2(x : Bar) {
|
|
var y = x;
|
|
while (y = y.parent) {
|
|
y.doStuff();
|
|
}
|
|
}
|