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

Magic functions are not called for overloaded function types (new solver) #1447

Open
Tracked by #783
checkraisefold opened this issue Sep 30, 2024 · 1 comment
Open
Tracked by #783
Labels
bug Something isn't working new solver This issue is specific to the new solver.

Comments

@checkraisefold
Copy link
Contributor

Upon analysis of a luau-lsp failing test for the new solver, it was discovered that for overloaded table/class function properties using an IntersectionType, magic functions are never called.

This is because the overloaded type is only resolved after the magic functions are attempted to be called. See here:
https://github.com/luau-lang/luau/blob/master/Analysis/src/ConstraintSolver.cpp#L1209-L1216 (where ftv will be invalid, because it is an IntersectionType)
https://github.com/luau-lang/luau/blob/master/Analysis/src/ConstraintSolver.cpp#L1244-L1260 (the code immediately afterwards, with a valid function type)

Unfortunately, I don't think theres a workaround from luau-lsp's side for now; so this is the only blocker compared to the old solver as of yet on that side of things.

@checkraisefold checkraisefold added the bug Something isn't working label Sep 30, 2024
@vegorov-rbx vegorov-rbx added the new solver This issue is specific to the new solver. label Sep 30, 2024
@checkraisefold
Copy link
Contributor Author

After looking at how Studio behaves with the WaitForChild type, I came up with pretty identical behavior using a magic function to make the instance type optional when timeout argument is present instead of using an overload through an IntersectionType as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new solver This issue is specific to the new solver.
Development

No branches or pull requests

2 participants