-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Control Flow type Refinements for "break" and "continue" stat…
…ements (#1004) Fixes: #913 This PR adds support for type refinements around guard clauses that use `break` and `continue` statements inside a loop, similar to how guard clauses with `return` is supported. I had some free time today, so I figure I'd give a shot at a naïve fix for this at the very least. --- ## Resulting Change: Luau now supports type refinements within loops where a `continue` or `break` guard clause was used. For example: ```lua for _, object in objects :: {{value: string?}} do if not object.value then continue end local x: string = object.value -- OK; Used to emit "Type 'string?' could not be converted into 'string'" end ``` --------- Co-authored-by: Alexander McCord <[email protected]>
- Loading branch information
1 parent
3090010
commit d00e93c
Showing
4 changed files
with
786 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.