mirror of
https://github.com/hanzoai/prettier.git
synced 2026-09-24 17:02:04 +00:00
33 lines
470 B
JavaScript
33 lines
470 B
JavaScript
// @flow
|
|
|
|
// Make sure that destructuring doesn't cause infinite loops when combined with
|
|
// funny doses of repositioning
|
|
|
|
let foo = (i: number) => [i];
|
|
|
|
const bar = (i: number) => {
|
|
[i] = foo(i);
|
|
return [i];
|
|
};
|
|
|
|
foo = (i: number) => {
|
|
return bar(i);
|
|
};
|
|
|
|
// Also make sure that the following doesn't loop
|
|
|
|
declare var o: empty;
|
|
var { x: o } = o;
|
|
|
|
// this also must not loop
|
|
|
|
declare var _x: {};
|
|
|
|
let x = _x;
|
|
|
|
function baz () {
|
|
const {...y} = x;
|
|
|
|
x = y;
|
|
}
|