Pass environment scope to autocomplete typechecker#610
Pass environment scope to autocomplete typechecker#610andyfriesen merged 3 commits intoluau-lang:masterfrom
Conversation
|
There is a potential issue here since when you create a new environment scope, it uses If This might require unique environment scopes being created for each type checker instead |
|
@andyfriesen Any thoughts on the problem above? In Luau LSP we modify Probably a separate issue to this though. |
|
What we're doing now is wrong but benign because we should be properly respecting scope and type lifetimes, but I see what you're saying. The least-worst thing is probably to have a parallel data structure to |
Fixes a bug where the environment scope is not passed to the autocomplete typechecker, so environment-related types are not provided.
This caused an issue where
getModuleEnvironmentreturnstypeChecker.globalScopewhen there is no environment. We pass this through totypeCheckerForAutocomplete.check()then environmentscope is no longer nullopt and it will usetypeChecker.globalScopeinstead of falling back totypeCheckerForAutocomplete.globalScope.This is solved by passing
forAutocompletetogetModuleEnvironmentso it falls back to the autocomplete global scope if none found.