mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
d00e93c82c
Fixes: https://github.com/Roblox/luau/issues/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 <amccord@roblox.com> |
||
---|---|---|
.. | ||
include/Luau | ||
src |