-
Notifications
You must be signed in to change notification settings - Fork 391
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
next
function incorrectly typed
#706
Comments
We are preparing a fix for this issue internally, hopefully it gets fixed in one of the upcoming releases. There are some limitations of the current Luau inference engine that make this more complicated than it should be, but we have a work-around that should cover most cases. |
* Type inference of `a and b` and `a or b` has been improved (Fixes #730) * Improved error message when `for ... in x` loop iterates over a value that could be 'nil' * Return type of `next` not includes 'nil' (Fixes #706) * Improved type inference of `string` type * Luau library table type names are now reported as `typeof(string)`/etc instead of just `string` which was misleading * Added parsing error when optional type alias type parameter wasn't provided after `=` token * Improved tagged union type refinement in conditional expressions, type in `else` branch should no longer include previously handled union options
I've tested in luau 0.553 and the code still gets past luau-analyze without any type errors. It doesn't appear to be fixed local foo: number = next({"a"}) |
Unfortunately, flag for this fix was temporarily marked as an experimental flag.
This fix should be enabled by default in the 0.554 release. |
0.554 release is now available and this fix is no longer 'experimental'. |
* Type inference of `a and b` and `a or b` has been improved (Fixes luau-lang/luau#730) * Improved error message when `for ... in x` loop iterates over a value that could be 'nil' * Return type of `next` not includes 'nil' (Fixes luau-lang/luau#706) * Improved type inference of `string` type * Luau library table type names are now reported as `typeof(string)`/etc instead of just `string` which was misleading * Added parsing error when optional type alias type parameter wasn't provided after `=` token * Improved tagged union type refinement in conditional expressions, type in `else` branch should no longer include previously handled union options
The following code gets past luau-analyze even though
foo
printsnil
instead of a number, due tonext
's return type not includingnil
The text was updated successfully, but these errors were encountered: