Skip to content

Commit bdd984b

Browse files
committed
Merge tag '0.707'
2 parents 053a89c + 544d3ff commit bdd984b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1106
-600
lines changed

Analysis/include/Luau/FileResolver.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ struct RequireNode
7070
return {};
7171
}
7272

73-
// TODO: resolvePathToNode() can ultimately be replaced with a call into
74-
// require-by-string's path resolution algorithm. This will first require
75-
// generalizing that algorithm to work with a virtual file system.
73+
// Resolve a path relative to the current node. The Luau.Require library
74+
// provides utilities that can help with implementing this logic.
7675
virtual std::unique_ptr<RequireNode> resolvePathToNode(const std::string& path) const = 0;
7776

7877
// Get children of this node, if any (if this node represents a directory).

Analysis/include/Luau/Module.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ struct Module
156156
// Once a module has been typechecked, we clone its public interface into a
157157
// separate arena. This helps us to force Type ownership into a DAG rather
158158
// than a DCG.
159-
void clonePublicInterface_DEPRECATED(NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice);
160-
161159
void clonePublicInterface(NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice, SolverMode mode);
162160

163161
bool constraintGenerationDidNotComplete = true;

Analysis/include/Luau/Subtyping.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ struct SubtypingEnvironment
166166
NotNull<InternalErrorReporter> iceReporter
167167
);
168168

169-
// TODO: Clip with LuauTryFindSubstitutionReturnOptional
170-
const TypeId* tryFindSubstitution_DEPRECATED(TypeId ty) const;
171169
std::optional<TypeId> tryFindSubstitution(TypeId ty) const;
172170
const SubtypingResult* tryFindSubtypingResult(std::pair<TypeId, TypeId> subAndSuper) const;
173171

Analysis/include/Luau/TypeUtils.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ struct InConditionalContext
5757

5858
using ScopePtr = std::shared_ptr<struct Scope>;
5959

60-
std::optional<Property> findTableProperty(
61-
NotNull<BuiltinTypes> builtinTypes,
62-
ErrorVec& errors,
63-
TypeId ty,
64-
const std::string& name,
65-
Location location
66-
);
67-
6860
std::optional<TypeId> findMetatableEntry(
6961
NotNull<BuiltinTypes> builtinTypes,
7062
ErrorVec& errors,

Analysis/src/BuiltinDefinitions.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
LUAU_FASTFLAG(LuauSolverV2)
3535
LUAU_FASTFLAGVARIABLE(LuauTableCloneClonesType4)
36-
LUAU_FASTFLAG(LuauUseWorkspacePropToChooseSolver)
3736
LUAU_FASTFLAGVARIABLE(LuauCloneForIntersectionsUnions)
3837
LUAU_FASTFLAG(LuauStorePolarityInline)
3938
LUAU_FASTFLAGVARIABLE(LuauTableFreezeCheckIsSubtype)
@@ -1160,9 +1159,9 @@ TypeId makeStringMetatable(NotNull<BuiltinTypes> builtinTypes, SolverMode mode)
11601159
const TypePackId oneStringPack = arena->addTypePack({stringType});
11611160
const TypePackId anyTypePack = builtinTypes->anyTypePack;
11621161

1163-
const TypePackId variadicTailPack = (FFlag::LuauUseWorkspacePropToChooseSolver && mode == SolverMode::New) ? builtinTypes->unknownTypePack
1164-
: FFlag::LuauSolverV2 ? builtinTypes->unknownTypePack
1165-
: anyTypePack;
1162+
const TypePackId variadicTailPack = mode == SolverMode::New ? builtinTypes->unknownTypePack
1163+
: FFlag::LuauSolverV2 ? builtinTypes->unknownTypePack
1164+
: anyTypePack;
11661165
const TypePackId emptyPack = arena->addTypePack({});
11671166
const TypePackId stringVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{stringType}});
11681167
const TypePackId numberVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{numberType}});

Analysis/src/ConstraintGenerator.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ LUAU_FASTINTVARIABLE(LuauPrimitiveInferenceInTableLimit, 500)
4141
LUAU_FASTFLAG(LuauExplicitTypeInstantiationSyntax)
4242
LUAU_FASTFLAG(LuauExplicitTypeInstantiationSupport)
4343
LUAU_FASTFLAGVARIABLE(LuauNumericUnaryOpsDontProduceNegationRefinements)
44-
LUAU_FASTFLAGVARIABLE(LuauTypeFunctions)
4544
LUAU_FASTFLAG(LuauPushTypeConstraintLambdas3)
4645
LUAU_FASTFLAGVARIABLE(LuauAvoidMintingMultipleBlockedTypesForGlobals)
47-
LUAU_FASTFLAGVARIABLE(LuauUseIterativeTypeVisitor)
4846
LUAU_FASTFLAGVARIABLE(LuauPropagateTypeAnnotationsInForInLoops)
4947
LUAU_FASTFLAGVARIABLE(LuauStorePolarityInline)
5048
LUAU_FASTFLAGVARIABLE(LuauDontIncludeVarargWithAnnotation)
@@ -587,13 +585,12 @@ namespace
587585
* FindSimplificationBlockers to recognize these typeArguments and defer the
588586
* simplification until constraint solution.
589587
*/
590-
template<typename BaseVisitor>
591-
struct FindSimplificationBlockers : BaseVisitor
588+
struct FindSimplificationBlockers : IterativeTypeVisitor
592589
{
593590
bool found = false;
594591

595592
FindSimplificationBlockers()
596-
: BaseVisitor("FindSimplificationBlockers", /* skipBoundTypes */ true)
593+
: IterativeTypeVisitor("FindSimplificationBlockers", /* skipBoundTypes */ true)
597594
{
598595
}
599596

@@ -635,18 +632,9 @@ struct FindSimplificationBlockers : BaseVisitor
635632

636633
bool mustDeferIntersection(TypeId ty)
637634
{
638-
if (FFlag::LuauUseIterativeTypeVisitor)
639-
{
640-
FindSimplificationBlockers<IterativeTypeVisitor> bts;
641-
bts.run(ty);
642-
return bts.found;
643-
}
644-
else
645-
{
646-
FindSimplificationBlockers<TypeOnceVisitor> bts;
647-
bts.traverse(ty);
648-
return bts.found;
649-
}
635+
FindSimplificationBlockers bts;
636+
bts.run(ty);
637+
return bts.found;
650638
}
651639
} // namespace
652640

Analysis/src/ConstraintSolver.cpp

Lines changed: 26 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ LUAU_FASTFLAGVARIABLE(DebugLuauAssertOnForcedConstraint)
4242
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolver)
4343
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverIncludeDependencies)
4444
LUAU_FASTFLAGVARIABLE(DebugLuauLogBindings)
45-
LUAU_FASTFLAGVARIABLE(LuauDontDynamicallyCreateRedundantSubtypeConstraints)
4645
LUAU_FASTFLAG(LuauExplicitTypeInstantiationSupport)
4746
LUAU_FASTFLAG(LuauInstantiationUsesGenericPolarity2)
4847
LUAU_FASTFLAG(LuauPushTypeConstraintLambdas3)
4948
LUAU_FASTFLAG(LuauMarkUnscopedGenericsAsSolved)
5049
LUAU_FASTFLAGVARIABLE(LuauUseFastSubtypeForIndexerWithName)
5150
LUAU_FASTFLAGVARIABLE(LuauUnifyWithSubtyping)
52-
LUAU_FASTFLAG(LuauUseIterativeTypeVisitor)
5351
LUAU_FASTFLAGVARIABLE(LuauDoNotUseApplyTypeFunctionToClone)
5452
LUAU_FASTFLAGVARIABLE(LuauReworkInfiniteTypeFinder)
5553

@@ -333,16 +331,15 @@ struct InstantiationQueuer : TypeOnceVisitor
333331
}
334332
};
335333

336-
template<typename BaseVisitor>
337-
struct InfiniteTypeFinder : BaseVisitor
334+
struct InfiniteTypeFinder : IterativeTypeVisitor
338335
{
339336
NotNull<ConstraintSolver> solver;
340337
const InstantiationSignature& signature;
341338
NotNull<Scope> scope;
342339
bool foundInfiniteType = false;
343340

344341
explicit InfiniteTypeFinder(ConstraintSolver* solver, const InstantiationSignature& signature, NotNull<Scope> scope)
345-
: BaseVisitor("InfiniteTypeFinder", /* skipBoundTypes */ true)
342+
: IterativeTypeVisitor("InfiniteTypeFinder", /* skipBoundTypes */ true)
346343
, solver(solver)
347344
, signature(signature)
348345
, scope(scope)
@@ -1192,37 +1189,18 @@ bool ConstraintSolver::tryDispatch(const NameConstraint& c, NotNull<const Constr
11921189
c.typePackParameters,
11931190
};
11941191

1195-
if (FFlag::LuauUseIterativeTypeVisitor)
1196-
{
1197-
InfiniteTypeFinder<IterativeTypeVisitor> itf{this, signature, constraint->scope};
1198-
itf.run(target);
1192+
InfiniteTypeFinder itf{this, signature, constraint->scope};
1193+
itf.run(target);
11991194

1200-
if (itf.foundInfiniteType)
1201-
{
1202-
if (FFlag::LuauReworkInfiniteTypeFinder)
1203-
constraint->scope->invalidTypeAliases[c.name] = constraint->location;
1204-
else
1205-
constraint->scope->invalidTypeAliasNames_DEPRECATED.insert(c.name);
1206-
shiftReferences(target, builtinTypes->errorType);
1207-
emplaceType<BoundType>(asMutable(target), builtinTypes->errorType);
1208-
return true;
1209-
}
1210-
}
1211-
else
1195+
if (itf.foundInfiniteType)
12121196
{
1213-
InfiniteTypeFinder<TypeOnceVisitor> itf{this, signature, constraint->scope};
1214-
itf.traverse(target);
1215-
1216-
if (itf.foundInfiniteType)
1217-
{
1218-
if (FFlag::LuauReworkInfiniteTypeFinder)
1219-
constraint->scope->invalidTypeAliases[c.name] = constraint->location;
1220-
else
1221-
constraint->scope->invalidTypeAliasNames_DEPRECATED.insert(c.name);
1222-
shiftReferences(target, builtinTypes->errorType);
1223-
emplaceType<BoundType>(asMutable(target), builtinTypes->errorType);
1224-
return true;
1225-
}
1197+
if (FFlag::LuauReworkInfiniteTypeFinder)
1198+
constraint->scope->invalidTypeAliases[c.name] = constraint->location;
1199+
else
1200+
constraint->scope->invalidTypeAliasNames_DEPRECATED.insert(c.name);
1201+
shiftReferences(target, builtinTypes->errorType);
1202+
emplaceType<BoundType>(asMutable(target), builtinTypes->errorType);
1203+
return true;
12261204
}
12271205
}
12281206

@@ -1360,37 +1338,18 @@ bool ConstraintSolver::tryDispatch(const TypeAliasExpansionConstraint& c, NotNul
13601338
// https://github.com/luau-lang/luau/pull/68 for the RFC responsible for
13611339
// this. This is a little nicer than using a recursion limit because we can
13621340
// catch the infinite expansion before actually trying to expand it.
1363-
if (FFlag::LuauUseIterativeTypeVisitor)
1364-
{
1365-
InfiniteTypeFinder<IterativeTypeVisitor> itf{this, signature, constraint->scope};
1366-
itf.run(tf->type);
1341+
InfiniteTypeFinder itf{this, signature, constraint->scope};
1342+
itf.run(tf->type);
13671343

1368-
if (itf.foundInfiniteType)
1369-
{
1370-
// TODO (CLI-56761): Report an error.
1371-
bindResult(builtinTypes->errorType);
1372-
if (FFlag::LuauReworkInfiniteTypeFinder)
1373-
constraint->scope->invalidTypeAliases[petv->name.value] = constraint->location;
1374-
else
1375-
reportError(GenericError{"Recursive type being used with different parameters"}, constraint->location);
1376-
return true;
1377-
}
1378-
}
1379-
else
1344+
if (itf.foundInfiniteType)
13801345
{
1381-
InfiniteTypeFinder<TypeOnceVisitor> itf{this, signature, constraint->scope};
1382-
itf.traverse(tf->type);
1383-
1384-
if (itf.foundInfiniteType)
1385-
{
1386-
// TODO (CLI-56761): Report an error.
1387-
bindResult(builtinTypes->errorType);
1388-
if (FFlag::LuauReworkInfiniteTypeFinder)
1389-
constraint->scope->invalidTypeAliases[petv->name.value] = constraint->location;
1390-
else
1391-
reportError(GenericError{"Recursive type being used with different parameters"}, constraint->location);
1392-
return true;
1393-
}
1346+
// TODO (CLI-56761): Report an error.
1347+
bindResult(builtinTypes->errorType);
1348+
if (FFlag::LuauReworkInfiniteTypeFinder)
1349+
constraint->scope->invalidTypeAliases[petv->name.value] = constraint->location;
1350+
else
1351+
reportError(GenericError{"Recursive type being used with different parameters"}, constraint->location);
1352+
return true;
13941353
}
13951354

13961355
// FIXME: this does not actually implement instantiation properly, it puts
@@ -3894,13 +3853,10 @@ bool ConstraintSolver::isBlocked(NotNull<const Constraint> constraint) const
38943853
NotNull<Constraint> ConstraintSolver::pushConstraint(NotNull<Scope> scope, const Location& location, ConstraintV cv)
38953854
{
38963855
std::optional<SubtypeConstraintRecord> scr;
3897-
if (FFlag::LuauDontDynamicallyCreateRedundantSubtypeConstraints)
3898-
{
3899-
if (auto sc = cv.get_if<SubtypeConstraint>())
3900-
scr.emplace(SubtypeConstraintRecord{sc->subType, sc->superType, SubtypingVariance::Covariant});
3901-
else if (auto ec = cv.get_if<EqualityConstraint>())
3902-
scr.emplace(SubtypeConstraintRecord{ec->assignmentType, ec->resultType, SubtypingVariance::Invariant});
3903-
}
3856+
if (auto sc = cv.get_if<SubtypeConstraint>())
3857+
scr.emplace(SubtypeConstraintRecord{sc->subType, sc->superType, SubtypingVariance::Covariant});
3858+
else if (auto ec = cv.get_if<EqualityConstraint>())
3859+
scr.emplace(SubtypeConstraintRecord{ec->assignmentType, ec->resultType, SubtypingVariance::Invariant});
39043860

39053861
if (scr)
39063862
{

Analysis/src/FileResolver.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ static RequireSuggestions makeSuggestionsFromNode(std::unique_ptr<RequireNode> n
6161
RequireSuggestion parentSuggestion;
6262
parentSuggestion.label = "..";
6363

64-
// TODO: after exposing require-by-string's path normalization API, this
65-
// if-else can be replaced. Instead, we can simply normalize the result
66-
// of inserting ".." at the end of the current path.
6764
if (lastSlashInPath >= 2 && path.substr(lastSlashInPath - 2, 3) == "../")
6865
{
6966
parentSuggestion.fullPath = path.substr(0, lastSlashInPath + 1);

Analysis/src/FragmentAutocomplete.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ LUAU_FASTINT(LuauTypeInferIterationLimit);
3030
LUAU_FASTINT(LuauTarjanChildLimit)
3131

3232
LUAU_FASTFLAGVARIABLE(DebugLogFragmentsFromAutocomplete)
33-
LUAU_FASTFLAG(LuauUseWorkspacePropToChooseSolver)
3433
LUAU_FASTFLAGVARIABLE(LuauFragmentRequiresCanBeResolvedToAModule)
3534

3635
namespace Luau
@@ -756,14 +755,6 @@ void cloneTypesFromFragment(
756755
destScope->returnType = Luau::cloneIncremental(staleScope->returnType, *destArena, cloneState, destScope);
757756
}
758757

759-
static FrontendModuleResolver& getModuleResolver_DEPRECATED(Frontend& frontend, std::optional<FrontendOptions> options)
760-
{
761-
if (FFlag::LuauSolverV2 || !options)
762-
return frontend.moduleResolver;
763-
764-
return options->forAutocomplete ? frontend.moduleResolverForAutocomplete : frontend.moduleResolver;
765-
}
766-
767758
static FrontendModuleResolver& getModuleResolver(Frontend& frontend, std::optional<FrontendOptions> options)
768759
{
769760
if ((frontend.getLuauSolverMode() == SolverMode::New) || !options)
@@ -1298,8 +1289,7 @@ FragmentTypeCheckResult typecheckFragment__DEPRECATED(
12981289
DataFlowGraph dfg = DataFlowGraphBuilder::build(root, NotNull{&incrementalModule->defArena}, NotNull{&incrementalModule->keyArena}, iceHandler);
12991290
reportWaypoint(reporter, FragmentAutocompleteWaypoint::DfgBuildEnd);
13001291

1301-
FrontendModuleResolver& resolver =
1302-
FFlag::LuauUseWorkspacePropToChooseSolver ? getModuleResolver(frontend, opts) : getModuleResolver_DEPRECATED(frontend, opts);
1292+
FrontendModuleResolver& resolver = getModuleResolver(frontend, opts);
13031293
std::shared_ptr<Scope> freshChildOfNearestScope = std::make_shared<Scope>(nullptr);
13041294
/// Contraint Generator
13051295
ConstraintGenerator cg{
@@ -1416,8 +1406,7 @@ std::pair<FragmentTypeCheckStatus, FragmentTypeCheckResult> typecheckFragment(
14161406
if (!frontend.allModuleDependenciesValid(moduleName, opts && opts->forAutocomplete))
14171407
return {FragmentTypeCheckStatus::SkipAutocomplete, {}};
14181408

1419-
FrontendModuleResolver& resolver =
1420-
FFlag::LuauUseWorkspacePropToChooseSolver ? getModuleResolver(frontend, opts) : getModuleResolver_DEPRECATED(frontend, opts);
1409+
FrontendModuleResolver& resolver = getModuleResolver(frontend, opts);
14211410
ModulePtr module = resolver.getModule(moduleName);
14221411
if (!module)
14231412
{

Analysis/src/Frontend.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJsonFile)
4040
LUAU_FASTFLAGVARIABLE(DebugLuauForbidInternalTypes)
4141
LUAU_FASTFLAGVARIABLE(DebugLuauForceStrictMode)
4242
LUAU_FASTFLAGVARIABLE(DebugLuauForceNonStrictMode)
43-
LUAU_FASTFLAGVARIABLE(LuauUseWorkspacePropToChooseSolver)
4443
LUAU_FASTFLAGVARIABLE(DebugLuauAlwaysShowConstraintSolvingIncomplete)
4544
LUAU_FASTFLAG(LuauStandaloneParseType)
4645

@@ -449,12 +448,7 @@ void Frontend::setLuauSolverMode(SolverMode mode)
449448

450449
SolverMode Frontend::getLuauSolverMode() const
451450
{
452-
if (FFlag::LuauUseWorkspacePropToChooseSolver)
453-
return useNewLuauSolver.load();
454-
else if (FFlag::LuauSolverV2)
455-
return SolverMode::New;
456-
else
457-
return SolverMode::Old;
451+
return useNewLuauSolver.load();
458452
}
459453

460454
void Frontend::parse(const ModuleName& name)
@@ -1664,10 +1658,7 @@ ModulePtr check(
16641658

16651659

16661660
unfreeze(module->interfaceTypes);
1667-
if (FFlag::LuauUseWorkspacePropToChooseSolver)
1668-
module->clonePublicInterface(builtinTypes, *iceHandler, SolverMode::New);
1669-
else
1670-
module->clonePublicInterface_DEPRECATED(builtinTypes, *iceHandler);
1661+
module->clonePublicInterface(builtinTypes, *iceHandler, SolverMode::New);
16711662

16721663
// It would be nice if we could freeze the arenas before doing type
16731664
// checking, but we'll have to do some work to get there.

0 commit comments

Comments
 (0)