facebook / facebook/flow

Refinement should be lost after function call in loop

Open
#3,054 0 comments 2 reactions 0 assignees View on GitHub
bug Typing: refinements
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

This code is wrong but Flow 0.37 gives no errors:

```js
/* @flow */

var x : {y : ?Function} = {
y: function() {
x.y = null;
},
};

if (x.y) {
for (const a of [1, 2, 3]) {
x.y();
}
}
```

https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVA3AhgJzADzAC4wBvAT2LAH4AxAVwDsBjAFwEs5GBfMAXjKowYciShM2nRgAoAlIOHD8AOkoDG9GDADcQsNwA0qbrtTsoYaSvLzSeqHDzTmXAM6swWMHAsBtAIwGYABMQQDMALq2ekqqcrrC3MaoQA

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.