Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced flow typing on while/break #97

Open
mascarenhas opened this issue Jul 16, 2016 · 0 comments
Open

enhanced flow typing on while/break #97

mascarenhas opened this issue Jul 16, 2016 · 0 comments

Comments

@mascarenhas
Copy link
Collaborator

Continuing on the theme of issue #96:

We can also have smarter flow typing on while loops if we track breaks:

while n do
    -- a block without breaks
end
-- we now that n is falsy here

If the break has been the result of a filter we can even propagate it outside the while:

while true do
    -- something something that does not break
    if not n then break end
    -- something something that does not break
end
-- we also now know n is falsy here

The first is relatively easy, the second requires more thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant