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

definitionModuleName is undefined for table type aliases #1441

Closed
Tracked by #783
checkraisefold opened this issue Sep 28, 2024 · 1 comment · Fixed by #1495
Closed
Tracked by #783

definitionModuleName is undefined for table type aliases #1441

checkraisefold opened this issue Sep 28, 2024 · 1 comment · Fixed by #1495
Labels
bug Something isn't working new solver This issue is specific to the new solver.

Comments

@checkraisefold
Copy link
Contributor

checkraisefold commented Sep 28, 2024

definitionModuleName is only defined in the case of an explicit table definition using AstExprTable. However, when a TableType is resolved from an AstStatTypeAlias with an AstTypeTable contained, no definitionModuleName is filled in initially. This is an issue for anything that resolves a table type without an AstExprTable really, but that's mostly limited to type aliases.

The constraint solver is supposed to fill this in later for specifically type aliases, but it's currently a TODO item since Luau 539, which for the informed reader was released in August of 2022. I think an issue is appropriate to track this rather than having to track down a TODO item for it.
https://github.com/luau-lang/luau/blob/master/Analysis/src/ConstraintSolver.cpp#L1104
The other issue with this location is that TypeAliasExpansionConstraint is not always used for type aliases, so an additional fix will be needed elsewhere.

This is problematic because existing (major) code depends on this, namely luau-lsp, and this behavior is not present in the old solver (the type alias has the correct definitionModuleName) and this causes luau-lsp tests to fail.
https://github.com/JohnnyMorganz/luau-lsp/blob/main/src/operations/Completion.cpp#L373

@checkraisefold checkraisefold added the bug Something isn't working label Sep 28, 2024
@checkraisefold
Copy link
Contributor Author

needs new solver label

@aatxe aatxe added the new solver This issue is specific to the new solver. label Sep 29, 2024
@aatxe aatxe closed this as completed in 9a4bc6a Nov 5, 2024
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

Successfully merging a pull request may close this issue.

2 participants