mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 13:30:40 +00:00
Merge branch 'master' into merge
This commit is contained in:
commit
38ab2e5f71
4 changed files with 28 additions and 1 deletions
|
@ -38,6 +38,7 @@ LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJson, false)
|
|||
LUAU_FASTFLAG(LuauRequirePathTrueModuleName)
|
||||
LUAU_FASTFLAGVARIABLE(DebugLuauReadWriteProperties, false)
|
||||
LUAU_FASTFLAGVARIABLE(LuauSplitFrontendProcessing, false)
|
||||
LUAU_FASTFLAGVARIABLE(LuauTypeCheckerUseCorrectScope, false)
|
||||
|
||||
namespace Luau
|
||||
{
|
||||
|
@ -1397,7 +1398,9 @@ ModulePtr Frontend::check(const SourceModule& sourceModule, Mode mode, std::vect
|
|||
}
|
||||
else
|
||||
{
|
||||
TypeChecker typeChecker(globals.globalScope, forAutocomplete ? &moduleResolverForAutocomplete : &moduleResolver, builtinTypes, &iceHandler);
|
||||
TypeChecker typeChecker(FFlag::LuauTypeCheckerUseCorrectScope ? (forAutocomplete ? globalsForAutocomplete.globalScope : globals.globalScope)
|
||||
: globals.globalScope,
|
||||
forAutocomplete ? &moduleResolverForAutocomplete : &moduleResolver, builtinTypes, &iceHandler);
|
||||
|
||||
if (prepareModuleScope)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <string>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Luau
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Luau
|
||||
{
|
||||
|
|
|
@ -3503,4 +3503,26 @@ local a: T@1
|
|||
CHECK_EQ(ac.context, AutocompleteContext::Type);
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(ACFixture, "frontend_use_correct_global_scope")
|
||||
{
|
||||
ScopedFastFlag sff("LuauTypeCheckerUseCorrectScope", true);
|
||||
|
||||
loadDefinition(R"(
|
||||
declare class Instance
|
||||
Name: string
|
||||
end
|
||||
)");
|
||||
|
||||
CheckResult result = check(R"(
|
||||
local a: unknown = nil
|
||||
if typeof(a) == "Instance" then
|
||||
local b = a.@1
|
||||
end
|
||||
)");
|
||||
auto ac = autocomplete('1');
|
||||
|
||||
CHECK_EQ(1, ac.entryMap.size());
|
||||
CHECK(ac.entryMap.count("Name"));
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
|
|
Loading…
Reference in a new issue