Sync to upstream/release/641 (#1382)

### What's new

* Light update this week, mostly fast flag cleanups.

### New Solver

* Rename flag to enable new solver from
`DebugLuauDeferredConstraintResolution` to `LuauSolverV2`
* Added support for magic functions for the new type checker (as opposed
to the type inference component)
* Improved handling of `string.format` with magic function improvements
* Cleaning up some of the reported errors by the new type checker
* Minor refactoring of `TypeChecker2.cpp` that happens to make the diff
very hard to read.

---

### Internal Contributors

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>

---------

Co-authored-by: Alexander McCord <amccord@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Vighnesh <vvijay@roblox.com>
Co-authored-by: Aviral Goel <agoel@roblox.com>
Co-authored-by: David Cope <dcope@roblox.com>
Co-authored-by: Lily Brown <lbrown@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Co-authored-by: Junseo Yoo <jyoo@roblox.com>
This commit is contained in:
aaron 2024-08-30 16:16:51 -04:00 committed by GitHub
parent d518d14b92
commit b23d43496b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
92 changed files with 4166 additions and 4082 deletions

View File

@ -13,6 +13,7 @@ struct Frontend;
struct GlobalTypes; struct GlobalTypes;
struct TypeChecker; struct TypeChecker;
struct TypeArena; struct TypeArena;
struct Subtyping;
void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeCheckForAutocomplete = false); void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeCheckForAutocomplete = false);
TypeId makeUnion(TypeArena& arena, std::vector<TypeId>&& types); TypeId makeUnion(TypeArena& arena, std::vector<TypeId>&& types);
@ -65,7 +66,7 @@ TypeId makeFunction( // Polymorphic
void attachMagicFunction(TypeId ty, MagicFunction fn); void attachMagicFunction(TypeId ty, MagicFunction fn);
void attachDcrMagicFunction(TypeId ty, DcrMagicFunction fn); void attachDcrMagicFunction(TypeId ty, DcrMagicFunction fn);
void attachDcrMagicRefinement(TypeId ty, DcrMagicRefinement fn); void attachDcrMagicRefinement(TypeId ty, DcrMagicRefinement fn);
void attachDcrMagicFunctionTypeCheck(TypeId ty, DcrMagicFunctionTypeCheck fn);
Property makeProperty(TypeId ty, std::optional<std::string> documentationSymbol = std::nullopt); Property makeProperty(TypeId ty, std::optional<std::string> documentationSymbol = std::nullopt);
void assignPropDocumentationSymbols(TableType::Props& props, const std::string& baseName); void assignPropDocumentationSymbols(TableType::Props& props, const std::string& baseName);

View File

@ -4,7 +4,7 @@
#include "Luau/Common.h" #include "Luau/Common.h"
#include "Luau/DenseHash.h" #include "Luau/DenseHash.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
namespace Luau namespace Luau
{ {

View File

@ -34,6 +34,8 @@ using ScopePtr = std::shared_ptr<Scope>;
struct TypeFunction; struct TypeFunction;
struct Constraint; struct Constraint;
struct Subtyping;
struct TypeChecker2;
/** /**
* There are three kinds of type variables: * There are three kinds of type variables:
@ -289,7 +291,6 @@ struct MagicFunctionCallContext
}; };
using DcrMagicFunction = std::function<bool(MagicFunctionCallContext)>; using DcrMagicFunction = std::function<bool(MagicFunctionCallContext)>;
struct MagicRefinementContext struct MagicRefinementContext
{ {
NotNull<Scope> scope; NotNull<Scope> scope;
@ -297,8 +298,17 @@ struct MagicRefinementContext
std::vector<std::optional<TypeId>> discriminantTypes; std::vector<std::optional<TypeId>> discriminantTypes;
}; };
using DcrMagicRefinement = void (*)(const MagicRefinementContext&); struct MagicFunctionTypeCheckContext
{
NotNull<TypeChecker2> typechecker;
NotNull<BuiltinTypes> builtinTypes;
const class AstExprCall* callSite;
TypePackId arguments;
NotNull<Scope> checkScope;
};
using DcrMagicRefinement = void (*)(const MagicRefinementContext&);
using DcrMagicFunctionTypeCheck = std::function<void(const MagicFunctionTypeCheckContext&)>;
struct FunctionType struct FunctionType
{ {
// Global monomorphic function // Global monomorphic function
@ -359,6 +369,14 @@ struct FunctionType
MagicFunction magicFunction = nullptr; MagicFunction magicFunction = nullptr;
DcrMagicFunction dcrMagicFunction = nullptr; DcrMagicFunction dcrMagicFunction = nullptr;
DcrMagicRefinement dcrMagicRefinement = nullptr; DcrMagicRefinement dcrMagicRefinement = nullptr;
// Callback to allow custom typechecking of builtin function calls whose argument types
// will only be resolved after constraint solving. For example, the arguments to string.format
// have types that can only be decided after parsing the format string and unifying
// with the passed in values, but the correctness of the call can only be decided after
// all the types have been finalized.
DcrMagicFunctionTypeCheck dcrMagicTypeCheck = nullptr;
bool hasSelf; bool hasSelf;
// `hasNoFreeOrGenericTypes` should be true if and only if the type does not have any free or generic types present inside it. // `hasNoFreeOrGenericTypes` should be true if and only if the type does not have any free or generic types present inside it.
// this flag is used as an optimization to exit early from procedures that manipulate free or generic types. // this flag is used as an optimization to exit early from procedures that manipulate free or generic types.

View File

@ -2,7 +2,15 @@
#pragma once #pragma once
#include "Luau/Error.h"
#include "Luau/NotNull.h" #include "Luau/NotNull.h"
#include "Luau/Common.h"
#include "Luau/TypeUtils.h"
#include "Luau/Type.h"
#include "Luau/TypeFwd.h"
#include "Luau/TypeOrPack.h"
#include "Luau/Normalize.h"
#include "Luau/Subtyping.h"
namespace Luau namespace Luau
{ {
@ -13,6 +21,42 @@ struct TypeCheckLimits;
struct UnifierSharedState; struct UnifierSharedState;
struct SourceModule; struct SourceModule;
struct Module; struct Module;
struct InternalErrorReporter;
struct Scope;
struct PropertyType;
struct PropertyTypes;
struct StackPusher;
struct Reasonings
{
// the list of reasons
std::vector<std::string> reasons;
// this should be true if _all_ of the reasons have an error suppressing type, and false otherwise.
bool suppressed;
std::string toString()
{
// DenseHashSet ordering is entirely undefined, so we want to
// sort the reasons here to achieve a stable error
// stringification.
std::sort(reasons.begin(), reasons.end());
std::string allReasons;
bool first = true;
for (const std::string& reason : reasons)
{
if (first)
first = false;
else
allReasons += "\n\t";
allReasons += reason;
}
return allReasons;
}
};
void check( void check(
NotNull<BuiltinTypes> builtinTypes, NotNull<BuiltinTypes> builtinTypes,
@ -23,4 +67,154 @@ void check(
Module* module Module* module
); );
struct TypeChecker2
{
NotNull<BuiltinTypes> builtinTypes;
DcrLogger* logger;
const NotNull<TypeCheckLimits> limits;
const NotNull<InternalErrorReporter> ice;
const SourceModule* sourceModule;
Module* module;
TypeContext typeContext = TypeContext::Default;
std::vector<NotNull<Scope>> stack;
std::vector<TypeId> functionDeclStack;
DenseHashSet<TypeId> seenTypeFunctionInstances{nullptr};
Normalizer normalizer;
Subtyping _subtyping;
NotNull<Subtyping> subtyping;
TypeChecker2(
NotNull<BuiltinTypes> builtinTypes,
NotNull<UnifierSharedState> unifierState,
NotNull<TypeCheckLimits> limits,
DcrLogger* logger,
const SourceModule* sourceModule,
Module* module
);
void visit(AstStatBlock* block);
void reportError(TypeErrorData data, const Location& location);
Reasonings explainReasonings(TypeId subTy, TypeId superTy, Location location, const SubtypingResult& r);
Reasonings explainReasonings(TypePackId subTp, TypePackId superTp, Location location, const SubtypingResult& r);
private:
static bool allowsNoReturnValues(const TypePackId tp);
static Location getEndLocation(const AstExprFunction* function);
bool isErrorCall(const AstExprCall* call);
bool hasBreak(AstStat* node);
const AstStat* getFallthrough(const AstStat* node);
std::optional<StackPusher> pushStack(AstNode* node);
void checkForInternalTypeFunction(TypeId ty, Location location);
TypeId checkForTypeFunctionInhabitance(TypeId instance, Location location);
TypePackId lookupPack(AstExpr* expr);
TypeId lookupType(AstExpr* expr);
TypeId lookupAnnotation(AstType* annotation);
std::optional<TypePackId> lookupPackAnnotation(AstTypePack* annotation);
TypeId lookupExpectedType(AstExpr* expr);
TypePackId lookupExpectedPack(AstExpr* expr, TypeArena& arena);
TypePackId reconstructPack(AstArray<AstExpr*> exprs, TypeArena& arena);
Scope* findInnermostScope(Location location);
void visit(AstStat* stat);
void visit(AstStatIf* ifStatement);
void visit(AstStatWhile* whileStatement);
void visit(AstStatRepeat* repeatStatement);
void visit(AstStatBreak*);
void visit(AstStatContinue*);
void visit(AstStatReturn* ret);
void visit(AstStatExpr* expr);
void visit(AstStatLocal* local);
void visit(AstStatFor* forStatement);
void visit(AstStatForIn* forInStatement);
std::optional<TypeId> getBindingType(AstExpr* expr);
void reportErrorsFromAssigningToNever(AstExpr* lhs, TypeId rhsType);
void visit(AstStatAssign* assign);
void visit(AstStatCompoundAssign* stat);
void visit(AstStatFunction* stat);
void visit(AstStatLocalFunction* stat);
void visit(const AstTypeList* typeList);
void visit(AstStatTypeAlias* stat);
void visit(AstStatTypeFunction* stat);
void visit(AstTypeList types);
void visit(AstStatDeclareFunction* stat);
void visit(AstStatDeclareGlobal* stat);
void visit(AstStatDeclareClass* stat);
void visit(AstStatError* stat);
void visit(AstExpr* expr, ValueContext context);
void visit(AstExprGroup* expr, ValueContext context);
void visit(AstExprConstantNil* expr);
void visit(AstExprConstantBool* expr);
void visit(AstExprConstantNumber* expr);
void visit(AstExprConstantString* expr);
void visit(AstExprLocal* expr);
void visit(AstExprGlobal* expr);
void visit(AstExprVarargs* expr);
void visitCall(AstExprCall* call);
void visit(AstExprCall* call);
std::optional<TypeId> tryStripUnionFromNil(TypeId ty);
TypeId stripFromNilAndReport(TypeId ty, const Location& location);
void visitExprName(AstExpr* expr, Location location, const std::string& propName, ValueContext context, TypeId astIndexExprTy);
void visit(AstExprIndexName* indexName, ValueContext context);
void indexExprMetatableHelper(AstExprIndexExpr* indexExpr, const MetatableType* metaTable, TypeId exprType, TypeId indexType);
void visit(AstExprIndexExpr* indexExpr, ValueContext context);
void visit(AstExprFunction* fn);
void visit(AstExprTable* expr);
void visit(AstExprUnary* expr);
TypeId visit(AstExprBinary* expr, AstNode* overrideKey = nullptr);
void visit(AstExprTypeAssertion* expr);
void visit(AstExprIfElse* expr);
void visit(AstExprInterpString* interpString);
void visit(AstExprError* expr);
TypeId flattenPack(TypePackId pack);
void visitGenerics(AstArray<AstGenericType> generics, AstArray<AstGenericTypePack> genericPacks);
void visit(AstType* ty);
void visit(AstTypeReference* ty);
void visit(AstTypeTable* table);
void visit(AstTypeFunction* ty);
void visit(AstTypeTypeof* ty);
void visit(AstTypeUnion* ty);
void visit(AstTypeIntersection* ty);
void visit(AstTypePack* pack);
void visit(AstTypePackExplicit* tp);
void visit(AstTypePackVariadic* tp);
void visit(AstTypePackGeneric* tp);
template<typename TID>
Reasonings explainReasonings_(TID subTy, TID superTy, Location location, const SubtypingResult& r);
void explainError(TypeId subTy, TypeId superTy, Location location, const SubtypingResult& result);
void explainError(TypePackId subTy, TypePackId superTy, Location location, const SubtypingResult& result);
bool testIsSubtype(TypeId subTy, TypeId superTy, Location location);
bool testIsSubtype(TypePackId subTy, TypePackId superTy, Location location);
void reportError(TypeError e);
void reportErrors(ErrorVec errors);
PropertyTypes lookupProp(
const NormalizedType* norm,
const std::string& prop,
ValueContext context,
const Location& location,
TypeId astIndexExprType,
std::vector<TypeError>& errors
);
// If the provided type does not have the named property, report an error.
void checkIndexTypeFromType(TypeId tableTy, const std::string& prop, ValueContext context, const Location& location, TypeId astIndexExprType);
PropertyType hasIndexTypeFromType(
TypeId ty,
const std::string& prop,
ValueContext context,
const Location& location,
DenseHashSet<TypeId>& seen,
TypeId astIndexExprType,
std::vector<TypeError>& errors
);
void diagnoseMissingTableKey(UnknownProperty* utk, TypeErrorData& data) const;
bool isErrorSuppressing(Location loc, TypeId ty);
bool isErrorSuppressing(Location loc1, TypeId ty1, Location loc2, TypeId ty2);
bool isErrorSuppressing(Location loc, TypePackId tp);
bool isErrorSuppressing(Location loc1, TypePackId tp1, Location loc2, TypePackId tp2);
};
} // namespace Luau } // namespace Luau

View File

@ -11,7 +11,7 @@
LUAU_FASTINT(LuauVisitRecursionLimit) LUAU_FASTINT(LuauVisitRecursionLimit)
LUAU_FASTFLAG(LuauBoundLazyTypes2) LUAU_FASTFLAG(LuauBoundLazyTypes2)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
namespace Luau namespace Luau
{ {
@ -226,12 +226,12 @@ struct GenericTypeVisitor
} }
else if (auto ftv = get<FreeType>(ty)) else if (auto ftv = get<FreeType>(ty))
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (visit(ty, *ftv)) if (visit(ty, *ftv))
{ {
// TODO: Replace these if statements with assert()s when we // TODO: Replace these if statements with assert()s when we
// delete FFlag::DebugLuauDeferredConstraintResolution. // delete FFlag::LuauSolverV2.
// //
// When the old solver is used, these pointers are always // When the old solver is used, these pointers are always
// unused. When the new solver is used, they are never null. // unused. When the new solver is used, they are never null.
@ -276,7 +276,7 @@ struct GenericTypeVisitor
{ {
for (auto& [_name, prop] : ttv->props) for (auto& [_name, prop] : ttv->props)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (auto ty = prop.readTy) if (auto ty = prop.readTy)
traverse(*ty); traverse(*ty);
@ -314,7 +314,7 @@ struct GenericTypeVisitor
{ {
for (const auto& [name, prop] : ctv->props) for (const auto& [name, prop] : ctv->props)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (auto ty = prop.readTy) if (auto ty = prop.readTy)
traverse(*ty); traverse(*ty);

View File

@ -692,7 +692,7 @@ bool AnyTypeSummary::containsAny(TypeId typ)
{ {
for (auto& [_name, prop] : ty->props) for (auto& [_name, prop] : ty->props)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (auto newT = follow(prop.readTy)) if (auto newT = follow(prop.readTy))
{ {

View File

@ -11,8 +11,7 @@
#include <algorithm> #include <algorithm>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAGVARIABLE(LuauFixBindingForGlobalPos, false);
namespace Luau namespace Luau
{ {
@ -327,7 +326,7 @@ static std::optional<AstStatLocal*> findBindingLocalStatement(const SourceModule
{ {
// Bindings coming from global sources (e.g., definition files) have a zero position. // Bindings coming from global sources (e.g., definition files) have a zero position.
// They cannot be defined from a local statement // They cannot be defined from a local statement
if (FFlag::LuauFixBindingForGlobalPos && binding.location == Location{{0, 0}, {0, 0}}) if (binding.location == Location{{0, 0}, {0, 0}})
return std::nullopt; return std::nullopt;
std::vector<AstNode*> nodes = findAstAncestryOfPosition(source, binding.location.begin); std::vector<AstNode*> nodes = findAstAncestryOfPosition(source, binding.location.begin);
@ -531,7 +530,7 @@ std::optional<DocumentationSymbol> getDocumentationSymbolAtPosition(const Source
{ {
if (auto propIt = ttv->props.find(indexName->index.value); propIt != ttv->props.end()) if (auto propIt = ttv->props.find(indexName->index.value); propIt != ttv->props.end())
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (auto ty = propIt->second.readTy) if (auto ty = propIt->second.readTy)
return checkOverloadedDocumentationSymbol(module, *ty, parentExpr, propIt->second.documentationSymbol); return checkOverloadedDocumentationSymbol(module, *ty, parentExpr, propIt->second.documentationSymbol);
@ -544,7 +543,7 @@ std::optional<DocumentationSymbol> getDocumentationSymbolAtPosition(const Source
{ {
if (auto propIt = ctv->props.find(indexName->index.value); propIt != ctv->props.end()) if (auto propIt = ctv->props.find(indexName->index.value); propIt != ctv->props.end())
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (auto ty = propIt->second.readTy) if (auto ty = propIt->second.readTy)
return checkOverloadedDocumentationSymbol(module, *ty, parentExpr, propIt->second.documentationSymbol); return checkOverloadedDocumentationSymbol(module, *ty, parentExpr, propIt->second.documentationSymbol);

View File

@ -13,7 +13,7 @@
#include <unordered_set> #include <unordered_set>
#include <utility> #include <utility>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
static const std::unordered_set<std::string> kStatementStartingKeywords = static const std::unordered_set<std::string> kStatementStartingKeywords =
{"while", "if", "local", "repeat", "function", "do", "for", "return", "break", "continue", "type", "export"}; {"while", "if", "local", "repeat", "function", "do", "for", "return", "break", "continue", "type", "export"};
@ -142,7 +142,7 @@ static bool checkTypeMatch(TypeId subTy, TypeId superTy, NotNull<Scope> scope, T
UnifierSharedState unifierState(&iceReporter); UnifierSharedState unifierState(&iceReporter);
Normalizer normalizer{typeArena, builtinTypes, NotNull{&unifierState}}; Normalizer normalizer{typeArena, builtinTypes, NotNull{&unifierState}};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
Subtyping subtyping{builtinTypes, NotNull{typeArena}, NotNull{&normalizer}, NotNull{&iceReporter}}; Subtyping subtyping{builtinTypes, NotNull{typeArena}, NotNull{&normalizer}, NotNull{&iceReporter}};
@ -293,7 +293,7 @@ static void autocompleteProps(
{ {
Luau::TypeId type; Luau::TypeId type;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (auto ty = prop.readTy) if (auto ty = prop.readTy)
type = follow(*ty); type = follow(*ty);
@ -1964,7 +1964,7 @@ AutocompleteResult autocomplete(Frontend& frontend, const ModuleName& moduleName
return {}; return {};
ModulePtr module; ModulePtr module;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
module = frontend.moduleResolver.getModule(moduleName); module = frontend.moduleResolver.getModule(moduleName);
else else
module = frontend.moduleResolverForAutocomplete.getModule(moduleName); module = frontend.moduleResolverForAutocomplete.getModule(moduleName);
@ -1974,7 +1974,7 @@ AutocompleteResult autocomplete(Frontend& frontend, const ModuleName& moduleName
NotNull<BuiltinTypes> builtinTypes = frontend.builtinTypes; NotNull<BuiltinTypes> builtinTypes = frontend.builtinTypes;
Scope* globalScope; Scope* globalScope;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
globalScope = frontend.globals.globalScope.get(); globalScope = frontend.globals.globalScope.get();
else else
globalScope = frontend.globalsForAutocomplete.globalScope.get(); globalScope = frontend.globalsForAutocomplete.globalScope.get();

View File

@ -10,10 +10,12 @@
#include "Luau/ConstraintGenerator.h" #include "Luau/ConstraintGenerator.h"
#include "Luau/NotNull.h" #include "Luau/NotNull.h"
#include "Luau/TypeInfer.h" #include "Luau/TypeInfer.h"
#include "Luau/TypeChecker2.h"
#include "Luau/TypeFunction.h" #include "Luau/TypeFunction.h"
#include "Luau/TypePack.h" #include "Luau/TypePack.h"
#include "Luau/Type.h" #include "Luau/Type.h"
#include "Luau/TypeUtils.h" #include "Luau/TypeUtils.h"
#include "Luau/Subtyping.h"
#include <algorithm> #include <algorithm>
@ -23,7 +25,8 @@
* about a function that takes any number of values, but where each value must have some specific type. * about a function that takes any number of values, but where each value must have some specific type.
*/ */
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAGVARIABLE(LuauDCRMagicFunctionTypeChecker, false);
namespace Luau namespace Luau
{ {
@ -181,6 +184,14 @@ void attachDcrMagicRefinement(TypeId ty, DcrMagicRefinement fn)
LUAU_ASSERT(!"Got a non functional type"); LUAU_ASSERT(!"Got a non functional type");
} }
void attachDcrMagicFunctionTypeCheck(TypeId ty, DcrMagicFunctionTypeCheck fn)
{
if (auto ftv = getMutable<FunctionType>(ty))
ftv->dcrMagicTypeCheck = fn;
else
LUAU_ASSERT(!"Got a non functional type");
}
Property makeProperty(TypeId ty, std::optional<std::string> documentationSymbol) Property makeProperty(TypeId ty, std::optional<std::string> documentationSymbol)
{ {
return { return {
@ -260,7 +271,7 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC
TypeArena& arena = globals.globalTypes; TypeArena& arena = globals.globalTypes;
NotNull<BuiltinTypes> builtinTypes = globals.builtinTypes; NotNull<BuiltinTypes> builtinTypes = globals.builtinTypes;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
builtinTypeFunctions().addToScope(NotNull{&arena}, NotNull{globals.globalScope.get()}); builtinTypeFunctions().addToScope(NotNull{&arena}, NotNull{globals.globalScope.get()});
LoadDefinitionFileResult loadResult = frontend.loadDefinitionFile( LoadDefinitionFileResult loadResult = frontend.loadDefinitionFile(
@ -305,7 +316,7 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC
// getmetatable : <MT>({ @metatable MT, {+ +} }) -> MT // getmetatable : <MT>({ @metatable MT, {+ +} }) -> MT
addGlobalBinding(globals, "getmetatable", makeFunction(arena, std::nullopt, {genericMT}, {}, {tableMetaMT}, {genericMT}), "@luau"); addGlobalBinding(globals, "getmetatable", makeFunction(arena, std::nullopt, {genericMT}, {}, {tableMetaMT}, {genericMT}), "@luau");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
TypeId genericT = arena.addType(GenericType{"T"}); TypeId genericT = arena.addType(GenericType{"T"});
TypeId tMetaMT = arena.addType(MetatableType{genericT, genericMT}); TypeId tMetaMT = arena.addType(MetatableType{genericT, genericMT});
@ -354,7 +365,7 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC
attachMagicFunction(getGlobalBinding(globals, "assert"), magicFunctionAssert); attachMagicFunction(getGlobalBinding(globals, "assert"), magicFunctionAssert);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// declare function assert<T>(value: T, errorMessage: string?): intersect<T, ~(false?)> // declare function assert<T>(value: T, errorMessage: string?): intersect<T, ~(false?)>
TypeId genericT = arena.addType(GenericType{"T"}); TypeId genericT = arena.addType(GenericType{"T"});
@ -374,7 +385,7 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC
if (TableType* ttv = getMutable<TableType>(getGlobalBinding(globals, "table"))) if (TableType* ttv = getMutable<TableType>(getGlobalBinding(globals, "table")))
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114044 - The new solver does not yet support generic tables, // CLI-114044 - The new solver does not yet support generic tables,
// which act, in an odd way, like generics that are constrained to // which act, in an odd way, like generics that are constrained to
@ -517,7 +528,7 @@ static bool dcrMagicFunctionFormat(MagicFunctionCallContext context)
size_t paramOffset = 1; size_t paramOffset = 1;
// unify the prefix one argument at a time // unify the prefix one argument at a time - needed if any of the involved types are free
for (size_t i = 0; i < expected.size() && i + paramOffset < params.size(); ++i) for (size_t i = 0; i < expected.size() && i + paramOffset < params.size(); ++i)
{ {
context.solver->unify(context.constraint, params[i + paramOffset], expected[i]); context.solver->unify(context.constraint, params[i + paramOffset], expected[i]);
@ -530,12 +541,52 @@ static bool dcrMagicFunctionFormat(MagicFunctionCallContext context)
if (numExpectedParams != numActualParams && (!tail || numExpectedParams < numActualParams)) if (numExpectedParams != numActualParams && (!tail || numExpectedParams < numActualParams))
context.solver->reportError(TypeError{context.callSite->location, CountMismatch{numExpectedParams, std::nullopt, numActualParams}}); context.solver->reportError(TypeError{context.callSite->location, CountMismatch{numExpectedParams, std::nullopt, numActualParams}});
// This is invoked at solve time, so we just need to provide a type for the result of :/.format
TypePackId resultPack = arena->addTypePack({context.solver->builtinTypes->stringType}); TypePackId resultPack = arena->addTypePack({context.solver->builtinTypes->stringType});
asMutable(context.result)->ty.emplace<BoundTypePack>(resultPack); asMutable(context.result)->ty.emplace<BoundTypePack>(resultPack);
return true; return true;
} }
static void dcrMagicFunctionTypeCheckFormat(MagicFunctionTypeCheckContext context)
{
AstExprConstantString* fmt = nullptr;
if (auto index = context.callSite->func->as<AstExprIndexName>(); index && context.callSite->self)
{
if (auto group = index->expr->as<AstExprGroup>())
fmt = group->expr->as<AstExprConstantString>();
else
fmt = index->expr->as<AstExprConstantString>();
}
if (!context.callSite->self && context.callSite->args.size > 0)
fmt = context.callSite->args.data[0]->as<AstExprConstantString>();
if (!fmt)
return;
std::vector<TypeId> expected = parseFormatString(context.builtinTypes, fmt->value.data, fmt->value.size);
const auto& [params, tail] = flatten(context.arguments);
size_t paramOffset = 1;
// Compare the expressions passed with the types the function expects to determine whether this function was called with : or .
bool calledWithSelf = expected.size() == context.callSite->args.size;
// unify the prefix one argument at a time
for (size_t i = 0; i < expected.size() && i + paramOffset < params.size(); ++i)
{
TypeId actualTy = params[i + paramOffset];
TypeId expectedTy = expected[i];
Location location = context.callSite->args.data[i + (calledWithSelf ? 0 : paramOffset)]->location;
// use subtyping instead here
SubtypingResult result = context.typechecker->subtyping->isSubtype(actualTy, expectedTy, context.checkScope);
if (!result.isSubtype)
{
Reasonings reasonings = context.typechecker->explainReasonings(actualTy, expectedTy, location, result);
context.typechecker->reportError(TypeMismatch{expectedTy, actualTy, reasonings.toString()}, location);
}
}
}
static std::vector<TypeId> parsePatternString(NotNull<BuiltinTypes> builtinTypes, const char* data, size_t size) static std::vector<TypeId> parsePatternString(NotNull<BuiltinTypes> builtinTypes, const char* data, size_t size)
{ {
std::vector<TypeId> result; std::vector<TypeId> result;
@ -869,7 +920,7 @@ TypeId makeStringMetatable(NotNull<BuiltinTypes> builtinTypes)
const TypePackId oneStringPack = arena->addTypePack({stringType}); const TypePackId oneStringPack = arena->addTypePack({stringType});
const TypePackId anyTypePack = builtinTypes->anyTypePack; const TypePackId anyTypePack = builtinTypes->anyTypePack;
const TypePackId variadicTailPack = FFlag::DebugLuauDeferredConstraintResolution ? builtinTypes->unknownTypePack : anyTypePack; const TypePackId variadicTailPack = FFlag::LuauSolverV2 ? builtinTypes->unknownTypePack : anyTypePack;
const TypePackId emptyPack = arena->addTypePack({}); const TypePackId emptyPack = arena->addTypePack({});
const TypePackId stringVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{stringType}}); const TypePackId stringVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{stringType}});
const TypePackId numberVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{numberType}}); const TypePackId numberVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{numberType}});
@ -880,6 +931,8 @@ TypeId makeStringMetatable(NotNull<BuiltinTypes> builtinTypes)
formatFTV.isCheckedFunction = true; formatFTV.isCheckedFunction = true;
const TypeId formatFn = arena->addType(formatFTV); const TypeId formatFn = arena->addType(formatFTV);
attachDcrMagicFunction(formatFn, dcrMagicFunctionFormat); attachDcrMagicFunction(formatFn, dcrMagicFunctionFormat);
if (FFlag::LuauDCRMagicFunctionTypeChecker)
attachDcrMagicFunctionTypeCheck(formatFn, dcrMagicFunctionTypeCheckFormat);
const TypeId stringToStringType = makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType}, /* checked */ true); const TypeId stringToStringType = makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType}, /* checked */ true);

View File

@ -6,7 +6,7 @@
#include "Luau/TypePack.h" #include "Luau/TypePack.h"
#include "Luau/Unifiable.h" #include "Luau/Unifiable.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
// For each `Luau::clone` call, we will clone only up to N amount of types _and_ packs, as controlled by this limit. // For each `Luau::clone` call, we will clone only up to N amount of types _and_ packs, as controlled by this limit.
LUAU_FASTINTVARIABLE(LuauTypeCloneIterationLimit, 100'000) LUAU_FASTINTVARIABLE(LuauTypeCloneIterationLimit, 100'000)
@ -191,7 +191,7 @@ private:
Property shallowClone(const Property& p) Property shallowClone(const Property& p)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
std::optional<TypeId> cloneReadTy; std::optional<TypeId> cloneReadTy;
if (auto ty = p.readTy) if (auto ty = p.readTy)

View File

@ -10,7 +10,7 @@
#include <optional> #include <optional>
LUAU_FASTFLAG(DebugLuauFreezeArena) LUAU_FASTFLAG(DebugLuauFreezeArena)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
namespace Luau namespace Luau
{ {
@ -139,7 +139,7 @@ DataFlowGraph DataFlowGraphBuilder::build(AstStatBlock* block, NotNull<InternalE
{ {
LUAU_TIMETRACE_SCOPE("DataFlowGraphBuilder::build", "Typechecking"); LUAU_TIMETRACE_SCOPE("DataFlowGraphBuilder::build", "Typechecking");
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
DataFlowGraphBuilder builder; DataFlowGraphBuilder builder;
builder.handle = handle; builder.handle = handle;

View File

@ -38,7 +38,7 @@ LUAU_FASTINT(LuauTarjanChildLimit)
LUAU_FASTFLAG(LuauInferInNoCheckMode) LUAU_FASTFLAG(LuauInferInNoCheckMode)
LUAU_FASTFLAGVARIABLE(LuauKnowsTheDataModel3, false) LUAU_FASTFLAGVARIABLE(LuauKnowsTheDataModel3, false)
LUAU_FASTFLAGVARIABLE(LuauStoreCommentsForDefinitionFiles, false) LUAU_FASTFLAGVARIABLE(LuauStoreCommentsForDefinitionFiles, false)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJson, false) LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJson, false)
LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJsonFile, false) LUAU_FASTFLAGVARIABLE(DebugLuauLogSolverToJsonFile, false)
LUAU_FASTFLAGVARIABLE(DebugLuauForbidInternalTypes, false) LUAU_FASTFLAGVARIABLE(DebugLuauForbidInternalTypes, false)
@ -473,7 +473,7 @@ CheckResult Frontend::check(const ModuleName& name, std::optional<FrontendOption
LUAU_TIMETRACE_ARGUMENT("name", name.c_str()); LUAU_TIMETRACE_ARGUMENT("name", name.c_str());
FrontendOptions frontendOptions = optionOverride.value_or(options); FrontendOptions frontendOptions = optionOverride.value_or(options);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
frontendOptions.forAutocomplete = false; frontendOptions.forAutocomplete = false;
if (std::optional<CheckResult> result = getCheckResult(name, true, frontendOptions.forAutocomplete)) if (std::optional<CheckResult> result = getCheckResult(name, true, frontendOptions.forAutocomplete))
@ -547,7 +547,7 @@ std::vector<ModuleName> Frontend::checkQueuedModules(
) )
{ {
FrontendOptions frontendOptions = optionOverride.value_or(options); FrontendOptions frontendOptions = optionOverride.value_or(options);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
frontendOptions.forAutocomplete = false; frontendOptions.forAutocomplete = false;
// By taking data into locals, we make sure queue is cleared at the end, even if an ICE or a different exception is thrown // By taking data into locals, we make sure queue is cleared at the end, even if an ICE or a different exception is thrown
@ -781,7 +781,7 @@ std::vector<ModuleName> Frontend::checkQueuedModules(
std::optional<CheckResult> Frontend::getCheckResult(const ModuleName& name, bool accumulateNested, bool forAutocomplete) std::optional<CheckResult> Frontend::getCheckResult(const ModuleName& name, bool accumulateNested, bool forAutocomplete)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
forAutocomplete = false; forAutocomplete = false;
auto it = sourceNodes.find(name); auto it = sourceNodes.find(name);
@ -1064,7 +1064,7 @@ void Frontend::checkBuildQueueItem(BuildQueueItem& item)
if (DFFlag::LuauRunCustomModuleChecks && item.options.customModuleCheck) if (DFFlag::LuauRunCustomModuleChecks && item.options.customModuleCheck)
item.options.customModuleCheck(sourceModule, *module); item.options.customModuleCheck(sourceModule, *module);
if (FFlag::DebugLuauDeferredConstraintResolution && mode == Mode::NoCheck) if (FFlag::LuauSolverV2 && mode == Mode::NoCheck)
module->errors.clear(); module->errors.clear();
if (item.options.runLintChecks) if (item.options.runLintChecks)
@ -1531,7 +1531,7 @@ ModulePtr Frontend::check(
TypeCheckLimits typeCheckLimits TypeCheckLimits typeCheckLimits
) )
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
auto prepareModuleScopeWrap = [this, forAutocomplete](const ModuleName& name, const ScopePtr& scope) auto prepareModuleScopeWrap = [this, forAutocomplete](const ModuleName& name, const ScopePtr& scope)
{ {

View File

@ -10,7 +10,7 @@
#include <algorithm> #include <algorithm>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
namespace Luau namespace Luau
{ {
@ -157,7 +157,7 @@ TypeId ReplaceGenerics::clean(TypeId ty)
clone.definitionLocation = ttv->definitionLocation; clone.definitionLocation = ttv->definitionLocation;
return addType(std::move(clone)); return addType(std::move(clone));
} }
else if (FFlag::DebugLuauDeferredConstraintResolution) else if (FFlag::LuauSolverV2)
{ {
TypeId res = freshType(NotNull{arena}, builtinTypes, scope); TypeId res = freshType(NotNull{arena}, builtinTypes, scope);
getMutable<FreeType>(res)->level = level; getMutable<FreeType>(res)->level = level;

View File

@ -14,7 +14,7 @@
LUAU_FASTINTVARIABLE(LuauSuggestionDistance, 4) LUAU_FASTINTVARIABLE(LuauSuggestionDistance, 4)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauAttribute) LUAU_FASTFLAG(LuauAttribute)
LUAU_FASTFLAG(LuauNativeAttribute) LUAU_FASTFLAG(LuauNativeAttribute)
@ -1971,7 +1971,7 @@ private:
bool visit(AstTypeTable* node) override bool visit(AstTypeTable* node) override
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
struct Rec struct Rec
{ {

View File

@ -14,7 +14,7 @@
#include <algorithm> #include <algorithm>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAGVARIABLE(LuauSkipEmptyInstantiations, false); LUAU_FASTFLAGVARIABLE(LuauSkipEmptyInstantiations, false);
namespace Luau namespace Luau
@ -220,7 +220,7 @@ void Module::clonePublicInterface(NotNull<BuiltinTypes> builtinTypes, InternalEr
ScopePtr moduleScope = getModuleScope(); ScopePtr moduleScope = getModuleScope();
TypePackId returnType = moduleScope->returnType; TypePackId returnType = moduleScope->returnType;
std::optional<TypePackId> varargPack = FFlag::DebugLuauDeferredConstraintResolution ? std::nullopt : moduleScope->varargPack; std::optional<TypePackId> varargPack = FFlag::LuauSolverV2 ? std::nullopt : moduleScope->varargPack;
TxnLog log; TxnLog log;
ClonePublicInterface clonePublicInterface{&log, builtinTypes, this}; ClonePublicInterface clonePublicInterface{&log, builtinTypes, this};

View File

@ -24,16 +24,16 @@ LUAU_FASTFLAGVARIABLE(LuauFixCyclicTablesBlowingStack, false);
// This could theoretically be 2000 on amd64, but x86 requires this. // This could theoretically be 2000 on amd64, but x86 requires this.
LUAU_FASTINTVARIABLE(LuauNormalizeIterationLimit, 1200); LUAU_FASTINTVARIABLE(LuauNormalizeIterationLimit, 1200);
LUAU_FASTINTVARIABLE(LuauNormalizeCacheLimit, 100000); LUAU_FASTINTVARIABLE(LuauNormalizeCacheLimit, 100000);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
static bool fixReduceStackPressure() static bool fixReduceStackPressure()
{ {
return FFlag::LuauFixReduceStackPressure || FFlag::DebugLuauDeferredConstraintResolution; return FFlag::LuauFixReduceStackPressure || FFlag::LuauSolverV2;
} }
static bool fixCyclicTablesBlowingStack() static bool fixCyclicTablesBlowingStack()
{ {
return FFlag::LuauFixCyclicTablesBlowingStack || FFlag::DebugLuauDeferredConstraintResolution; return FFlag::LuauFixCyclicTablesBlowingStack || FFlag::LuauSolverV2;
} }
namespace Luau namespace Luau
@ -42,7 +42,7 @@ namespace Luau
// helper to make `FFlag::LuauNormalizeAwayUninhabitableTables` not explicitly required when DCR is enabled. // helper to make `FFlag::LuauNormalizeAwayUninhabitableTables` not explicitly required when DCR is enabled.
static bool normalizeAwayUninhabitableTables() static bool normalizeAwayUninhabitableTables()
{ {
return FFlag::LuauNormalizeAwayUninhabitableTables || FFlag::DebugLuauDeferredConstraintResolution; return FFlag::LuauNormalizeAwayUninhabitableTables || FFlag::LuauSolverV2;
} }
static bool shouldEarlyExit(NormalizationResult res) static bool shouldEarlyExit(NormalizationResult res)
@ -553,7 +553,7 @@ NormalizationResult Normalizer::isInhabited(TypeId ty, Set<TypeId>& seen)
{ {
for (const auto& [_, prop] : ttv->props) for (const auto& [_, prop] : ttv->props)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// A table enclosing a read property whose type is uninhabitable is also itself uninhabitable, // A table enclosing a read property whose type is uninhabitable is also itself uninhabitable,
// but not its write property. That just means the write property doesn't exist, and so is readonly. // but not its write property. That just means the write property doesn't exist, and so is readonly.
@ -2583,7 +2583,7 @@ std::optional<TypeId> Normalizer::intersectionOfTables(TypeId here, TypeId there
{ {
const auto& [_name, tprop] = *tfound; const auto& [_name, tprop] = *tfound;
// TODO: variance issues here, which can't be fixed until we have read/write property types // TODO: variance issues here, which can't be fixed until we have read/write property types
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (hprop.readTy.has_value()) if (hprop.readTy.has_value())
{ {
@ -3249,7 +3249,7 @@ NormalizationResult Normalizer::intersectNormalWithTy(NormalizedType& here, Type
// this is a noop since an intersection with `unknown` is trivial. // this is a noop since an intersection with `unknown` is trivial.
return NormalizationResult::True; return NormalizationResult::True;
} }
else if ((FFlag::LuauNormalizeNotUnknownIntersection || FFlag::DebugLuauDeferredConstraintResolution) && get<UnknownType>(t)) else if ((FFlag::LuauNormalizeNotUnknownIntersection || FFlag::LuauSolverV2) && get<UnknownType>(t))
{ {
// if we're intersecting with `~unknown`, this is equivalent to intersecting with `never` // if we're intersecting with `~unknown`, this is equivalent to intersecting with `never`
// this means we should clear the type entirely. // this means we should clear the type entirely.
@ -3389,7 +3389,7 @@ TypeId Normalizer::typeFromNormal(const NormalizedType& norm)
if (!get<NeverType>(norm.buffers)) if (!get<NeverType>(norm.buffers))
result.push_back(builtinTypes->bufferType); result.push_back(builtinTypes->bufferType);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
result.reserve(result.size() + norm.tables.size()); result.reserve(result.size() + norm.tables.size());
for (auto table : norm.tables) for (auto table : norm.tables)
@ -3427,7 +3427,7 @@ bool isSubtype(TypeId subTy, TypeId superTy, NotNull<Scope> scope, NotNull<Built
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}}; Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
// Subtyping under DCR is not implemented using unification! // Subtyping under DCR is not implemented using unification!
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
Subtyping subtyping{builtinTypes, NotNull{&arena}, NotNull{&normalizer}, NotNull{&ice}}; Subtyping subtyping{builtinTypes, NotNull{&arena}, NotNull{&normalizer}, NotNull{&ice}};
@ -3449,7 +3449,7 @@ bool isSubtype(TypePackId subPack, TypePackId superPack, NotNull<Scope> scope, N
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}}; Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
// Subtyping under DCR is not implemented using unification! // Subtyping under DCR is not implemented using unification!
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
Subtyping subtyping{builtinTypes, NotNull{&arena}, NotNull{&normalizer}, NotNull{&ice}}; Subtyping subtyping{builtinTypes, NotNull{&arena}, NotNull{&normalizer}, NotNull{&ice}};
@ -3466,7 +3466,7 @@ bool isSubtype(TypePackId subPack, TypePackId superPack, NotNull<Scope> scope, N
bool isConsistentSubtype(TypeId subTy, TypeId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice) bool isConsistentSubtype(TypeId subTy, TypeId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice)
{ {
LUAU_ASSERT(!FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(!FFlag::LuauSolverV2);
UnifierSharedState sharedState{&ice}; UnifierSharedState sharedState{&ice};
TypeArena arena; TypeArena arena;
@ -3486,7 +3486,7 @@ bool isConsistentSubtype(
InternalErrorReporter& ice InternalErrorReporter& ice
) )
{ {
LUAU_ASSERT(!FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(!FFlag::LuauSolverV2);
UnifierSharedState sharedState{&ice}; UnifierSharedState sharedState{&ice};
TypeArena arena; TypeArena arena;

View File

@ -2,7 +2,7 @@
#include "Luau/Scope.h" #include "Luau/Scope.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
namespace Luau namespace Luau
{ {
@ -184,7 +184,7 @@ std::optional<Binding> Scope::linearSearchForBinding(const std::string& name, bo
// Updates the `this` scope with the assignments from the `childScope` including ones that doesn't exist in `this`. // Updates the `this` scope with the assignments from the `childScope` including ones that doesn't exist in `this`.
void Scope::inheritAssignments(const ScopePtr& childScope) void Scope::inheritAssignments(const ScopePtr& childScope)
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
for (const auto& [k, a] : childScope->lvalueTypes) for (const auto& [k, a] : childScope->lvalueTypes)
@ -194,7 +194,7 @@ void Scope::inheritAssignments(const ScopePtr& childScope)
// Updates the `this` scope with the refinements from the `childScope` excluding ones that doesn't exist in `this`. // Updates the `this` scope with the refinements from the `childScope` excluding ones that doesn't exist in `this`.
void Scope::inheritRefinements(const ScopePtr& childScope) void Scope::inheritRefinements(const ScopePtr& childScope)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
for (const auto& [k, a] : childScope->rvalueRefinements) for (const auto& [k, a] : childScope->rvalueRefinements)
{ {

View File

@ -12,7 +12,7 @@
#include <algorithm> #include <algorithm>
LUAU_FASTINT(LuauTypeReductionRecursionLimit) LUAU_FASTINT(LuauTypeReductionRecursionLimit)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_DYNAMIC_FASTINTVARIABLE(LuauSimplificationComplexityLimit, 8); LUAU_DYNAMIC_FASTINTVARIABLE(LuauSimplificationComplexityLimit, 8);
namespace Luau namespace Luau
@ -1398,7 +1398,7 @@ TypeId TypeSimplifier::simplify(TypeId ty, DenseHashSet<TypeId>& seen)
SimplifyResult simplifyIntersection(NotNull<BuiltinTypes> builtinTypes, NotNull<TypeArena> arena, TypeId left, TypeId right) SimplifyResult simplifyIntersection(NotNull<BuiltinTypes> builtinTypes, NotNull<TypeArena> arena, TypeId left, TypeId right)
{ {
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
TypeSimplifier s{builtinTypes, arena}; TypeSimplifier s{builtinTypes, arena};
@ -1413,7 +1413,7 @@ SimplifyResult simplifyIntersection(NotNull<BuiltinTypes> builtinTypes, NotNull<
SimplifyResult simplifyIntersection(NotNull<BuiltinTypes> builtinTypes, NotNull<TypeArena> arena, std::set<TypeId> parts) SimplifyResult simplifyIntersection(NotNull<BuiltinTypes> builtinTypes, NotNull<TypeArena> arena, std::set<TypeId> parts)
{ {
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
TypeSimplifier s{builtinTypes, arena}; TypeSimplifier s{builtinTypes, arena};
@ -1424,7 +1424,7 @@ SimplifyResult simplifyIntersection(NotNull<BuiltinTypes> builtinTypes, NotNull<
SimplifyResult simplifyUnion(NotNull<BuiltinTypes> builtinTypes, NotNull<TypeArena> arena, TypeId left, TypeId right) SimplifyResult simplifyUnion(NotNull<BuiltinTypes> builtinTypes, NotNull<TypeArena> arena, TypeId left, TypeId right)
{ {
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
TypeSimplifier s{builtinTypes, arena}; TypeSimplifier s{builtinTypes, arena};

View File

@ -9,7 +9,7 @@
#include <stdexcept> #include <stdexcept>
LUAU_FASTINTVARIABLE(LuauTarjanChildLimit, 10000) LUAU_FASTINTVARIABLE(LuauTarjanChildLimit, 10000)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTINTVARIABLE(LuauTarjanPreallocationSize, 256); LUAU_FASTINTVARIABLE(LuauTarjanPreallocationSize, 256);
namespace Luau namespace Luau
@ -182,7 +182,7 @@ void Tarjan::visitChildren(TypeId ty, int index)
LUAU_ASSERT(!ttv->boundTo); LUAU_ASSERT(!ttv->boundTo);
for (const auto& [name, prop] : ttv->props) for (const auto& [name, prop] : ttv->props)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
visitChild(prop.readTy); visitChild(prop.readTy);
visitChild(prop.writeTy); visitChild(prop.writeTy);
@ -740,7 +740,7 @@ void Substitution::replaceChildren(TypeId ty)
LUAU_ASSERT(!ttv->boundTo); LUAU_ASSERT(!ttv->boundTo);
for (auto& [name, prop] : ttv->props) for (auto& [name, prop] : ttv->props)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (prop.readTy) if (prop.readTy)
prop.readTy = replace(prop.readTy); prop.readTy = replace(prop.readTy);

View File

@ -3,7 +3,7 @@
#include "Luau/Common.h" #include "Luau/Common.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
namespace Luau namespace Luau
{ {
@ -14,7 +14,7 @@ bool Symbol::operator==(const Symbol& rhs) const
return local == rhs.local; return local == rhs.local;
else if (global.value) else if (global.value)
return rhs.global.value && global == rhs.global.value; // Subtlety: AstName::operator==(const char*) uses strcmp, not pointer identity. return rhs.global.value && global == rhs.global.value; // Subtlety: AstName::operator==(const char*) uses strcmp, not pointer identity.
else if (FFlag::DebugLuauDeferredConstraintResolution) else if (FFlag::LuauSolverV2)
return !rhs.local && !rhs.global.value; // Reflexivity: we already know `this` Symbol is empty, so check that rhs is. return !rhs.local && !rhs.global.value; // Reflexivity: we already know `this` Symbol is empty, so check that rhs is.
else else
return false; return false;

View File

@ -10,7 +10,7 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
namespace Luau namespace Luau
{ {
@ -254,7 +254,7 @@ void StateDot::visitChildren(TypeId ty, int index)
finishNodeLabel(ty); finishNodeLabel(ty);
finishNode(); finishNode();
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (!get<NeverType>(t.lowerBound)) if (!get<NeverType>(t.lowerBound))
visitChild(t.lowerBound, index, "[lowerBound]"); visitChild(t.lowerBound, index, "[lowerBound]");

View File

@ -19,7 +19,7 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
/* /*
* Enables increasing levels of verbosity for Luau type names when stringifying. * Enables increasing levels of verbosity for Luau type names when stringifying.
@ -83,10 +83,10 @@ struct FindCyclicTypes final : TypeVisitor
if (!visited.insert(ty)) if (!visited.insert(ty))
return false; return false;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// TODO: Replace these if statements with assert()s when we // TODO: Replace these if statements with assert()s when we
// delete FFlag::DebugLuauDeferredConstraintResolution. // delete FFlag::LuauSolverV2.
// //
// When the old solver is used, these pointers are always // When the old solver is used, these pointers are always
// unused. When the new solver is used, they are never null. // unused. When the new solver is used, they are never null.
@ -411,7 +411,7 @@ struct TypeStringifier
void stringify(const std::string& name, const Property& prop) void stringify(const std::string& name, const Property& prop)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return _newStringify(name, prop); return _newStringify(name, prop);
emitKey(name); emitKey(name);
@ -473,7 +473,7 @@ struct TypeStringifier
// TODO: ftv.lowerBound and ftv.upperBound should always be non-nil when // TODO: ftv.lowerBound and ftv.upperBound should always be non-nil when
// the new solver is used. This can be replaced with an assert. // the new solver is used. This can be replaced with an assert.
if (FFlag::DebugLuauDeferredConstraintResolution && ftv.lowerBound && ftv.upperBound) if (FFlag::LuauSolverV2 && ftv.lowerBound && ftv.upperBound)
{ {
const TypeId lowerBound = follow(ftv.lowerBound); const TypeId lowerBound = follow(ftv.lowerBound);
const TypeId upperBound = follow(ftv.upperBound); const TypeId upperBound = follow(ftv.upperBound);
@ -511,7 +511,7 @@ struct TypeStringifier
if (FInt::DebugLuauVerboseTypeNames >= 2) if (FInt::DebugLuauVerboseTypeNames >= 2)
{ {
state.emit("-"); state.emit("-");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
state.emitLevel(ftv.scope); state.emitLevel(ftv.scope);
else else
state.emit(ftv.level); state.emit(ftv.level);
@ -540,7 +540,7 @@ struct TypeStringifier
if (FInt::DebugLuauVerboseTypeNames >= 2) if (FInt::DebugLuauVerboseTypeNames >= 2)
{ {
state.emit("-"); state.emit("-");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
state.emitLevel(gtv.scope); state.emitLevel(gtv.scope);
else else
state.emit(gtv.level); state.emit(gtv.level);
@ -643,7 +643,7 @@ struct TypeStringifier
state.emit(">"); state.emit(">");
} }
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (ftv.isCheckedFunction) if (ftv.isCheckedFunction)
state.emit("@checked "); state.emit("@checked ");
@ -726,10 +726,10 @@ struct TypeStringifier
std::string openbrace = "@@@"; std::string openbrace = "@@@";
std::string closedbrace = "@@@?!"; std::string closedbrace = "@@@?!";
switch (state.opts.hideTableKind ? (FFlag::DebugLuauDeferredConstraintResolution ? TableState::Sealed : TableState::Unsealed) : ttv.state) switch (state.opts.hideTableKind ? (FFlag::LuauSolverV2 ? TableState::Sealed : TableState::Unsealed) : ttv.state)
{ {
case TableState::Sealed: case TableState::Sealed:
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
openbrace = "{"; openbrace = "{";
closedbrace = "}"; closedbrace = "}";
@ -742,7 +742,7 @@ struct TypeStringifier
} }
break; break;
case TableState::Unsealed: case TableState::Unsealed:
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
state.result.invalid = true; state.result.invalid = true;
openbrace = "{|"; openbrace = "{|";
@ -1200,7 +1200,7 @@ struct TypePackStringifier
if (FInt::DebugLuauVerboseTypeNames >= 2) if (FInt::DebugLuauVerboseTypeNames >= 2)
{ {
state.emit("-"); state.emit("-");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
state.emitLevel(pack.scope); state.emitLevel(pack.scope);
else else
state.emit(pack.level); state.emit(pack.level);
@ -1219,7 +1219,7 @@ struct TypePackStringifier
if (FInt::DebugLuauVerboseTypeNames >= 2) if (FInt::DebugLuauVerboseTypeNames >= 2)
{ {
state.emit("-"); state.emit("-");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
state.emitLevel(pack.scope); state.emitLevel(pack.scope);
else else
state.emit(pack.level); state.emit(pack.level);

View File

@ -752,7 +752,7 @@ TypeId Property::type() const
void Property::setType(TypeId ty) void Property::setType(TypeId ty)
{ {
readTy = ty; readTy = ty;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
writeTy = ty; writeTy = ty;
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
#include <stdexcept> #include <stdexcept>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
namespace Luau namespace Luau
{ {

View File

@ -13,7 +13,7 @@
#include <sstream> #include <sstream>
#include <type_traits> #include <type_traits>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
// Maximum number of steps to follow when traversing a path. May not always // Maximum number of steps to follow when traversing a path. May not always
// equate to the number of components in a path, depending on the traversal // equate to the number of components in a path, depending on the traversal
@ -29,7 +29,7 @@ namespace TypePath
Property::Property(std::string name) Property::Property(std::string name)
: name(std::move(name)) : name(std::move(name))
{ {
LUAU_ASSERT(!FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(!FFlag::LuauSolverV2);
} }
Property Property::read(std::string name) Property Property::read(std::string name)
@ -156,21 +156,21 @@ Path PathBuilder::build()
PathBuilder& PathBuilder::readProp(std::string name) PathBuilder& PathBuilder::readProp(std::string name)
{ {
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
components.push_back(Property{std::move(name), true}); components.push_back(Property{std::move(name), true});
return *this; return *this;
} }
PathBuilder& PathBuilder::writeProp(std::string name) PathBuilder& PathBuilder::writeProp(std::string name)
{ {
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
components.push_back(Property{std::move(name), false}); components.push_back(Property{std::move(name), false});
return *this; return *this;
} }
PathBuilder& PathBuilder::prop(std::string name) PathBuilder& PathBuilder::prop(std::string name)
{ {
LUAU_ASSERT(!FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(!FFlag::LuauSolverV2);
components.push_back(Property{std::move(name)}); components.push_back(Property{std::move(name)});
return *this; return *this;
} }
@ -343,7 +343,7 @@ struct TraversalState
if (prop) if (prop)
{ {
std::optional<TypeId> maybeType; std::optional<TypeId> maybeType;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
maybeType = property.isRead ? prop->readTy : prop->writeTy; maybeType = property.isRead ? prop->readTy : prop->writeTy;
else else
maybeType = prop->type(); maybeType = prop->type();
@ -540,7 +540,7 @@ std::string toString(const TypePath::Path& path, bool prefixDot)
if constexpr (std::is_same_v<T, TypePath::Property>) if constexpr (std::is_same_v<T, TypePath::Property>)
{ {
result << '['; result << '[';
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (c.isRead) if (c.isRead)
result << "read "; result << "read ";

View File

@ -9,7 +9,7 @@
#include <algorithm> #include <algorithm>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
namespace Luau namespace Luau
{ {
@ -153,7 +153,7 @@ std::optional<TypeId> findTablePropertyRespectingMeta(
const auto& it = tableType->props.find(name); const auto& it = tableType->props.find(name);
if (it != tableType->props.end()) if (it != tableType->props.end())
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
switch (context) switch (context)
{ {
@ -301,7 +301,7 @@ TypePack extendTypePack(
TypePack newPack; TypePack newPack;
newPack.tail = arena.freshTypePack(ftp->scope); newPack.tail = arena.freshTypePack(ftp->scope);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
result.tail = newPack.tail; result.tail = newPack.tail;
size_t overridesIndex = 0; size_t overridesIndex = 0;
while (result.head.size() < length) while (result.head.size() < length)
@ -313,7 +313,7 @@ TypePack extendTypePack(
} }
else else
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
FreeType ft{ftp->scope, builtinTypes->neverType, builtinTypes->unknownType}; FreeType ft{ftp->scope, builtinTypes->neverType, builtinTypes->unknownType};
t = arena.addType(ft); t = arena.addType(ft);
@ -426,7 +426,7 @@ TypeId stripNil(NotNull<BuiltinTypes> builtinTypes, TypeArena& arena, TypeId ty)
ErrorSuppression shouldSuppressErrors(NotNull<Normalizer> normalizer, TypeId ty) ErrorSuppression shouldSuppressErrors(NotNull<Normalizer> normalizer, TypeId ty)
{ {
LUAU_ASSERT(FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(FFlag::LuauSolverV2);
std::shared_ptr<const NormalizedType> normType = normalizer->normalize(ty); std::shared_ptr<const NormalizedType> normType = normalizer->normalize(ty);
if (!normType) if (!normType)

View File

@ -19,7 +19,7 @@ LUAU_FASTINT(LuauTypeInferTypePackLoopLimit)
LUAU_FASTFLAG(LuauErrorRecoveryType) LUAU_FASTFLAG(LuauErrorRecoveryType)
LUAU_FASTFLAGVARIABLE(LuauInstantiateInSubtyping, false) LUAU_FASTFLAGVARIABLE(LuauInstantiateInSubtyping, false)
LUAU_FASTFLAGVARIABLE(LuauTransitiveSubtyping, false) LUAU_FASTFLAGVARIABLE(LuauTransitiveSubtyping, false)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAGVARIABLE(LuauFixIndexerSubtypingOrdering, false) LUAU_FASTFLAGVARIABLE(LuauFixIndexerSubtypingOrdering, false)
LUAU_FASTFLAGVARIABLE(LuauUnifierShouldNotCopyError, false) LUAU_FASTFLAGVARIABLE(LuauUnifierShouldNotCopyError, false)
LUAU_FASTFLAGVARIABLE(LuauUnifierRecursionOnRestart, false) LUAU_FASTFLAGVARIABLE(LuauUnifierRecursionOnRestart, false)
@ -405,7 +405,7 @@ Unifier::Unifier(NotNull<Normalizer> normalizer, NotNull<Scope> scope, const Loc
LUAU_ASSERT(sharedState.iceHandler); LUAU_ASSERT(sharedState.iceHandler);
// Unifier is not usable when this flag is enabled! Please consider using Subtyping instead. // Unifier is not usable when this flag is enabled! Please consider using Subtyping instead.
LUAU_ASSERT(!FFlag::DebugLuauDeferredConstraintResolution); LUAU_ASSERT(!FFlag::LuauSolverV2);
} }
void Unifier::tryUnify(TypeId subTy, TypeId superTy, bool isFunctionCall, bool isIntersection, const LiteralProperties* literalProperties) void Unifier::tryUnify(TypeId subTy, TypeId superTy, bool isFunctionCall, bool isIntersection, const LiteralProperties* literalProperties)
@ -1646,7 +1646,7 @@ void Unifier::tryUnify_(TypePackId subTp, TypePackId superTp, bool isFunctionCal
auto mkFreshType = [this](Scope* scope, TypeLevel level) auto mkFreshType = [this](Scope* scope, TypeLevel level)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return freshType(NotNull{types}, builtinTypes, scope); return freshType(NotNull{types}, builtinTypes, scope);
else else
return types->freshType(scope, level); return types->freshType(scope, level);

View File

@ -16,7 +16,7 @@ LUAU_FASTINTVARIABLE(LuauParseErrorLimit, 100)
// Warning: If you are introducing new syntax, ensure that it is behind a separate // Warning: If you are introducing new syntax, ensure that it is behind a separate
// flag so that we don't break production games by reverting syntax changes. // flag so that we don't break production games by reverting syntax changes.
// See docs/SyntaxChanges.md for an explanation. // See docs/SyntaxChanges.md for an explanation.
LUAU_FASTFLAGVARIABLE(DebugLuauDeferredConstraintResolution, false) LUAU_FASTFLAGVARIABLE(LuauSolverV2, false)
LUAU_FASTFLAGVARIABLE(LuauNativeAttribute, false) LUAU_FASTFLAGVARIABLE(LuauNativeAttribute, false)
LUAU_FASTFLAGVARIABLE(LuauAttributeSyntaxFunExpr, false) LUAU_FASTFLAGVARIABLE(LuauAttributeSyntaxFunExpr, false)
LUAU_FASTFLAGVARIABLE(LuauUserDefinedTypeFunctions, false) LUAU_FASTFLAGVARIABLE(LuauUserDefinedTypeFunctions, false)

View File

@ -441,7 +441,7 @@ enum LuauBytecodeTag
// Bytecode version; runtime supports [MIN, MAX], compiler emits TARGET by default but may emit a higher version when flags are enabled // Bytecode version; runtime supports [MIN, MAX], compiler emits TARGET by default but may emit a higher version when flags are enabled
LBC_VERSION_MIN = 3, LBC_VERSION_MIN = 3,
LBC_VERSION_MAX = 6, LBC_VERSION_MAX = 6,
LBC_VERSION_TARGET = 5, LBC_VERSION_TARGET = 6,
// Type encoding version // Type encoding version
LBC_TYPE_VERSION_MIN = 1, LBC_TYPE_VERSION_MIN = 1,
LBC_TYPE_VERSION_MAX = 3, LBC_TYPE_VERSION_MAX = 3,

View File

@ -14,6 +14,7 @@ inline bool isFlagExperimental(const char* flag)
"LuauInstantiateInSubtyping", // requires some fixes to lua-apps code "LuauInstantiateInSubtyping", // requires some fixes to lua-apps code
"LuauFixIndexerSubtypingOrdering", // requires some small fixes to lua-apps code since this fixes a false negative "LuauFixIndexerSubtypingOrdering", // requires some small fixes to lua-apps code since this fixes a false negative
"StudioReportLuauAny2", // takes telemetry data for usage of any types "StudioReportLuauAny2", // takes telemetry data for usage of any types
"LuauSolverV2",
// makes sure we always have at least one entry // makes sure we always have at least one entry
nullptr, nullptr,
}; };

View File

@ -7,9 +7,6 @@
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h>
LUAU_FASTFLAG(LuauCompileUserdataInfo)
LUAU_FASTFLAG(LuauCompileFastcall3)
namespace Luau namespace Luau
{ {
@ -334,8 +331,6 @@ unsigned int BytecodeBuilder::addStringTableEntry(StringRef value)
const char* BytecodeBuilder::tryGetUserdataTypeName(LuauBytecodeType type) const const char* BytecodeBuilder::tryGetUserdataTypeName(LuauBytecodeType type) const
{ {
LUAU_ASSERT(FFlag::LuauCompileUserdataInfo);
unsigned index = unsigned((type & ~LBC_TYPE_OPTIONAL_BIT) - LBC_TYPE_TAGGED_USERDATA_BASE); unsigned index = unsigned((type & ~LBC_TYPE_OPTIONAL_BIT) - LBC_TYPE_TAGGED_USERDATA_BASE);
if (index < userdataTypes.size()) if (index < userdataTypes.size())
@ -575,8 +570,6 @@ void BytecodeBuilder::pushUpvalTypeInfo(LuauBytecodeType type)
uint32_t BytecodeBuilder::addUserdataType(const char* name) uint32_t BytecodeBuilder::addUserdataType(const char* name)
{ {
LUAU_ASSERT(FFlag::LuauCompileUserdataInfo);
UserdataType ty; UserdataType ty;
ty.name = name; ty.name = name;
@ -587,8 +580,6 @@ uint32_t BytecodeBuilder::addUserdataType(const char* name)
void BytecodeBuilder::useUserdataType(uint32_t index) void BytecodeBuilder::useUserdataType(uint32_t index)
{ {
LUAU_ASSERT(FFlag::LuauCompileUserdataInfo);
userdataTypes[index].used = true; userdataTypes[index].used = true;
} }
@ -673,14 +664,11 @@ void BytecodeBuilder::finalize()
{ {
LUAU_ASSERT(bytecode.empty()); LUAU_ASSERT(bytecode.empty());
if (FFlag::LuauCompileUserdataInfo)
{
for (auto& ty : userdataTypes) for (auto& ty : userdataTypes)
{ {
if (ty.used) if (ty.used)
ty.nameRef = addStringTableEntry(StringRef({ty.name.c_str(), ty.name.length()})); ty.nameRef = addStringTableEntry(StringRef({ty.name.c_str(), ty.name.length()}));
} }
}
// preallocate space for bytecode blob // preallocate space for bytecode blob
size_t capacity = 16; size_t capacity = 16;
@ -705,7 +693,6 @@ void BytecodeBuilder::finalize()
writeStringTable(bytecode); writeStringTable(bytecode);
if (FFlag::LuauCompileUserdataInfo)
{ {
// Write the mapping between used type name indices and their name // Write the mapping between used type name indices and their name
for (uint32_t i = 0; i < uint32_t(userdataTypes.size()); i++) for (uint32_t i = 0; i < uint32_t(userdataTypes.size()); i++)
@ -1232,19 +1219,12 @@ std::string BytecodeBuilder::getError(const std::string& message)
uint8_t BytecodeBuilder::getVersion() uint8_t BytecodeBuilder::getVersion()
{ {
// This function usually returns LBC_VERSION_TARGET but may sometimes return a higher number (within LBC_VERSION_MIN/MAX) under fast flags
if (FFlag::LuauCompileFastcall3)
return 6;
return LBC_VERSION_TARGET; return LBC_VERSION_TARGET;
} }
uint8_t BytecodeBuilder::getTypeEncodingVersion() uint8_t BytecodeBuilder::getTypeEncodingVersion()
{ {
if (FFlag::LuauCompileUserdataInfo)
return LBC_TYPE_VERSION_TARGET; return LBC_TYPE_VERSION_TARGET;
return 2;
} }
#ifdef LUAU_ASSERTENABLED #ifdef LUAU_ASSERTENABLED
@ -1617,8 +1597,6 @@ void BytecodeBuilder::validateInstructions() const
break; break;
case LOP_FASTCALL3: case LOP_FASTCALL3:
LUAU_ASSERT(FFlag::LuauCompileFastcall3);
VREG(LUAU_INSN_B(insn)); VREG(LUAU_INSN_B(insn));
VJUMP(LUAU_INSN_C(insn)); VJUMP(LUAU_INSN_C(insn));
LUAU_ASSERT(LUAU_INSN_OP(insns[i + 1 + LUAU_INSN_C(insn)]) == LOP_CALL); LUAU_ASSERT(LUAU_INSN_OP(insns[i + 1 + LUAU_INSN_C(insn)]) == LOP_CALL);
@ -2240,8 +2218,6 @@ void BytecodeBuilder::dumpInstruction(const uint32_t* code, std::string& result,
break; break;
case LOP_FASTCALL3: case LOP_FASTCALL3:
LUAU_ASSERT(FFlag::LuauCompileFastcall3);
formatAppend(result, "FASTCALL3 %d R%d R%d R%d L%d\n", LUAU_INSN_A(insn), LUAU_INSN_B(insn), *code & 0xff, (*code >> 8) & 0xff, targetLabel); formatAppend(result, "FASTCALL3 %d R%d R%d R%d L%d\n", LUAU_INSN_A(insn), LUAU_INSN_B(insn), *code & 0xff, (*code >> 8) & 0xff, targetLabel);
code++; code++;
break; break;
@ -2373,8 +2349,6 @@ std::string BytecodeBuilder::dumpCurrentFunction(std::vector<int>& dumpinstoffs)
{ {
const std::string& typeinfo = functions.back().typeinfo; const std::string& typeinfo = functions.back().typeinfo;
if (FFlag::LuauCompileUserdataInfo)
{
// Arguments start from third byte in function typeinfo string // Arguments start from third byte in function typeinfo string
for (uint8_t i = 2; i < typeinfo.size(); ++i) for (uint8_t i = 2; i < typeinfo.size(); ++i)
{ {
@ -2409,40 +2383,6 @@ std::string BytecodeBuilder::dumpCurrentFunction(std::vector<int>& dumpinstoffs)
formatAppend(result, "R%d: %s%s from %d to %d\n", l.reg, name, optional, l.startpc, l.endpc); formatAppend(result, "R%d: %s%s from %d to %d\n", l.reg, name, optional, l.startpc, l.endpc);
} }
} }
else
{
// Arguments start from third byte in function typeinfo string
for (uint8_t i = 2; i < typeinfo.size(); ++i)
{
uint8_t et = typeinfo[i];
const char* base = getBaseTypeString(et);
const char* optional = (et & LBC_TYPE_OPTIONAL_BIT) ? "?" : "";
formatAppend(result, "R%d: %s%s [argument]\n", i - 2, base, optional);
}
for (size_t i = 0; i < typedUpvals.size(); ++i)
{
const TypedUpval& l = typedUpvals[i];
const char* base = getBaseTypeString(l.type);
const char* optional = (l.type & LBC_TYPE_OPTIONAL_BIT) ? "?" : "";
formatAppend(result, "U%d: %s%s\n", int(i), base, optional);
}
for (size_t i = 0; i < typedLocals.size(); ++i)
{
const TypedLocal& l = typedLocals[i];
const char* base = getBaseTypeString(l.type);
const char* optional = (l.type & LBC_TYPE_OPTIONAL_BIT) ? "?" : "";
formatAppend(result, "R%d: %s%s from %d to %d\n", l.reg, base, optional, l.startpc, l.endpc);
}
}
}
std::vector<int> labels(insns.size(), -1); std::vector<int> labels(insns.size(), -1);

View File

@ -26,9 +26,6 @@ LUAU_FASTINTVARIABLE(LuauCompileInlineThreshold, 25)
LUAU_FASTINTVARIABLE(LuauCompileInlineThresholdMaxBoost, 300) LUAU_FASTINTVARIABLE(LuauCompileInlineThresholdMaxBoost, 300)
LUAU_FASTINTVARIABLE(LuauCompileInlineDepth, 5) LUAU_FASTINTVARIABLE(LuauCompileInlineDepth, 5)
LUAU_FASTFLAGVARIABLE(LuauCompileUserdataInfo, false)
LUAU_FASTFLAGVARIABLE(LuauCompileFastcall3, false)
LUAU_FASTFLAG(LuauNativeAttribute) LUAU_FASTFLAG(LuauNativeAttribute)
namespace Luau namespace Luau
@ -469,18 +466,11 @@ struct Compiler
{ {
LUAU_ASSERT(!expr->self); LUAU_ASSERT(!expr->self);
LUAU_ASSERT(expr->args.size >= 1); LUAU_ASSERT(expr->args.size >= 1);
if (FFlag::LuauCompileFastcall3)
LUAU_ASSERT(expr->args.size <= 3); LUAU_ASSERT(expr->args.size <= 3);
else
LUAU_ASSERT(expr->args.size <= 2 || (bfid == LBF_BIT32_EXTRACTK && expr->args.size == 3));
LUAU_ASSERT(bfid == LBF_BIT32_EXTRACTK ? bfK >= 0 : bfK < 0); LUAU_ASSERT(bfid == LBF_BIT32_EXTRACTK ? bfK >= 0 : bfK < 0);
LuauOpcode opc = LOP_NOP; LuauOpcode opc = LOP_NOP;
if (FFlag::LuauCompileFastcall3)
{
if (expr->args.size == 1) if (expr->args.size == 1)
opc = LOP_FASTCALL1; opc = LOP_FASTCALL1;
else if (bfK >= 0 || (expr->args.size == 2 && isConstant(expr->args.data[1]))) else if (bfK >= 0 || (expr->args.size == 2 && isConstant(expr->args.data[1])))
@ -489,13 +479,6 @@ struct Compiler
opc = LOP_FASTCALL2; opc = LOP_FASTCALL2;
else else
opc = LOP_FASTCALL3; opc = LOP_FASTCALL3;
}
else
{
opc = expr->args.size == 1 ? LOP_FASTCALL1
: (bfK >= 0 || (expr->args.size == 2 && isConstant(expr->args.data[1]))) ? LOP_FASTCALL2K
: LOP_FASTCALL2;
}
uint32_t args[3] = {}; uint32_t args[3] = {};
@ -524,7 +507,7 @@ struct Compiler
bytecode.emitABC(opc, uint8_t(bfid), uint8_t(args[0]), 0); bytecode.emitABC(opc, uint8_t(bfid), uint8_t(args[0]), 0);
if (FFlag::LuauCompileFastcall3 && opc == LOP_FASTCALL3) if (opc == LOP_FASTCALL3)
{ {
LUAU_ASSERT(bfK < 0); LUAU_ASSERT(bfK < 0);
bytecode.emitAux(args[1] | (args[2] << 8)); bytecode.emitAux(args[1] | (args[2] << 8));
@ -886,7 +869,7 @@ struct Compiler
unsigned maxFastcallArgs = 2; unsigned maxFastcallArgs = 2;
// Fastcall with 3 arguments is only used if it can help save one or more move instructions // Fastcall with 3 arguments is only used if it can help save one or more move instructions
if (FFlag::LuauCompileFastcall3 && bfid >= 0 && expr->args.size == 3) if (bfid >= 0 && expr->args.size == 3)
{ {
for (size_t i = 0; i < expr->args.size; ++i) for (size_t i = 0; i < expr->args.size; ++i)
{ {
@ -899,7 +882,7 @@ struct Compiler
} }
// Optimization: for 1/2/3 argument fast calls use specialized opcodes // Optimization: for 1/2/3 argument fast calls use specialized opcodes
if (bfid >= 0 && expr->args.size >= 1 && expr->args.size <= (FFlag::LuauCompileFastcall3 ? maxFastcallArgs : 2u)) if (bfid >= 0 && expr->args.size >= 1 && expr->args.size <= maxFastcallArgs)
{ {
if (!isExprMultRet(expr->args.data[expr->args.size - 1])) if (!isExprMultRet(expr->args.data[expr->args.size - 1]))
{ {
@ -4231,8 +4214,6 @@ void compileOrThrow(BytecodeBuilder& bytecode, const ParseResult& parseResult, c
predictTableShapes(compiler.tableShapes, root); predictTableShapes(compiler.tableShapes, root);
} }
if (FFlag::LuauCompileUserdataInfo)
{
if (const char* const* ptr = options.userdataTypes) if (const char* const* ptr = options.userdataTypes)
{ {
for (; *ptr; ++ptr) for (; *ptr; ++ptr)
@ -4245,7 +4226,6 @@ void compileOrThrow(BytecodeBuilder& bytecode, const ParseResult& parseResult, c
if (uintptr_t(ptr - options.userdataTypes) > (LBC_TYPE_TAGGED_USERDATA_END - LBC_TYPE_TAGGED_USERDATA_BASE)) if (uintptr_t(ptr - options.userdataTypes) > (LBC_TYPE_TAGGED_USERDATA_END - LBC_TYPE_TAGGED_USERDATA_BASE))
CompileError::raise(root->location, "Exceeded userdata type limit in the compilation options"); CompileError::raise(root->location, "Exceeded userdata type limit in the compilation options");
} }
}
// computes type information for all functions based on type annotations // computes type information for all functions based on type annotations
if (options.typeInfoLevel >= 1) if (options.typeInfoLevel >= 1)

View File

@ -3,8 +3,6 @@
#include "Luau/BytecodeBuilder.h" #include "Luau/BytecodeBuilder.h"
LUAU_FASTFLAG(LuauCompileUserdataInfo)
namespace Luau namespace Luau
{ {
@ -70,14 +68,11 @@ static LuauBytecodeType getType(
if (LuauBytecodeType prim = getPrimitiveType(ref->name); prim != LBC_TYPE_INVALID) if (LuauBytecodeType prim = getPrimitiveType(ref->name); prim != LBC_TYPE_INVALID)
return prim; return prim;
if (FFlag::LuauCompileUserdataInfo)
{
if (const uint8_t* userdataIndex = userdataTypes.find(ref->name)) if (const uint8_t* userdataIndex = userdataTypes.find(ref->name))
{ {
bytecode.useUserdataType(*userdataIndex); bytecode.useUserdataType(*userdataIndex);
return LuauBytecodeType(LBC_TYPE_TAGGED_USERDATA_BASE + *userdataIndex); return LuauBytecodeType(LBC_TYPE_TAGGED_USERDATA_BASE + *userdataIndex);
} }
}
// not primitive or alias or generic => host-provided, we assume userdata for now // not primitive or alias or generic => host-provided, we assume userdata for now
return LBC_TYPE_USERDATA; return LBC_TYPE_USERDATA;

View File

@ -56,7 +56,7 @@ LUAU_FASTINT(LuauTypeInferIterationLimit)
LUAU_FASTINT(LuauTarjanChildLimit) LUAU_FASTINT(LuauTarjanChildLimit)
LUAU_FASTFLAG(DebugLuauFreezeArena) LUAU_FASTFLAG(DebugLuauFreezeArena)
LUAU_FASTFLAG(DebugLuauAbortingChecks) LUAU_FASTFLAG(DebugLuauAbortingChecks)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
std::chrono::milliseconds kInterruptTimeout(10); std::chrono::milliseconds kInterruptTimeout(10);
std::chrono::time_point<std::chrono::system_clock> interruptDeadline; std::chrono::time_point<std::chrono::system_clock> interruptDeadline;
@ -247,7 +247,7 @@ DEFINE_PROTO_FUZZER(const luau::ModuleSet& message)
FFlag::DebugLuauFreezeArena.value = true; FFlag::DebugLuauFreezeArena.value = true;
FFlag::DebugLuauAbortingChecks.value = true; FFlag::DebugLuauAbortingChecks.value = true;
FFlag::DebugLuauDeferredConstraintResolution.value = kFuzzUseNewSolver; FFlag::LuauSolverV2.value = kFuzzUseNewSolver;
std::vector<std::string> sources = protoprint(message, kFuzzTypes); std::vector<std::string> sources = protoprint(message, kFuzzTypes);

View File

@ -14,7 +14,7 @@ using namespace Luau;
using Pattern = AnyTypeSummary::Pattern; using Pattern = AnyTypeSummary::Pattern;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(DebugLuauFreezeArena) LUAU_FASTFLAG(DebugLuauFreezeArena)
LUAU_FASTFLAG(DebugLuauMagicTypes) LUAU_FASTFLAG(DebugLuauMagicTypes)
LUAU_FASTFLAG(StudioReportLuauAny2) LUAU_FASTFLAG(StudioReportLuauAny2)
@ -35,7 +35,7 @@ TEST_SUITE_BEGIN("AnyTypeSummaryTest");
TEST_CASE_FIXTURE(ATSFixture, "var_typepack_any") TEST_CASE_FIXTURE(ATSFixture, "var_typepack_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -56,7 +56,7 @@ type A = (number, string) -> ...any
TEST_CASE_FIXTURE(ATSFixture, "export_alias") TEST_CASE_FIXTURE(ATSFixture, "export_alias")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -77,7 +77,7 @@ export type t8<t8> = t0 &(<t0 ...>(true | any)->(''))
TEST_CASE_FIXTURE(ATSFixture, "typepacks") TEST_CASE_FIXTURE(ATSFixture, "typepacks")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -103,7 +103,7 @@ end
TEST_CASE_FIXTURE(ATSFixture, "typepacks_no_ret") TEST_CASE_FIXTURE(ATSFixture, "typepacks_no_ret")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -128,7 +128,7 @@ end
TEST_CASE_FIXTURE(ATSFixture, "var_typepack_any_gen_table") TEST_CASE_FIXTURE(ATSFixture, "var_typepack_any_gen_table")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -149,7 +149,7 @@ type Pair<T> = {first: T, second: any}
TEST_CASE_FIXTURE(ATSFixture, "assign_uneq") TEST_CASE_FIXTURE(ATSFixture, "assign_uneq")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -173,7 +173,7 @@ local x, y, z = greetings("Dibri") -- mismatch
TEST_CASE_FIXTURE(ATSFixture, "var_typepack_any_gen") TEST_CASE_FIXTURE(ATSFixture, "var_typepack_any_gen")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -195,7 +195,7 @@ type Pair<T> = (boolean, T) -> ...any
TEST_CASE_FIXTURE(ATSFixture, "typeof_any_in_func") TEST_CASE_FIXTURE(ATSFixture, "typeof_any_in_func")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -219,7 +219,7 @@ TEST_CASE_FIXTURE(ATSFixture, "typeof_any_in_func")
TEST_CASE_FIXTURE(ATSFixture, "generic_types") TEST_CASE_FIXTURE(ATSFixture, "generic_types")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -249,7 +249,7 @@ foo(addNumbers)
TEST_CASE_FIXTURE(ATSFixture, "no_annot") TEST_CASE_FIXTURE(ATSFixture, "no_annot")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -268,7 +268,7 @@ local character = script.Parent
TEST_CASE_FIXTURE(ATSFixture, "if_any") TEST_CASE_FIXTURE(ATSFixture, "if_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -302,7 +302,7 @@ end
TEST_CASE_FIXTURE(ATSFixture, "variadic_any") TEST_CASE_FIXTURE(ATSFixture, "variadic_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -327,7 +327,7 @@ TEST_CASE_FIXTURE(ATSFixture, "variadic_any")
TEST_CASE_FIXTURE(ATSFixture, "type_alias_intersection") TEST_CASE_FIXTURE(ATSFixture, "type_alias_intersection")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -351,7 +351,7 @@ TEST_CASE_FIXTURE(ATSFixture, "type_alias_intersection")
TEST_CASE_FIXTURE(ATSFixture, "var_func_arg") TEST_CASE_FIXTURE(ATSFixture, "var_func_arg")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -379,7 +379,7 @@ TEST_CASE_FIXTURE(ATSFixture, "var_func_arg")
TEST_CASE_FIXTURE(ATSFixture, "var_func_apps") TEST_CASE_FIXTURE(ATSFixture, "var_func_apps")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -404,7 +404,7 @@ TEST_CASE_FIXTURE(ATSFixture, "var_func_apps")
TEST_CASE_FIXTURE(ATSFixture, "CannotExtendTable") TEST_CASE_FIXTURE(ATSFixture, "CannotExtendTable")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -431,7 +431,7 @@ end
TEST_CASE_FIXTURE(ATSFixture, "unknown_symbol") TEST_CASE_FIXTURE(ATSFixture, "unknown_symbol")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -455,7 +455,7 @@ end
TEST_CASE_FIXTURE(ATSFixture, "racing_3_short") TEST_CASE_FIXTURE(ATSFixture, "racing_3_short")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -496,7 +496,7 @@ initialize()
TEST_CASE_FIXTURE(ATSFixture, "racing_collision_2") TEST_CASE_FIXTURE(ATSFixture, "racing_collision_2")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -579,7 +579,7 @@ initialize()
TEST_CASE_FIXTURE(ATSFixture, "racing_spawning_1") TEST_CASE_FIXTURE(ATSFixture, "racing_spawning_1")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -651,7 +651,7 @@ initialize()
TEST_CASE_FIXTURE(ATSFixture, "mutually_recursive_generic") TEST_CASE_FIXTURE(ATSFixture, "mutually_recursive_generic")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -676,7 +676,7 @@ TEST_CASE_FIXTURE(ATSFixture, "mutually_recursive_generic")
TEST_CASE_FIXTURE(ATSFixture, "explicit_pack") TEST_CASE_FIXTURE(ATSFixture, "explicit_pack")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -698,7 +698,7 @@ type Bar = Foo<(number, any)>
TEST_CASE_FIXTURE(ATSFixture, "local_val") TEST_CASE_FIXTURE(ATSFixture, "local_val")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -719,7 +719,7 @@ local a, b, c = 1 :: any
TEST_CASE_FIXTURE(ATSFixture, "var_any_local") TEST_CASE_FIXTURE(ATSFixture, "var_any_local")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -743,7 +743,7 @@ local x: number, y: any, z, h: nil = 1, nil
TEST_CASE_FIXTURE(ATSFixture, "table_uses_any") TEST_CASE_FIXTURE(ATSFixture, "table_uses_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -766,7 +766,7 @@ TEST_CASE_FIXTURE(ATSFixture, "table_uses_any")
TEST_CASE_FIXTURE(ATSFixture, "typeof_any") TEST_CASE_FIXTURE(ATSFixture, "typeof_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -789,7 +789,7 @@ TEST_CASE_FIXTURE(ATSFixture, "typeof_any")
TEST_CASE_FIXTURE(ATSFixture, "table_type_assigned") TEST_CASE_FIXTURE(ATSFixture, "table_type_assigned")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -813,7 +813,7 @@ TEST_CASE_FIXTURE(ATSFixture, "table_type_assigned")
TEST_CASE_FIXTURE(ATSFixture, "simple_func_wo_ret") TEST_CASE_FIXTURE(ATSFixture, "simple_func_wo_ret")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -835,7 +835,7 @@ TEST_CASE_FIXTURE(ATSFixture, "simple_func_wo_ret")
TEST_CASE_FIXTURE(ATSFixture, "simple_func_w_ret") TEST_CASE_FIXTURE(ATSFixture, "simple_func_w_ret")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -858,7 +858,7 @@ TEST_CASE_FIXTURE(ATSFixture, "simple_func_w_ret")
TEST_CASE_FIXTURE(ATSFixture, "nested_local") TEST_CASE_FIXTURE(ATSFixture, "nested_local")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -882,7 +882,7 @@ TEST_CASE_FIXTURE(ATSFixture, "nested_local")
TEST_CASE_FIXTURE(ATSFixture, "generic_func") TEST_CASE_FIXTURE(ATSFixture, "generic_func")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -905,7 +905,7 @@ TEST_CASE_FIXTURE(ATSFixture, "generic_func")
TEST_CASE_FIXTURE(ATSFixture, "type_alias_any") TEST_CASE_FIXTURE(ATSFixture, "type_alias_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -927,7 +927,7 @@ TEST_CASE_FIXTURE(ATSFixture, "type_alias_any")
TEST_CASE_FIXTURE(ATSFixture, "multi_module_any") TEST_CASE_FIXTURE(ATSFixture, "multi_module_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };
@ -960,7 +960,7 @@ TEST_CASE_FIXTURE(ATSFixture, "multi_module_any")
TEST_CASE_FIXTURE(ATSFixture, "cast_on_cyclic_req") TEST_CASE_FIXTURE(ATSFixture, "cast_on_cyclic_req")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::StudioReportLuauAny2, true}, {FFlag::StudioReportLuauAny2, true},
}; };

View File

@ -6,8 +6,6 @@
#include "doctest.h" #include "doctest.h"
#include "Fixture.h" #include "Fixture.h"
LUAU_FASTFLAG(LuauFixBindingForGlobalPos);
using namespace Luau; using namespace Luau;
struct DocumentationSymbolFixture : BuiltinsFixture struct DocumentationSymbolFixture : BuiltinsFixture
@ -171,7 +169,7 @@ TEST_SUITE_BEGIN("AstQuery");
TEST_CASE_FIXTURE(Fixture, "last_argument_function_call_type") TEST_CASE_FIXTURE(Fixture, "last_argument_function_call_type")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
check(R"( check(R"(
local function foo() return 2 end local function foo() return 2 end
@ -353,7 +351,7 @@ TEST_CASE_FIXTURE(Fixture, "find_expr_ancestry")
TEST_CASE_FIXTURE(BuiltinsFixture, "find_binding_at_position_global_start_of_file") TEST_CASE_FIXTURE(BuiltinsFixture, "find_binding_at_position_global_start_of_file")
{ {
ScopedFastFlag sff{FFlag::LuauFixBindingForGlobalPos, true};
check("local x = string.char(1)"); check("local x = string.char(1)");
const Position pos(0, 12); const Position pos(0, 12);

View File

@ -110,7 +110,7 @@ struct ACFixtureImpl : BaseType
); );
freeze(globals.globalTypes); freeze(globals.globalTypes);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
GlobalTypes& globals = this->frontend.globals; GlobalTypes& globals = this->frontend.globals;
unfreeze(globals.globalTypes); unfreeze(globals.globalTypes);
@ -1607,7 +1607,7 @@ return target(a.@1
TEST_CASE_FIXTURE(ACFixture, "type_correct_suggestion_in_table") TEST_CASE_FIXTURE(ACFixture, "type_correct_suggestion_in_table")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) // CLI-116815 Autocomplete cannot suggest keys while autocompleting inside of a table if (FFlag::LuauSolverV2) // CLI-116815 Autocomplete cannot suggest keys while autocompleting inside of a table
return; return;
check(R"( check(R"(
@ -2213,7 +2213,7 @@ local fp: @1= f
auto ac = autocomplete('1'); auto ac = autocomplete('1');
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
REQUIRE_EQ("({ x: number, y: number }) -> number", toString(requireType("f"))); REQUIRE_EQ("({ x: number, y: number }) -> number", toString(requireType("f")));
else else
REQUIRE_EQ("({| x: number, y: number |}) -> number", toString(requireType("f"))); REQUIRE_EQ("({| x: number, y: number |}) -> number", toString(requireType("f")));
@ -2264,7 +2264,7 @@ local ec = e(f@5)
TEST_CASE_FIXTURE(ACFixture, "type_correct_suggestion_for_overloads") TEST_CASE_FIXTURE(ACFixture, "type_correct_suggestion_for_overloads")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) // CLI-116814 Autocomplete needs to populate expected types for function arguments correctly if (FFlag::LuauSolverV2) // CLI-116814 Autocomplete needs to populate expected types for function arguments correctly
// (overloads and singletons) // (overloads and singletons)
return; return;
check(R"( check(R"(
@ -2614,7 +2614,7 @@ end
TEST_CASE_FIXTURE(ACFixture, "suggest_table_keys") TEST_CASE_FIXTURE(ACFixture, "suggest_table_keys")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) // CLI-116812 AutocompleteTest.suggest_table_keys needs to populate expected types for nested if (FFlag::LuauSolverV2) // CLI-116812 AutocompleteTest.suggest_table_keys needs to populate expected types for nested
// tables without an annotation // tables without an annotation
return; return;
@ -3101,7 +3101,7 @@ TEST_CASE_FIXTURE(ACBuiltinsFixture, "autocomplete_on_string_singletons")
TEST_CASE_FIXTURE(ACFixture, "autocomplete_string_singletons") TEST_CASE_FIXTURE(ACFixture, "autocomplete_string_singletons")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) // CLI-116814 Autocomplete needs to populate expected types for function arguments correctly if (FFlag::LuauSolverV2) // CLI-116814 Autocomplete needs to populate expected types for function arguments correctly
// (overloads and singletons) // (overloads and singletons)
return; return;
@ -3210,7 +3210,7 @@ TEST_CASE_FIXTURE(ACFixture, "string_singleton_as_table_key")
TEST_CASE_FIXTURE(ACFixture, "string_singleton_in_if_statement") TEST_CASE_FIXTURE(ACFixture, "string_singleton_in_if_statement")
{ {
ScopedFastFlag sff[]{ ScopedFastFlag sff[]{
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
check(R"( check(R"(
@ -3294,7 +3294,7 @@ TEST_CASE_FIXTURE(ACFixture, "string_singleton_in_if_statement")
TEST_CASE_FIXTURE(ACFixture, "string_singleton_in_if_statement2") TEST_CASE_FIXTURE(ACFixture, "string_singleton_in_if_statement2")
{ {
// don't run this when the DCR flag isn't set // don't run this when the DCR flag isn't set
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
check(R"( check(R"(
@ -3578,7 +3578,7 @@ t.@1
REQUIRE(ac.entryMap.count("m")); REQUIRE(ac.entryMap.count("m"));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(ac.entryMap["m"].wrongIndexType); CHECK(ac.entryMap["m"].wrongIndexType);
else else
CHECK(!ac.entryMap["m"].wrongIndexType); CHECK(!ac.entryMap["m"].wrongIndexType);
@ -3760,7 +3760,7 @@ TEST_CASE_FIXTURE(ACFixture, "string_contents_is_available_to_callback")
declare function require(path: string): any declare function require(path: string): any
)"); )");
GlobalTypes& globals = FFlag::DebugLuauDeferredConstraintResolution ? frontend.globals : frontend.globalsForAutocomplete; GlobalTypes& globals = FFlag::LuauSolverV2 ? frontend.globals : frontend.globalsForAutocomplete;
std::optional<Binding> require = globals.globalScope->linearSearchForBinding("require"); std::optional<Binding> require = globals.globalScope->linearSearchForBinding("require");
REQUIRE(require); REQUIRE(require);
@ -3787,7 +3787,7 @@ TEST_CASE_FIXTURE(ACFixture, "string_contents_is_available_to_callback")
TEST_CASE_FIXTURE(ACFixture, "autocomplete_response_perf1" * doctest::timeout(0.5)) TEST_CASE_FIXTURE(ACFixture, "autocomplete_response_perf1" * doctest::timeout(0.5))
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; // FIXME: This test is just barely at the threshhold which makes it very flaky under the new solver return; // FIXME: This test is just barely at the threshhold which makes it very flaky under the new solver
// Build a function type with a large overload set // Build a function type with a large overload set
@ -3869,7 +3869,7 @@ TEST_CASE_FIXTURE(ACFixture, "string_completion_outside_quotes")
declare function require(path: string): any declare function require(path: string): any
)"); )");
GlobalTypes& globals = FFlag::DebugLuauDeferredConstraintResolution ? frontend.globals : frontend.globalsForAutocomplete; GlobalTypes& globals = FFlag::LuauSolverV2 ? frontend.globals : frontend.globalsForAutocomplete;
std::optional<Binding> require = globals.globalScope->linearSearchForBinding("require"); std::optional<Binding> require = globals.globalScope->linearSearchForBinding("require");
REQUIRE(require); REQUIRE(require);
@ -4262,7 +4262,7 @@ foo(@1)
TEST_CASE_FIXTURE(ACFixture, "anonymous_autofilled_generic_type_pack_vararg") TEST_CASE_FIXTURE(ACFixture, "anonymous_autofilled_generic_type_pack_vararg")
{ {
// CLI-116932 - Autocomplete on a anonymous function in a function argument should not recommend a function with a generic parameter. // CLI-116932 - Autocomplete on a anonymous function in a function argument should not recommend a function with a generic parameter.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
check(R"( check(R"(
local function foo<A>(a: (...A) -> number, ...: A) local function foo<A>(a: (...A) -> number, ...: A)
@ -4294,7 +4294,7 @@ foo(@1)
)"); )");
const std::optional<std::string> EXPECTED_INSERT = const std::optional<std::string> EXPECTED_INSERT =
FFlag::DebugLuauDeferredConstraintResolution ? "function(...: number): number end" : "function(...): number end"; FFlag::LuauSolverV2 ? "function(...: number): number end" : "function(...): number end";
auto ac = autocomplete('1'); auto ac = autocomplete('1');

View File

@ -22,9 +22,6 @@ LUAU_FASTINT(LuauCompileLoopUnrollThreshold)
LUAU_FASTINT(LuauCompileLoopUnrollThresholdMaxBoost) LUAU_FASTINT(LuauCompileLoopUnrollThresholdMaxBoost)
LUAU_FASTINT(LuauRecursionLimit) LUAU_FASTINT(LuauRecursionLimit)
LUAU_FASTFLAG(LuauCompileUserdataInfo)
LUAU_FASTFLAG(LuauCompileFastcall3)
using namespace Luau; using namespace Luau;
static std::string compileFunction(const char* source, uint32_t id, int optimizationLevel = 1, bool enableVectors = false) static std::string compileFunction(const char* source, uint32_t id, int optimizationLevel = 1, bool enableVectors = false)
@ -3330,8 +3327,6 @@ RETURN R0 0
TEST_CASE("DebugTypes") TEST_CASE("DebugTypes")
{ {
ScopedFastFlag luauCompileUserdataInfo{FFlag::LuauCompileUserdataInfo, true};
const char* source = R"( const char* source = R"(
local up: number = 2 local up: number = 2
@ -3591,8 +3586,6 @@ RETURN R1 -1
TEST_CASE("Fastcall3") TEST_CASE("Fastcall3")
{ {
ScopedFastFlag luauCompileFastcall3{FFlag::LuauCompileFastcall3, true};
CHECK_EQ( CHECK_EQ(
"\n" + compileFunction0(R"( "\n" + compileFunction0(R"(
local a, b, c = ... local a, b, c = ...
@ -4898,8 +4891,6 @@ L0: RETURN R0 -1
TEST_CASE("VectorFastCall3") TEST_CASE("VectorFastCall3")
{ {
ScopedFastFlag luauCompileFastcall3{FFlag::LuauCompileFastcall3, true};
const char* source = R"( const char* source = R"(
local a, b, c = ... local a, b, c = ...
return Vector3.new(a, b, c) return Vector3.new(a, b, c)

View File

@ -2,7 +2,7 @@
#include "ConstraintGeneratorFixture.h" #include "ConstraintGeneratorFixture.h"
#include "ScopedFlags.h" #include "ScopedFlags.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
namespace Luau namespace Luau
{ {
@ -10,7 +10,7 @@ namespace Luau
ConstraintGeneratorFixture::ConstraintGeneratorFixture() ConstraintGeneratorFixture::ConstraintGeneratorFixture()
: Fixture() : Fixture()
, mainModule(new Module) , mainModule(new Module)
, forceTheFlag{FFlag::DebugLuauDeferredConstraintResolution, true} , forceTheFlag{FFlag::LuauSolverV2, true}
{ {
mainModule->name = "MainModule"; mainModule->name = "MainModule";
mainModule->humanReadableName = "MainModule"; mainModule->humanReadableName = "MainModule";

View File

@ -4,7 +4,7 @@
#include "Fixture.h" #include "Fixture.h"
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
using namespace Luau; using namespace Luau;

View File

@ -11,12 +11,12 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
struct DataFlowGraphFixture struct DataFlowGraphFixture
{ {
// Only needed to fix the operator== reflexivity of an empty Symbol. // Only needed to fix the operator== reflexivity of an empty Symbol.
ScopedFastFlag dcr{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag dcr{FFlag::LuauSolverV2, true};
InternalErrorReporter handle; InternalErrorReporter handle;

View File

@ -15,7 +15,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
TEST_SUITE_BEGIN("Differ"); TEST_SUITE_BEGIN("Differ");
@ -234,7 +234,7 @@ TEST_CASE_FIXTURE(DifferFixture, "right_cyclic_table_left_table_property_wrong")
TEST_CASE_FIXTURE(DifferFixture, "equal_table_two_cyclic_tables_are_not_different") TEST_CASE_FIXTURE(DifferFixture, "equal_table_two_cyclic_tables_are_not_different")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function id<a>(x: a): a local function id<a>(x: a): a
@ -625,7 +625,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_table_cyclic_diamonds_unraveled")
TEST_CASE_FIXTURE(DifferFixture, "equal_function_cyclic") TEST_CASE_FIXTURE(DifferFixture, "equal_function_cyclic")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo() function foo()
@ -646,7 +646,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_function_cyclic")
TEST_CASE_FIXTURE(DifferFixture, "equal_function_table_cyclic") TEST_CASE_FIXTURE(DifferFixture, "equal_function_table_cyclic")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo() function foo()
@ -673,7 +673,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_function_table_cyclic")
TEST_CASE_FIXTURE(DifferFixture, "function_table_self_referential_cyclic") TEST_CASE_FIXTURE(DifferFixture, "function_table_self_referential_cyclic")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
// ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; // ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo() function foo()
@ -692,7 +692,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_table_self_referential_cyclic")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
compareTypesNe( compareTypesNe(
"foo", "foo",
"almostFoo", "almostFoo",
@ -726,7 +726,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_union_cyclic")
TEST_CASE_FIXTURE(DifferFixture, "equal_intersection_cyclic") TEST_CASE_FIXTURE(DifferFixture, "equal_intersection_cyclic")
{ {
// Old solver does not correctly refine test types // Old solver does not correctly refine test types
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo1(x: number) function foo1(x: number)
@ -804,7 +804,7 @@ TEST_CASE_FIXTURE(DifferFixture, "singleton_string")
TEST_CASE_FIXTURE(DifferFixtureWithBuiltins, "negation") TEST_CASE_FIXTURE(DifferFixtureWithBuiltins, "negation")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -879,7 +879,7 @@ TEST_CASE_FIXTURE(DifferFixture, "union_missing")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
compareTypesNe( compareTypesNe(
"foo", "foo",
"almostFoo", "almostFoo",
@ -931,7 +931,7 @@ TEST_CASE_FIXTURE(DifferFixture, "intersection_tables_missing_right")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
compareTypesNe( compareTypesNe(
"foo", "foo",
"almostFoo", "almostFoo",
@ -953,7 +953,7 @@ TEST_CASE_FIXTURE(DifferFixture, "intersection_tables_missing_left")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
compareTypesNe( compareTypesNe(
"foo", "foo",
"almostFoo", "almostFoo",
@ -970,7 +970,7 @@ TEST_CASE_FIXTURE(DifferFixture, "intersection_tables_missing_left")
TEST_CASE_FIXTURE(DifferFixture, "equal_function") TEST_CASE_FIXTURE(DifferFixture, "equal_function")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number) function foo(x: number)
@ -988,7 +988,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_function")
TEST_CASE_FIXTURE(DifferFixture, "equal_function_inferred_ret_length") TEST_CASE_FIXTURE(DifferFixture, "equal_function_inferred_ret_length")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function bar(x: number, y: string) function bar(x: number, y: string)
@ -1012,7 +1012,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_function_inferred_ret_length")
TEST_CASE_FIXTURE(DifferFixture, "equal_function_inferred_ret_length_2") TEST_CASE_FIXTURE(DifferFixture, "equal_function_inferred_ret_length_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function bar(x: number, y: string) function bar(x: number, y: string)
@ -1033,7 +1033,7 @@ TEST_CASE_FIXTURE(DifferFixture, "equal_function_inferred_ret_length_2")
TEST_CASE_FIXTURE(DifferFixture, "function_arg_normal") TEST_CASE_FIXTURE(DifferFixture, "function_arg_normal")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: number, z: number) function foo(x: number, y: number, z: number)
@ -1055,7 +1055,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_arg_normal")
TEST_CASE_FIXTURE(DifferFixture, "function_arg_normal_2") TEST_CASE_FIXTURE(DifferFixture, "function_arg_normal_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: number, z: string) function foo(x: number, y: number, z: string)
@ -1077,7 +1077,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_arg_normal_2")
TEST_CASE_FIXTURE(DifferFixture, "function_ret_normal") TEST_CASE_FIXTURE(DifferFixture, "function_ret_normal")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: number, z: string) function foo(x: number, y: number, z: string)
@ -1099,7 +1099,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_ret_normal")
TEST_CASE_FIXTURE(DifferFixture, "function_arg_length") TEST_CASE_FIXTURE(DifferFixture, "function_arg_length")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: number) function foo(x: number, y: number)
@ -1121,7 +1121,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_arg_length")
TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_2") TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: string, z: number) function foo(x: number, y: string, z: number)
@ -1143,7 +1143,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_2")
TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_none") TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_none")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo() function foo()
@ -1165,7 +1165,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_none")
TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_none_2") TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_none_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number) function foo(x: number)
@ -1187,7 +1187,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_arg_length_none_2")
TEST_CASE_FIXTURE(DifferFixture, "function_ret_length") TEST_CASE_FIXTURE(DifferFixture, "function_ret_length")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: number) function foo(x: number, y: number)
@ -1209,7 +1209,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_ret_length")
TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_2") TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: string, z: number) function foo(x: number, y: string, z: number)
@ -1231,7 +1231,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_2")
TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_none") TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_none")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: string) function foo(x: number, y: string)
@ -1253,7 +1253,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_none")
TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_none_2") TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_none_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo() function foo()
@ -1275,7 +1275,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_ret_length_none_2")
TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_normal") TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_normal")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: string, ...: number) function foo(x: number, y: string, ...: number)
@ -1297,7 +1297,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_normal")
TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_missing") TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_missing")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: string, ...: number) function foo(x: number, y: string, ...: number)
@ -1319,7 +1319,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_missing")
TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_missing_2") TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_missing_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x: number, y: string) function foo(x: number, y: string)
@ -1341,7 +1341,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_variadic_arg_missing_2")
TEST_CASE_FIXTURE(DifferFixture, "function_variadic_oversaturation") TEST_CASE_FIXTURE(DifferFixture, "function_variadic_oversaturation")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
-- allowed to be oversaturated -- allowed to be oversaturated
@ -1363,7 +1363,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_variadic_oversaturation")
TEST_CASE_FIXTURE(DifferFixture, "function_variadic_oversaturation_2") TEST_CASE_FIXTURE(DifferFixture, "function_variadic_oversaturation_2")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
-- must not be oversaturated -- must not be oversaturated
@ -1385,7 +1385,7 @@ TEST_CASE_FIXTURE(DifferFixture, "function_variadic_oversaturation_2")
TEST_CASE_FIXTURE(DifferFixture, "generic") TEST_CASE_FIXTURE(DifferFixture, "generic")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(x, y) function foo(x, y)
@ -1407,7 +1407,7 @@ TEST_CASE_FIXTURE(DifferFixture, "generic")
TEST_CASE_FIXTURE(DifferFixture, "generic_one_vs_two") TEST_CASE_FIXTURE(DifferFixture, "generic_one_vs_two")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo<X>(x: X, y: X) function foo<X>(x: X, y: X)
@ -1429,7 +1429,7 @@ TEST_CASE_FIXTURE(DifferFixture, "generic_one_vs_two")
TEST_CASE_FIXTURE(DifferFixture, "generic_three_or_three") TEST_CASE_FIXTURE(DifferFixture, "generic_three_or_three")
{ {
// Old solver does not correctly infer function typepacks // Old solver does not correctly infer function typepacks
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo<X, Y>(x: X, y: X, z: Y) function foo<X, Y>(x: X, y: X, z: Y)
@ -1473,7 +1473,7 @@ TEST_CASE_FIXTURE(DifferFixtureWithBuiltins, "equal_metatable")
TEST_CASE_FIXTURE(DifferFixtureWithBuiltins, "metatable_normal") TEST_CASE_FIXTURE(DifferFixtureWithBuiltins, "metatable_normal")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local metaFoo = { local metaFoo = {

View File

@ -6,7 +6,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
TEST_SUITE_BEGIN("ErrorTests"); TEST_SUITE_BEGIN("ErrorTests");
@ -47,7 +47,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "binary_op_type_function_errors")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ( CHECK_EQ(
"Operator '+' could not be applied to operands of types number and string; there is no corresponding overload for __add", "Operator '+' could not be applied to operands of types number and string; there is no corresponding overload for __add",
toString(result.errors[0]) toString(result.errors[0])
@ -66,7 +66,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "unary_op_type_function_errors")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ( CHECK_EQ(

View File

@ -22,7 +22,7 @@
static const char* mainModuleName = "MainModule"; static const char* mainModuleName = "MainModule";
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(DebugLuauFreezeArena); LUAU_FASTFLAG(DebugLuauFreezeArena);
LUAU_FASTFLAG(DebugLuauLogSolverToJsonFile) LUAU_FASTFLAG(DebugLuauLogSolverToJsonFile)
@ -204,7 +204,7 @@ AstStatBlock* Fixture::parse(const std::string& source, const ParseOptions& pars
// if AST is available, check how lint and typecheck handle error nodes // if AST is available, check how lint and typecheck handle error nodes
if (result.root) if (result.root)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
Mode mode = sourceModule->mode ? *sourceModule->mode : Mode::Strict; Mode mode = sourceModule->mode ? *sourceModule->mode : Mode::Strict;
ModulePtr module = Luau::check( ModulePtr module = Luau::check(
@ -371,7 +371,7 @@ std::optional<TypeId> Fixture::getType(const std::string& name)
if (!module->hasModuleScope()) if (!module->hasModuleScope())
return std::nullopt; return std::nullopt;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return linearSearchForBinding(module->getModuleScope().get(), name.c_str()); return linearSearchForBinding(module->getModuleScope().get(), name.c_str());
else else
return lookupName(module->getModuleScope(), name); return lookupName(module->getModuleScope(), name);

View File

@ -12,7 +12,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(DebugLuauFreezeArena); LUAU_FASTFLAG(DebugLuauFreezeArena);
LUAU_FASTFLAG(DebugLuauMagicTypes); LUAU_FASTFLAG(DebugLuauMagicTypes);
@ -164,7 +164,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "automatically_check_dependent_scripts")
auto bExports = first(bModule->returnType); auto bExports = first(bModule->returnType);
REQUIRE(!!bExports); REQUIRE(!!bExports);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ b_value: number }", toString(*bExports)); CHECK_EQ("{ b_value: number }", toString(*bExports));
else else
CHECK_EQ("{| b_value: number |}", toString(*bExports)); CHECK_EQ("{| b_value: number |}", toString(*bExports));
@ -311,7 +311,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "nocheck_cycle_used_by_checked")
std::optional<TypeId> cExports = first(cModule->returnType); std::optional<TypeId> cExports = first(cModule->returnType);
REQUIRE(bool(cExports)); REQUIRE(bool(cExports));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ a: { hello: any }, b: { hello: any } }", toString(*cExports)); CHECK_EQ("{ a: { hello: any }, b: { hello: any } }", toString(*cExports));
else else
CHECK_EQ("{| a: any, b: any |}", toString(*cExports)); CHECK_EQ("{| a: any, b: any |}", toString(*cExports));
@ -485,13 +485,13 @@ return {mod_b = 2}
LUAU_REQUIRE_ERRORS(resultB); LUAU_REQUIRE_ERRORS(resultB);
TypeId tyB = requireExportedType("game/B", "btype"); TypeId tyB = requireExportedType("game/B", "btype");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(tyB, opts), "{ x: number }"); CHECK_EQ(toString(tyB, opts), "{ x: number }");
else else
CHECK_EQ(toString(tyB, opts), "{| x: number |}"); CHECK_EQ(toString(tyB, opts), "{| x: number |}");
TypeId tyA = requireExportedType("game/A", "atype"); TypeId tyA = requireExportedType("game/A", "atype");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(tyA, opts), "{ x: any }"); CHECK_EQ(toString(tyA, opts), "{ x: any }");
else else
CHECK_EQ(toString(tyA, opts), "{| x: any |}"); CHECK_EQ(toString(tyA, opts), "{| x: any |}");
@ -501,13 +501,13 @@ return {mod_b = 2}
LUAU_REQUIRE_ERRORS(resultB); LUAU_REQUIRE_ERRORS(resultB);
tyB = requireExportedType("game/B", "btype"); tyB = requireExportedType("game/B", "btype");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(tyB, opts), "{ x: number }"); CHECK_EQ(toString(tyB, opts), "{ x: number }");
else else
CHECK_EQ(toString(tyB, opts), "{| x: number |}"); CHECK_EQ(toString(tyB, opts), "{| x: number |}");
tyA = requireExportedType("game/A", "atype"); tyA = requireExportedType("game/A", "atype");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(tyA, opts), "{ x: any }"); CHECK_EQ(toString(tyA, opts), "{ x: any }");
else else
CHECK_EQ(toString(tyA, opts), "{| x: any |}"); CHECK_EQ(toString(tyA, opts), "{| x: any |}");
@ -583,7 +583,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "recheck_if_dependent_script_is_dirty")
auto bExports = first(bModule->returnType); auto bExports = first(bModule->returnType);
REQUIRE(!!bExports); REQUIRE(!!bExports);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ b_value: string }", toString(*bExports)); CHECK_EQ("{ b_value: string }", toString(*bExports));
else else
CHECK_EQ("{| b_value: string |}", toString(*bExports)); CHECK_EQ("{| b_value: string |}", toString(*bExports));
@ -917,7 +917,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "it_should_be_safe_to_stringify_errors_when_f
// When this test fails, it is because the TypeIds needed by the error have been deallocated. // When this test fails, it is because the TypeIds needed by the error have been deallocated.
// It is thus basically impossible to predict what will happen when this assert is evaluated. // It is thus basically impossible to predict what will happen when this assert is evaluated.
// It could segfault, or you could see weird type names like the empty string or <VALUELESS BY EXCEPTION> // It could segfault, or you could see weird type names like the empty string or <VALUELESS BY EXCEPTION>
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
REQUIRE_EQ( REQUIRE_EQ(
R"(Type R"(Type
'{ count: string }' '{ count: string }'
@ -934,7 +934,7 @@ could not be converted into
TEST_CASE_FIXTURE(FrontendFixture, "trace_requires_in_nonstrict_mode") TEST_CASE_FIXTURE(FrontendFixture, "trace_requires_in_nonstrict_mode")
{ {
// The new non-strict mode is not currently expected to signal any errors here. // The new non-strict mode is not currently expected to signal any errors here.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
fileResolver.source["Module/A"] = R"( fileResolver.source["Module/A"] = R"(
@ -1003,7 +1003,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "environments")
CheckResult resultB = frontend.check("B"); CheckResult resultB = frontend.check("B");
// In the new non-strict mode, we do not currently support error reporting for unknown symbols in type positions. // In the new non-strict mode, we do not currently support error reporting for unknown symbols in type positions.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(resultB); LUAU_REQUIRE_NO_ERRORS(resultB);
else else
LUAU_REQUIRE_ERROR_COUNT(1, resultB); LUAU_REQUIRE_ERROR_COUNT(1, resultB);
@ -1111,7 +1111,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "typecheck_twice_for_ast_types")
TEST_CASE_FIXTURE(FrontendFixture, "imported_table_modification_2") TEST_CASE_FIXTURE(FrontendFixture, "imported_table_modification_2")
{ {
// This test describes non-strict mode behavior that is just not currently present in the new non-strict mode. // This test describes non-strict mode behavior that is just not currently present in the new non-strict mode.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
frontend.options.retainFullTypeGraphs = false; frontend.options.retainFullTypeGraphs = false;
@ -1375,7 +1375,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "checked_modules_have_the_correct_mode")
TEST_CASE_FIXTURE(FrontendFixture, "separate_caches_for_autocomplete") TEST_CASE_FIXTURE(FrontendFixture, "separate_caches_for_autocomplete")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
fileResolver.source["game/A"] = R"( fileResolver.source["game/A"] = R"(
--!nonstrict --!nonstrict
@ -1405,7 +1405,7 @@ TEST_CASE_FIXTURE(FrontendFixture, "separate_caches_for_autocomplete")
TEST_CASE_FIXTURE(FrontendFixture, "no_separate_caches_with_the_new_solver") TEST_CASE_FIXTURE(FrontendFixture, "no_separate_caches_with_the_new_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
fileResolver.source["game/A"] = R"( fileResolver.source["game/A"] = R"(
--!nonstrict --!nonstrict

View File

@ -14,7 +14,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
TEST_SUITE_BEGIN("Generalization"); TEST_SUITE_BEGIN("Generalization");
@ -29,7 +29,7 @@ struct GeneralizationFixture
DenseHashSet<TypeId> generalizedTypes_{nullptr}; DenseHashSet<TypeId> generalizedTypes_{nullptr};
NotNull<DenseHashSet<TypeId>> generalizedTypes{&generalizedTypes_}; NotNull<DenseHashSet<TypeId>> generalizedTypes{&generalizedTypes_};
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
std::pair<TypeId, FreeType*> freshType() std::pair<TypeId, FreeType*> freshType()
{ {

View File

@ -15,9 +15,6 @@
#include <memory> #include <memory>
#include <string_view> #include <string_view>
LUAU_FASTFLAG(LuauCompileUserdataInfo)
LUAU_FASTFLAG(LuauCompileFastcall3)
static std::string getCodegenAssembly(const char* source, bool includeIrTypes = false, int debugLevel = 1) static std::string getCodegenAssembly(const char* source, bool includeIrTypes = false, int debugLevel = 1)
{ {
Luau::CodeGen::AssemblyOptions options; Luau::CodeGen::AssemblyOptions options;
@ -942,8 +939,6 @@ bb_bytecode_0:
TEST_CASE("FastcallTypeInferThroughLocal") TEST_CASE("FastcallTypeInferThroughLocal")
{ {
ScopedFastFlag sffs[]{{FFlag::LuauCompileFastcall3, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -994,8 +989,6 @@ bb_bytecode_1:
TEST_CASE("FastcallTypeInferThroughUpvalue") TEST_CASE("FastcallTypeInferThroughUpvalue")
{ {
ScopedFastFlag sffs[]{{FFlag::LuauCompileFastcall3, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1124,8 +1117,6 @@ bb_bytecode_4:
TEST_CASE("ArgumentTypeRefinement") TEST_CASE("ArgumentTypeRefinement")
{ {
ScopedFastFlag sffs[]{{FFlag::LuauCompileFastcall3, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1433,8 +1424,6 @@ bb_2:
TEST_CASE("UnaryTypeResolve") TEST_CASE("UnaryTypeResolve")
{ {
ScopedFastFlag sffs[]{{FFlag::LuauCompileFastcall3, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenHeader(R"( "\n" + getCodegenHeader(R"(
local function foo(a, b: vector, c) local function foo(a, b: vector, c)
@ -1634,37 +1623,12 @@ end
); );
} }
// Temporary test, when we don't compile new typeinfo, but support loading it
TEST_CASE("CustomUserdataTypesTemp")
{
// This test requires runtime component to be present
if (!Luau::CodeGen::isSupported())
return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, false}};
CHECK_EQ(
"\n" + getCodegenHeader(R"(
local function foo(v: vec2, x: mat3)
return v.X * x
end
)"),
R"(
; function foo(v, x) line 2
; R0: userdata [argument 'v']
; R1: userdata [argument 'x']
)"
);
}
TEST_CASE("CustomUserdataTypes") TEST_CASE("CustomUserdataTypes")
{ {
// This test requires runtime component to be present // This test requires runtime component to be present
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenHeader(R"( "\n" + getCodegenHeader(R"(
local function foo(v: vec2, x: mat3) local function foo(v: vec2, x: mat3)
@ -1685,8 +1649,6 @@ TEST_CASE("CustomUserdataPropertyAccess")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1724,8 +1686,6 @@ TEST_CASE("CustomUserdataPropertyAccess2")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1765,8 +1725,6 @@ TEST_CASE("CustomUserdataNamecall1")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1815,8 +1773,6 @@ TEST_CASE("CustomUserdataNamecall2")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1868,8 +1824,6 @@ TEST_CASE("CustomUserdataMetamethodDirectFlow")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1904,8 +1858,6 @@ TEST_CASE("CustomUserdataMetamethodDirectFlow2")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1938,8 +1890,6 @@ TEST_CASE("CustomUserdataMetamethodDirectFlow3")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(
@ -1972,8 +1922,6 @@ TEST_CASE("CustomUserdataMetamethod")
if (!Luau::CodeGen::isSupported()) if (!Luau::CodeGen::isSupported())
return; return;
ScopedFastFlag sffs[]{{FFlag::LuauCompileUserdataInfo, true}};
CHECK_EQ( CHECK_EQ(
"\n" + getCodegenAssembly( "\n" + getCodegenAssembly(
R"( R"(

View File

@ -7,7 +7,7 @@
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauNativeAttribute); LUAU_FASTFLAG(LuauNativeAttribute);
LUAU_FASTFLAG(LintRedundantNativeAttribute); LUAU_FASTFLAG(LintRedundantNativeAttribute);
@ -1265,7 +1265,7 @@ _ = {
TEST_CASE_FIXTURE(Fixture, "read_write_table_props") TEST_CASE_FIXTURE(Fixture, "read_write_table_props")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
LintResult result = lint(R"(-- line 1 LintResult result = lint(R"(-- line 1
type A = {x: number} type A = {x: number}
@ -1659,7 +1659,7 @@ table.create(42, {} :: {})
TEST_CASE_FIXTURE(BuiltinsFixture, "TableOperationsIndexer") TEST_CASE_FIXTURE(BuiltinsFixture, "TableOperationsIndexer")
{ {
// CLI-116824 Linter incorrectly issues false positive when taking the length of a unannotated string function argument // CLI-116824 Linter incorrectly issues false positive when taking the length of a unannotated string function argument
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
LintResult result = lint(R"( LintResult result = lint(R"(

View File

@ -11,7 +11,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(DebugLuauFreezeArena); LUAU_FASTFLAG(DebugLuauFreezeArena);
LUAU_FASTINT(LuauTypeCloneIterationLimit); LUAU_FASTINT(LuauTypeCloneIterationLimit);
@ -111,7 +111,7 @@ TEST_CASE_FIXTURE(Fixture, "deepClone_cyclic_table")
// not, but it's tangental to the core purpose of this test. // not, but it's tangental to the core purpose of this test.
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -283,7 +283,7 @@ TEST_CASE_FIXTURE(Fixture, "clone_class")
TEST_CASE_FIXTURE(Fixture, "clone_free_types") TEST_CASE_FIXTURE(Fixture, "clone_free_types")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
TypeArena arena; TypeArena arena;
TypeId freeTy = freshType(NotNull{&arena}, builtinTypes, nullptr); TypeId freeTy = freshType(NotNull{&arena}, builtinTypes, nullptr);
@ -317,7 +317,7 @@ TEST_CASE_FIXTURE(Fixture, "clone_free_tables")
TEST_CASE_FIXTURE(BuiltinsFixture, "clone_self_property") TEST_CASE_FIXTURE(BuiltinsFixture, "clone_self_property")
{ {
// CLI-117082 ModuleTests.clone_self_property we don't infer self correctly, instead replacing it with unknown. // CLI-117082 ModuleTests.clone_self_property we don't infer self correctly, instead replacing it with unknown.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
fileResolver.source["Module/A"] = R"( fileResolver.source["Module/A"] = R"(
--!nonstrict --!nonstrict
@ -415,7 +415,7 @@ type B = A
auto it = mod->exportedTypeBindings.find("A"); auto it = mod->exportedTypeBindings.find("A");
REQUIRE(it != mod->exportedTypeBindings.end()); REQUIRE(it != mod->exportedTypeBindings.end());
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(it->second.type) == "any"); CHECK(toString(it->second.type) == "any");
else else
CHECK(toString(it->second.type) == "*error-type*"); CHECK(toString(it->second.type) == "*error-type*");

View File

@ -67,7 +67,7 @@ struct NonStrictTypeCheckerFixture : Fixture
CheckResult checkNonStrict(const std::string& code) CheckResult checkNonStrict(const std::string& code)
{ {
ScopedFastFlag flags[] = { ScopedFastFlag flags[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
LoadDefinitionFileResult res = loadDefinition(definitions); LoadDefinitionFileResult res = loadDefinition(definitions);
LUAU_ASSERT(res.success); LUAU_ASSERT(res.success);
@ -77,7 +77,7 @@ struct NonStrictTypeCheckerFixture : Fixture
CheckResult checkNonStrictModule(const std::string& moduleName) CheckResult checkNonStrictModule(const std::string& moduleName)
{ {
ScopedFastFlag flags[] = { ScopedFastFlag flags[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
LoadDefinitionFileResult res = loadDefinition(definitions); LoadDefinitionFileResult res = loadDefinition(definitions);
LUAU_ASSERT(res.success); LUAU_ASSERT(res.success);

View File

@ -16,7 +16,7 @@ TEST_SUITE_BEGIN("NonstrictModeTests");
TEST_CASE_FIXTURE(Fixture, "infer_nullary_function") TEST_CASE_FIXTURE(Fixture, "infer_nullary_function")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
function foo(x, y) end function foo(x, y) end
@ -39,7 +39,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_nullary_function")
TEST_CASE_FIXTURE(Fixture, "infer_the_maximum_number_of_values_the_function_could_return") TEST_CASE_FIXTURE(Fixture, "infer_the_maximum_number_of_values_the_function_could_return")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
function getMinCardCountForWidth(width) function getMinCardCountForWidth(width)
@ -103,7 +103,7 @@ TEST_CASE_FIXTURE(Fixture, "inconsistent_return_types_are_ok")
TEST_CASE_FIXTURE(Fixture, "locals_are_any_by_default") TEST_CASE_FIXTURE(Fixture, "locals_are_any_by_default")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
local m = 55 local m = 55
@ -130,7 +130,7 @@ TEST_CASE_FIXTURE(Fixture, "parameters_having_type_any_are_optional")
TEST_CASE_FIXTURE(Fixture, "local_tables_are_not_any") TEST_CASE_FIXTURE(Fixture, "local_tables_are_not_any")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
local T = {} local T = {}
@ -148,7 +148,7 @@ TEST_CASE_FIXTURE(Fixture, "local_tables_are_not_any")
TEST_CASE_FIXTURE(Fixture, "offer_a_hint_if_you_use_a_dot_instead_of_a_colon") TEST_CASE_FIXTURE(Fixture, "offer_a_hint_if_you_use_a_dot_instead_of_a_colon")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
local T = {} local T = {}
@ -163,7 +163,7 @@ TEST_CASE_FIXTURE(Fixture, "offer_a_hint_if_you_use_a_dot_instead_of_a_colon")
TEST_CASE_FIXTURE(Fixture, "table_props_are_any") TEST_CASE_FIXTURE(Fixture, "table_props_are_any")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
local T = {} local T = {}
@ -185,7 +185,7 @@ TEST_CASE_FIXTURE(Fixture, "table_props_are_any")
TEST_CASE_FIXTURE(Fixture, "inline_table_props_are_also_any") TEST_CASE_FIXTURE(Fixture, "inline_table_props_are_also_any")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
local T = { local T = {
@ -261,7 +261,7 @@ TEST_CASE_FIXTURE(Fixture, "delay_function_does_not_require_its_argument_to_retu
TEST_CASE_FIXTURE(Fixture, "inconsistent_module_return_types_are_ok") TEST_CASE_FIXTURE(Fixture, "inconsistent_module_return_types_are_ok")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict

View File

@ -10,7 +10,7 @@
#include "Luau/Normalize.h" #include "Luau/Normalize.h"
#include "Luau/BuiltinDefinitions.h" #include "Luau/BuiltinDefinitions.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauNormalizeNotUnknownIntersection) LUAU_FASTFLAG(LuauNormalizeNotUnknownIntersection)
LUAU_FASTINT(LuauTypeInferRecursionLimit) LUAU_FASTINT(LuauTypeInferRecursionLimit)
using namespace Luau; using namespace Luau;
@ -142,7 +142,7 @@ TEST_CASE_FIXTURE(IsSubtypeFixture, "table_with_union_prop")
TypeId a = requireType("a"); TypeId a = requireType("a");
TypeId b = requireType("b"); TypeId b = requireType("b");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(!isSubtype(a, b)); // table properties are invariant CHECK(!isSubtype(a, b)); // table properties are invariant
else else
CHECK(isSubtype(a, b)); CHECK(isSubtype(a, b));
@ -159,7 +159,7 @@ TEST_CASE_FIXTURE(IsSubtypeFixture, "table_with_any_prop")
TypeId a = requireType("a"); TypeId a = requireType("a");
TypeId b = requireType("b"); TypeId b = requireType("b");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(!isSubtype(a, b)); // table properties are invariant CHECK(!isSubtype(a, b)); // table properties are invariant
else else
CHECK(isSubtype(a, b)); CHECK(isSubtype(a, b));
@ -219,7 +219,7 @@ TEST_CASE_FIXTURE(IsSubtypeFixture, "tables")
TypeId c = requireType("c"); TypeId c = requireType("c");
TypeId d = requireType("d"); TypeId d = requireType("d");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(!isSubtype(a, b)); // table properties are invariant CHECK(!isSubtype(a, b)); // table properties are invariant
else else
CHECK(isSubtype(a, b)); CHECK(isSubtype(a, b));
@ -231,7 +231,7 @@ TEST_CASE_FIXTURE(IsSubtypeFixture, "tables")
CHECK(isSubtype(d, a)); CHECK(isSubtype(d, a));
CHECK(!isSubtype(a, d)); CHECK(!isSubtype(a, d));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(!isSubtype(d, b)); // table properties are invariant CHECK(!isSubtype(d, b)); // table properties are invariant
else else
CHECK(isSubtype(d, b)); CHECK(isSubtype(d, b));
@ -406,7 +406,7 @@ TEST_CASE_FIXTURE(IsSubtypeFixture, "error_suppression")
// We have added this as an exception - the set of inhabitants of any is exactly the set of inhabitants of unknown (since error has no // We have added this as an exception - the set of inhabitants of any is exactly the set of inhabitants of unknown (since error has no
// inhabitants). any = err | unknown, so under semantic subtyping, {} U unknown = unknown // inhabitants). any = err | unknown, so under semantic subtyping, {} U unknown = unknown
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK(isSubtype(any, unk)); CHECK(isSubtype(any, unk));
} }
@ -415,7 +415,7 @@ TEST_CASE_FIXTURE(IsSubtypeFixture, "error_suppression")
CHECK(!isSubtype(any, unk)); CHECK(!isSubtype(any, unk));
} }
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK(isSubtype(err, str)); CHECK(isSubtype(err, str));
} }
@ -454,7 +454,7 @@ struct NormalizeFixture : Fixture
CheckResult result = check("type _Res = " + annotation); CheckResult result = check("type _Res = " + annotation);
LUAU_REQUIRE_ERROR_COUNT(expectedErrors, result); LUAU_REQUIRE_ERROR_COUNT(expectedErrors, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
SourceModule* sourceModule = getMainSourceModule(); SourceModule* sourceModule = getMainSourceModule();
REQUIRE(sourceModule); REQUIRE(sourceModule);
@ -670,7 +670,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "negated_function_is_anything_except_a_funct
TEST_CASE_FIXTURE(NormalizeFixture, "specific_functions_cannot_be_negated") TEST_CASE_FIXTURE(NormalizeFixture, "specific_functions_cannot_be_negated")
{ {
CHECK(nullptr == toNormalizedType("Not<(boolean) -> boolean>", FFlag::DebugLuauDeferredConstraintResolution ? 1 : 0)); CHECK(nullptr == toNormalizedType("Not<(boolean) -> boolean>", FFlag::LuauSolverV2 ? 1 : 0));
} }
TEST_CASE_FIXTURE(NormalizeFixture, "trivial_intersection_inhabited") TEST_CASE_FIXTURE(NormalizeFixture, "trivial_intersection_inhabited")
@ -711,7 +711,7 @@ TEST_CASE_FIXTURE(Fixture, "higher_order_function_with_annotation")
{ {
// CLI-117088 - Inferring the type of a higher order function with an annotation sometimes doesn't fully constrain the type (there are free types // CLI-117088 - Inferring the type of a higher order function with an annotation sometimes doesn't fully constrain the type (there are free types
// left over). // left over).
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
check(R"( check(R"(
function apply<a, b>(f: (a) -> b, x) function apply<a, b>(f: (a) -> b, x)
@ -781,7 +781,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "narrow_union_of_classes_with_intersection")
TEST_CASE_FIXTURE(NormalizeFixture, "intersection_of_metatables_where_the_metatable_is_top_or_bottom") TEST_CASE_FIXTURE(NormalizeFixture, "intersection_of_metatables_where_the_metatable_is_top_or_bottom")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("{ @metatable *error-type*, { } }" == toString(normal("Mt<{}, any> & Mt<{}, err>"))); CHECK("{ @metatable *error-type*, { } }" == toString(normal("Mt<{}, any> & Mt<{}, err>")));
else else
CHECK("{ @metatable *error-type*, {| |} }" == toString(normal("Mt<{}, any> & Mt<{}, err>"))); CHECK("{ @metatable *error-type*, {| |} }" == toString(normal("Mt<{}, any> & Mt<{}, err>")));
@ -878,7 +878,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "classes_and_never")
TEST_CASE_FIXTURE(NormalizeFixture, "top_table_type") TEST_CASE_FIXTURE(NormalizeFixture, "top_table_type")
{ {
CHECK("table" == toString(normal("{} | tbl"))); CHECK("table" == toString(normal("{} | tbl")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("{ }" == toString(normal("{} & tbl"))); CHECK("{ }" == toString(normal("{} & tbl")));
else else
CHECK("{| |}" == toString(normal("{} & tbl"))); CHECK("{| |}" == toString(normal("{} & tbl")));
@ -887,7 +887,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "top_table_type")
TEST_CASE_FIXTURE(NormalizeFixture, "negations_of_tables") TEST_CASE_FIXTURE(NormalizeFixture, "negations_of_tables")
{ {
CHECK(nullptr == toNormalizedType("Not<{}>", FFlag::DebugLuauDeferredConstraintResolution ? 1 : 0)); CHECK(nullptr == toNormalizedType("Not<{}>", FFlag::LuauSolverV2 ? 1 : 0));
CHECK("(boolean | buffer | class | function | number | string | thread)?" == toString(normal("Not<tbl>"))); CHECK("(boolean | buffer | class | function | number | string | thread)?" == toString(normal("Not<tbl>")));
CHECK("table" == toString(normal("Not<Not<tbl>>"))); CHECK("table" == toString(normal("Not<Not<tbl>>")));
} }
@ -928,7 +928,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "normalize_unknown")
TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props") TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK("{ x: string }" == toString(normal("{ read x: string } & { x: string }"), {true})); CHECK("{ x: string }" == toString(normal("{ read x: string } & { x: string }"), {true}));
CHECK("{ x: string }" == toString(normal("{ x: string } & { read x: string }"), {true})); CHECK("{ x: string }" == toString(normal("{ x: string } & { read x: string }"), {true}));
@ -936,7 +936,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props")
TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props_2") TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props_2")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK(R"({ x: "hello" })" == toString(normal(R"({ x: "hello" } & { x: string })"), {true})); CHECK(R"({ x: "hello" })" == toString(normal(R"({ x: "hello" } & { x: string })"), {true}));
CHECK(R"(never)" == toString(normal(R"({ x: "hello" } & { x: "world" })"), {true})); CHECK(R"(never)" == toString(normal(R"({ x: "hello" } & { x: "world" })"), {true}));
@ -944,7 +944,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props_2")
TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props_3") TEST_CASE_FIXTURE(NormalizeFixture, "read_only_props_3")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK(R"({ read x: "hello" })" == toString(normal(R"({ read x: "hello" } & { read x: string })"), {true})); CHECK(R"({ read x: "hello" })" == toString(normal(R"({ read x: "hello" } & { read x: string })"), {true}));
CHECK("never" == toString(normal(R"({ read x: "hello" } & { read x: "world" })"), {true})); CHECK("never" == toString(normal(R"({ read x: "hello" } & { read x: "world" })"), {true}));
@ -1009,7 +1009,7 @@ TEST_CASE_FIXTURE(NormalizeFixture, "cyclic_stack_overflow_2")
TEST_CASE_FIXTURE(NormalizeFixture, "truthy_table_property_and_optional_table_with_optional_prop") TEST_CASE_FIXTURE(NormalizeFixture, "truthy_table_property_and_optional_table_with_optional_prop")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
// { x: ~(false?) } // { x: ~(false?) }
TypeId t1 = arena.addType(TableType{TableType::Props{{"x", builtinTypes->truthyType}}, std::nullopt, TypeLevel{}, TableState::Sealed}); TypeId t1 = arena.addType(TableType{TableType::Props{{"x", builtinTypes->truthyType}}, std::nullopt, TypeLevel{}, TableState::Sealed});

View File

@ -15,7 +15,7 @@ LUAU_FASTFLAG(LuauLexerLookaheadRemembersBraceType);
LUAU_FASTINT(LuauRecursionLimit); LUAU_FASTINT(LuauRecursionLimit);
LUAU_FASTINT(LuauTypeLengthLimit); LUAU_FASTINT(LuauTypeLengthLimit);
LUAU_FASTINT(LuauParseErrorLimit); LUAU_FASTINT(LuauParseErrorLimit);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauAttributeSyntaxFunExpr); LUAU_FASTFLAG(LuauAttributeSyntaxFunExpr);
LUAU_FASTFLAG(LuauUserDefinedTypeFunctions); LUAU_FASTFLAG(LuauUserDefinedTypeFunctions);
@ -1192,7 +1192,7 @@ until false
TEST_CASE_FIXTURE(Fixture, "parse_nesting_based_end_detection_local_function") TEST_CASE_FIXTURE(Fixture, "parse_nesting_based_end_detection_local_function")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
try try
@ -1229,7 +1229,7 @@ end
TEST_CASE_FIXTURE(Fixture, "parse_nesting_based_end_detection_failsafe_earlier") TEST_CASE_FIXTURE(Fixture, "parse_nesting_based_end_detection_failsafe_earlier")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
try try
@ -2597,7 +2597,7 @@ TEST_CASE_FIXTURE(Fixture, "recovery_of_parenthesized_expressions")
}; };
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
checkRecovery("function foo(a, b. c) return a + b end", "function foo(a, b) return a + b end", 1); checkRecovery("function foo(a, b. c) return a + b end", "function foo(a, b) return a + b end", 1);
@ -2841,7 +2841,7 @@ TEST_CASE_FIXTURE(Fixture, "AstName_comparison")
TEST_CASE_FIXTURE(Fixture, "generic_type_list_recovery") TEST_CASE_FIXTURE(Fixture, "generic_type_list_recovery")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
try try

View File

@ -18,7 +18,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTINT(LuauTypeInferRecursionLimit) LUAU_FASTINT(LuauTypeInferRecursionLimit)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
struct LimitFixture : BuiltinsFixture struct LimitFixture : BuiltinsFixture
{ {
@ -46,7 +46,7 @@ TEST_SUITE_BEGIN("RuntimeLimits");
TEST_CASE_FIXTURE(LimitFixture, "typescript_port_of_Result_type") TEST_CASE_FIXTURE(LimitFixture, "typescript_port_of_Result_type")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
constexpr const char* src = R"LUA( constexpr const char* src = R"LUA(

View File

@ -8,7 +8,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_DYNAMIC_FASTINT(LuauSimplificationComplexityLimit) LUAU_DYNAMIC_FASTINT(LuauSimplificationComplexityLimit)
namespace namespace
@ -62,7 +62,7 @@ struct SimplifyFixture : Fixture
TypeId anotherChildClassTy = nullptr; TypeId anotherChildClassTy = nullptr;
TypeId unrelatedClassTy = nullptr; TypeId unrelatedClassTy = nullptr;
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
SimplifyFixture() SimplifyFixture()
{ {

View File

@ -15,7 +15,7 @@
#include <initializer_list> #include <initializer_list>
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
using namespace Luau; using namespace Luau;
@ -67,7 +67,7 @@ struct SubtypeFixture : Fixture
UnifierSharedState sharedState{&ice}; UnifierSharedState sharedState{&ice};
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}}; Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
ScopePtr rootScope{new Scope(builtinTypes->emptyTypePack)}; ScopePtr rootScope{new Scope(builtinTypes->emptyTypePack)};
ScopePtr moduleScope{new Scope(rootScope)}; ScopePtr moduleScope{new Scope(rootScope)};
@ -837,28 +837,28 @@ TEST_CASE_FIXTURE(SubtypeFixture, "{x: <T>(T) -> ()} <: {x: <U>(U) -> ()}")
TEST_CASE_FIXTURE(SubtypeFixture, "{ x: number } <: { read x: number }") TEST_CASE_FIXTURE(SubtypeFixture, "{ x: number } <: { read x: number }")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK_IS_SUBTYPE(tbl({{"x", builtinTypes->numberType}}), tbl({{"x", Property::readonly(builtinTypes->numberType)}})); CHECK_IS_SUBTYPE(tbl({{"x", builtinTypes->numberType}}), tbl({{"x", Property::readonly(builtinTypes->numberType)}}));
} }
TEST_CASE_FIXTURE(SubtypeFixture, "{ x: number } <: { write x: number }") TEST_CASE_FIXTURE(SubtypeFixture, "{ x: number } <: { write x: number }")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK_IS_SUBTYPE(tbl({{"x", builtinTypes->numberType}}), tbl({{"x", Property::writeonly(builtinTypes->numberType)}})); CHECK_IS_SUBTYPE(tbl({{"x", builtinTypes->numberType}}), tbl({{"x", Property::writeonly(builtinTypes->numberType)}}));
} }
TEST_CASE_FIXTURE(SubtypeFixture, "{ x: \"hello\" } <: { read x: string }") TEST_CASE_FIXTURE(SubtypeFixture, "{ x: \"hello\" } <: { read x: string }")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK_IS_SUBTYPE(tbl({{"x", helloType}}), tbl({{"x", Property::readonly(builtinTypes->stringType)}})); CHECK_IS_SUBTYPE(tbl({{"x", helloType}}), tbl({{"x", Property::readonly(builtinTypes->stringType)}}));
} }
TEST_CASE_FIXTURE(SubtypeFixture, "{ x: string } <: { write x: string }") TEST_CASE_FIXTURE(SubtypeFixture, "{ x: string } <: { write x: string }")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK_IS_SUBTYPE(tbl({{"x", builtinTypes->stringType}}), tbl({{"x", Property::writeonly(builtinTypes->stringType)}})); CHECK_IS_SUBTYPE(tbl({{"x", builtinTypes->stringType}}), tbl({{"x", Property::writeonly(builtinTypes->stringType)}}));
} }

View File

@ -8,7 +8,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
TEST_SUITE_BEGIN("SymbolTests"); TEST_SUITE_BEGIN("SymbolTests");
@ -68,7 +68,7 @@ TEST_CASE("equality_and_hashing_of_locals")
TEST_CASE("equality_of_empty_symbols") TEST_CASE("equality_of_empty_symbols")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
std::string s1 = "name"; std::string s1 = "name";
std::string s2 = "name"; std::string s2 = "name";

View File

@ -9,7 +9,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
struct ToDotClassFixture : Fixture struct ToDotClassFixture : Fixture
{ {
@ -145,7 +145,7 @@ local function f(a, ...: string) return a end
ToDotOptions opts; ToDotOptions opts;
opts.showPointers = false; opts.showPointers = false;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
R"(digraph graphname { R"(digraph graphname {
@ -242,7 +242,7 @@ local a: A<number, ...string>
ToDotOptions opts; ToDotOptions opts;
opts.showPointers = false; opts.showPointers = false;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
R"(digraph graphname { R"(digraph graphname {
@ -323,7 +323,7 @@ n3 [label="TableType 3"];
TEST_CASE_FIXTURE(Fixture, "free") TEST_CASE_FIXTURE(Fixture, "free")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
Type type{TypeVariant{FreeType{TypeLevel{0, 0}}}}; Type type{TypeVariant{FreeType{TypeLevel{0, 0}}}};
@ -341,7 +341,7 @@ n1 [label="FreeType 1"];
TEST_CASE_FIXTURE(Fixture, "free_with_constraints") TEST_CASE_FIXTURE(Fixture, "free_with_constraints")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
Type type{TypeVariant{FreeType{nullptr, builtinTypes->numberType, builtinTypes->optionalNumberType}}}; Type type{TypeVariant{FreeType{nullptr, builtinTypes->numberType, builtinTypes->optionalNumberType}}};

View File

@ -11,7 +11,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(LuauRecursiveTypeParameterRestriction); LUAU_FASTFLAG(LuauRecursiveTypeParameterRestriction);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauAttributeSyntax); LUAU_FASTFLAG(LuauAttributeSyntax);
LUAU_FASTFLAG(LuauUserDefinedTypeFunctions) LUAU_FASTFLAG(LuauUserDefinedTypeFunctions)
@ -22,7 +22,7 @@ TEST_CASE_FIXTURE(Fixture, "primitive")
CheckResult result = check("local a = nil local b = 44 local c = 'lalala' local d = true"); CheckResult result = check("local a = nil local b = 44 local c = 'lalala' local d = true");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("nil" == toString(requireType("a"))); CHECK("nil" == toString(requireType("a")));
else else
{ {
@ -45,7 +45,7 @@ TEST_CASE_FIXTURE(Fixture, "bound_types")
TEST_CASE_FIXTURE(Fixture, "free_types") TEST_CASE_FIXTURE(Fixture, "free_types")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check("local a"); CheckResult result = check("local a");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -59,7 +59,7 @@ TEST_CASE_FIXTURE(Fixture, "cyclic_table")
TableType* tableOne = getMutable<TableType>(&cyclicTable); TableType* tableOne = getMutable<TableType>(&cyclicTable);
tableOne->props["self"] = {&cyclicTable}; tableOne->props["self"] = {&cyclicTable};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("t1 where t1 = {| self: t1 |}", toString(&cyclicTable)); CHECK_EQ("t1 where t1 = {| self: t1 |}", toString(&cyclicTable));
else else
CHECK_EQ("t1 where t1 = { self: t1 }", toString(&cyclicTable)); CHECK_EQ("t1 where t1 = { self: t1 }", toString(&cyclicTable));
@ -80,7 +80,7 @@ TEST_CASE_FIXTURE(Fixture, "empty_table")
local a: {} local a: {}
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ }", toString(requireType("a"))); CHECK_EQ("{ }", toString(requireType("a")));
else else
CHECK_EQ("{| |}", toString(requireType("a"))); CHECK_EQ("{| |}", toString(requireType("a")));
@ -88,7 +88,7 @@ TEST_CASE_FIXTURE(Fixture, "empty_table")
// Should stay the same with useLineBreaks enabled // Should stay the same with useLineBreaks enabled
ToStringOptions opts; ToStringOptions opts;
opts.useLineBreaks = true; opts.useLineBreaks = true;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ }", toString(requireType("a"), opts)); CHECK_EQ("{ }", toString(requireType("a"), opts));
else else
CHECK_EQ("{| |}", toString(requireType("a"), opts)); CHECK_EQ("{| |}", toString(requireType("a"), opts));
@ -103,7 +103,7 @@ TEST_CASE_FIXTURE(Fixture, "table_respects_use_line_break")
ToStringOptions opts; ToStringOptions opts;
opts.useLineBreaks = true; opts.useLineBreaks = true;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ( CHECK_EQ(
"{\n" "{\n"
" anotherProp: number,\n" " anotherProp: number,\n"
@ -150,7 +150,7 @@ TEST_CASE_FIXTURE(Fixture, "metatable")
Type table{TypeVariant(TableType())}; Type table{TypeVariant(TableType())};
Type metatable{TypeVariant(TableType())}; Type metatable{TypeVariant(TableType())};
Type mtv{TypeVariant(MetatableType{&table, &metatable})}; Type mtv{TypeVariant(MetatableType{&table, &metatable})};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ @metatable {| |}, {| |} }", toString(&mtv)); CHECK_EQ("{ @metatable {| |}, {| |} }", toString(&mtv));
else else
CHECK_EQ("{ @metatable { }, { } }", toString(&mtv)); CHECK_EQ("{ @metatable { }, { } }", toString(&mtv));
@ -166,7 +166,7 @@ TEST_CASE_FIXTURE(Fixture, "named_metatable")
TEST_CASE_FIXTURE(BuiltinsFixture, "named_metatable_toStringNamedFunction") TEST_CASE_FIXTURE(BuiltinsFixture, "named_metatable_toStringNamedFunction")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function createTbl(): NamedMetatable local function createTbl(): NamedMetatable
@ -207,7 +207,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "exhaustive_toString_of_cyclic_table")
CHECK_EQ(std::string::npos, a.find("CYCLE")); CHECK_EQ(std::string::npos, a.find("CYCLE"));
CHECK_EQ(std::string::npos, a.find("TRUNCATED")); CHECK_EQ(std::string::npos, a.find("TRUNCATED"));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK( CHECK(
"t2 where " "t2 where "
@ -346,7 +346,7 @@ TEST_CASE_FIXTURE(Fixture, "quit_stringifying_table_type_when_length_is_exceeded
ToStringOptions o; ToStringOptions o;
o.exhaustive = false; o.exhaustive = false;
o.maxTableLength = 40; o.maxTableLength = 40;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(&tv, o), "{| a: number, b: number, c: number, d: number, e: number, ... 10 more ... |}"); CHECK_EQ(toString(&tv, o), "{| a: number, b: number, c: number, d: number, e: number, ... 10 more ... |}");
else else
CHECK_EQ(toString(&tv, o), "{ a: number, b: number, c: number, d: number, e: number, ... 10 more ... }"); CHECK_EQ(toString(&tv, o), "{ a: number, b: number, c: number, d: number, e: number, ... 10 more ... }");
@ -363,7 +363,7 @@ TEST_CASE_FIXTURE(Fixture, "stringifying_table_type_is_still_capped_when_exhaust
ToStringOptions o; ToStringOptions o;
o.exhaustive = true; o.exhaustive = true;
o.maxTableLength = 40; o.maxTableLength = 40;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(&tv, o), "{| a: number, b: number, c: number, d: number, e: number, ... 2 more ... |}"); CHECK_EQ(toString(&tv, o), "{| a: number, b: number, c: number, d: number, e: number, ... 2 more ... |}");
else else
CHECK_EQ(toString(&tv, o), "{ a: number, b: number, c: number, d: number, e: number, ... 2 more ... }"); CHECK_EQ(toString(&tv, o), "{ a: number, b: number, c: number, d: number, e: number, ... 2 more ... }");
@ -377,7 +377,7 @@ TEST_CASE_FIXTURE(Fixture, "quit_stringifying_type_when_length_is_exceeded")
function f2(f) return f or f1 end function f2(f) return f or f1 end
function f3(f) return f or f2 end function f3(f) return f or f2 end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -412,7 +412,7 @@ TEST_CASE_FIXTURE(Fixture, "stringifying_type_is_still_capped_when_exhaustive")
function f3(f) return f or f2 end function f3(f) return f or f2 end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -448,7 +448,7 @@ TEST_CASE_FIXTURE(Fixture, "stringifying_table_type_correctly_use_matching_table
ToStringOptions o; ToStringOptions o;
o.maxTableLength = 40; o.maxTableLength = 40;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(&tv, o), "{ a: number, b: number, c: number, d: number, e: number, ... 5 more ... }"); CHECK_EQ(toString(&tv, o), "{ a: number, b: number, c: number, d: number, e: number, ... 5 more ... }");
else else
CHECK_EQ(toString(&tv, o), "{| a: number, b: number, c: number, d: number, e: number, ... 5 more ... |}"); CHECK_EQ(toString(&tv, o), "{| a: number, b: number, c: number, d: number, e: number, ... 5 more ... |}");
@ -482,7 +482,7 @@ TEST_CASE_FIXTURE(Fixture, "stringifying_array_uses_array_syntax")
CHECK_EQ("{string}", toString(Type{ttv})); CHECK_EQ("{string}", toString(Type{ttv}));
ttv.props["A"] = {builtinTypes->numberType}; ttv.props["A"] = {builtinTypes->numberType};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ [number]: string, A: number }", toString(Type{ttv})); CHECK_EQ("{ [number]: string, A: number }", toString(Type{ttv}));
else else
CHECK_EQ("{| [number]: string, A: number |}", toString(Type{ttv})); CHECK_EQ("{| [number]: string, A: number |}", toString(Type{ttv}));
@ -594,7 +594,7 @@ TEST_CASE_FIXTURE(Fixture, "toStringDetailed")
TEST_CASE_FIXTURE(Fixture, "toStringErrorPack") TEST_CASE_FIXTURE(Fixture, "toStringErrorPack")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function target(callback: nil) return callback(4, "hello") end local function target(callback: nil) return callback(4, "hello") end
@ -633,7 +633,7 @@ TEST_CASE_FIXTURE(Fixture, "toString_the_boundTo_table_type_contained_within_a_T
TypePackVar tpv2{TypePack{{&tv2}}}; TypePackVar tpv2{TypePack{{&tv2}}};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("{ hello: number, world: number }", toString(&tpv1)); CHECK_EQ("{ hello: number, world: number }", toString(&tpv1));
CHECK_EQ("{ hello: number, world: number }", toString(&tpv2)); CHECK_EQ("{ hello: number, world: number }", toString(&tpv2));
@ -680,7 +680,7 @@ TEST_CASE_FIXTURE(Fixture, "no_parentheses_around_cyclic_function_type_in_inters
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("(() -> t1) & ((number) -> ()) where t1 = () -> t1" == toString(requireType("a"))); CHECK("(() -> t1) & ((number) -> ()) where t1 = () -> t1" == toString(requireType("a")));
else else
CHECK_EQ("((number) -> ()) & t1 where t1 = () -> t1", toString(requireType("a"))); CHECK_EQ("((number) -> ()) & t1 where t1 = () -> t1", toString(requireType("a")));
@ -723,7 +723,7 @@ TEST_CASE_FIXTURE(Fixture, "toStringNamedFunction_map")
TypeId ty = requireType("map"); TypeId ty = requireType("map");
const FunctionType* ftv = get<FunctionType>(follow(ty)); const FunctionType* ftv = get<FunctionType>(follow(ty));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("map<a, b>(arr: {a}, fn: (a) -> (b, ...unknown)): {b}", toStringNamedFunction("map", *ftv)); CHECK_EQ("map<a, b>(arr: {a}, fn: (a) -> (b, ...unknown)): {b}", toStringNamedFunction("map", *ftv));
else else
CHECK_EQ("map<a, b>(arr: {a}, fn: (a) -> b): {b}", toStringNamedFunction("map", *ftv)); CHECK_EQ("map<a, b>(arr: {a}, fn: (a) -> b): {b}", toStringNamedFunction("map", *ftv));
@ -841,7 +841,7 @@ TEST_CASE_FIXTURE(Fixture, "pick_distinct_names_for_mixed_explicit_and_implicit_
function foo<a>(x: a, y) end function foo<a>(x: a, y) end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("<a>(a, 'b) -> ()" == toString(requireType("foo"))); CHECK("<a>(a, 'b) -> ()" == toString(requireType("foo")));
} }
@ -873,7 +873,7 @@ TEST_CASE_FIXTURE(Fixture, "tostring_error_mismatch")
)"); )");
std::string expected; std::string expected;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
expected = expected =
R"(Type pack '{ a: number, b: string, c: { d: string } }' could not be converted into '{ a: number, b: string, c: { d: number } }'; at [0][read "c"][read "d"], string is not exactly number)"; R"(Type pack '{ a: number, b: string, c: { d: string } }' could not be converted into '{ a: number, b: string, c: { d: number } }'; at [0][read "c"][read "d"], string is not exactly number)";
else else
@ -901,7 +901,7 @@ Type 'string' could not be converted into 'number' in an invariant context)";
TEST_CASE_FIXTURE(Fixture, "checked_fn_toString") TEST_CASE_FIXTURE(Fixture, "checked_fn_toString")
{ {
ScopedFastFlag flags[] = { ScopedFastFlag flags[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
auto _result = loadDefinition(R"( auto _result = loadDefinition(R"(
@ -920,7 +920,7 @@ local f = abs
TEST_CASE_FIXTURE(Fixture, "read_only_properties") TEST_CASE_FIXTURE(Fixture, "read_only_properties")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = {x: string} type A = {x: string}
@ -950,7 +950,7 @@ TEST_CASE_FIXTURE(Fixture, "cycle_rooted_in_a_pack")
packPtr->head[0] = theTable; packPtr->head[0] = theTable;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("tp1 where tp1 = { read BaseField: unknown, read BaseMethod: (tp1) -> () }, number" == toString(thePack)); CHECK("tp1 where tp1 = { read BaseField: unknown, read BaseMethod: (tp1) -> () }, number" == toString(thePack));
else else
CHECK("tp1 where tp1 = {| BaseField: unknown, BaseMethod: (tp1) -> () |}, number" == toString(thePack)); CHECK("tp1 where tp1 = {| BaseField: unknown, BaseMethod: (tp1) -> () |}, number" == toString(thePack));
@ -969,7 +969,7 @@ TEST_CASE_FIXTURE(Fixture, "correct_stringification_user_defined_type_functions"
Type tv{tftt}; Type tv{tftt};
if (FFlag::DebugLuauDeferredConstraintResolution && FFlag::LuauUserDefinedTypeFunctions) if (FFlag::LuauSolverV2 && FFlag::LuauUserDefinedTypeFunctions)
CHECK_EQ(toString(&tv, {}), "woohoo<number>"); CHECK_EQ(toString(&tv, {}), "woohoo<number>");
} }

View File

@ -12,7 +12,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
struct TxnLogFixture struct TxnLogFixture
{ {
@ -35,7 +35,7 @@ TEST_SUITE_BEGIN("TxnLog");
TEST_CASE_FIXTURE(TxnLogFixture, "colliding_union_incoming_type_has_greater_scope") TEST_CASE_FIXTURE(TxnLogFixture, "colliding_union_incoming_type_has_greater_scope")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
log.replace(c, BoundType{a}); log.replace(c, BoundType{a});
log2.replace(a, BoundType{c}); log2.replace(a, BoundType{c});
@ -68,7 +68,7 @@ TEST_CASE_FIXTURE(TxnLogFixture, "colliding_union_incoming_type_has_greater_scop
TEST_CASE_FIXTURE(TxnLogFixture, "colliding_union_incoming_type_has_lesser_scope") TEST_CASE_FIXTURE(TxnLogFixture, "colliding_union_incoming_type_has_lesser_scope")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
log.replace(a, BoundType{c}); log.replace(a, BoundType{c});
log2.replace(c, BoundType{a}); log2.replace(c, BoundType{a});
@ -101,7 +101,7 @@ TEST_CASE_FIXTURE(TxnLogFixture, "colliding_union_incoming_type_has_lesser_scope
TEST_CASE_FIXTURE(TxnLogFixture, "colliding_coincident_logs_do_not_create_degenerate_unions") TEST_CASE_FIXTURE(TxnLogFixture, "colliding_coincident_logs_do_not_create_degenerate_unions")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
log.replace(a, BoundType{b}); log.replace(a, BoundType{b});
log2.replace(a, BoundType{b}); log2.replace(a, BoundType{b});

View File

@ -12,7 +12,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauUserDefinedTypeFunctions) LUAU_FASTFLAG(LuauUserDefinedTypeFunctions)
LUAU_DYNAMIC_FASTINT(LuauTypeFamilyApplicationCartesianProductLimit) LUAU_DYNAMIC_FASTINT(LuauTypeFamilyApplicationCartesianProductLimit)
@ -67,7 +67,7 @@ TEST_SUITE_BEGIN("TypeFunctionTests");
TEST_CASE_FIXTURE(TypeFunctionFixture, "basic_type_function") TEST_CASE_FIXTURE(TypeFunctionFixture, "basic_type_function")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -89,7 +89,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "basic_type_function")
TEST_CASE_FIXTURE(TypeFunctionFixture, "function_as_fn_ret") TEST_CASE_FIXTURE(TypeFunctionFixture, "function_as_fn_ret")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -108,7 +108,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "function_as_fn_ret")
TEST_CASE_FIXTURE(TypeFunctionFixture, "function_as_fn_arg") TEST_CASE_FIXTURE(TypeFunctionFixture, "function_as_fn_arg")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -126,7 +126,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "function_as_fn_arg")
TEST_CASE_FIXTURE(TypeFunctionFixture, "resolve_deep_functions") TEST_CASE_FIXTURE(TypeFunctionFixture, "resolve_deep_functions")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -139,7 +139,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "resolve_deep_functions")
TEST_CASE_FIXTURE(TypeFunctionFixture, "unsolvable_function") TEST_CASE_FIXTURE(TypeFunctionFixture, "unsolvable_function")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -159,7 +159,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "unsolvable_function")
TEST_CASE_FIXTURE(TypeFunctionFixture, "table_internal_functions") TEST_CASE_FIXTURE(TypeFunctionFixture, "table_internal_functions")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -179,7 +179,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "table_internal_functions")
TEST_CASE_FIXTURE(TypeFunctionFixture, "function_internal_functions") TEST_CASE_FIXTURE(TypeFunctionFixture, "function_internal_functions")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -200,7 +200,7 @@ TEST_CASE_FIXTURE(TypeFunctionFixture, "function_internal_functions")
TEST_CASE_FIXTURE(Fixture, "add_function_at_work") TEST_CASE_FIXTURE(Fixture, "add_function_at_work")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -229,7 +229,7 @@ TEST_CASE_FIXTURE(Fixture, "add_function_at_work")
TEST_CASE_FIXTURE(BuiltinsFixture, "cyclic_add_function_at_work") TEST_CASE_FIXTURE(BuiltinsFixture, "cyclic_add_function_at_work")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -242,7 +242,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "cyclic_add_function_at_work")
TEST_CASE_FIXTURE(BuiltinsFixture, "mul_function_with_union_of_multiplicatives") TEST_CASE_FIXTURE(BuiltinsFixture, "mul_function_with_union_of_multiplicatives")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
loadDefinition(R"( loadDefinition(R"(
@ -265,7 +265,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "mul_function_with_union_of_multiplicatives")
TEST_CASE_FIXTURE(BuiltinsFixture, "mul_function_with_union_of_multiplicatives_2") TEST_CASE_FIXTURE(BuiltinsFixture, "mul_function_with_union_of_multiplicatives_2")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
loadDefinition(R"( loadDefinition(R"(
@ -285,7 +285,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "mul_function_with_union_of_multiplicatives_2
TEST_CASE_FIXTURE(Fixture, "internal_functions_raise_errors") TEST_CASE_FIXTURE(Fixture, "internal_functions_raise_errors")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -303,7 +303,7 @@ TEST_CASE_FIXTURE(Fixture, "internal_functions_raise_errors")
TEST_CASE_FIXTURE(BuiltinsFixture, "type_functions_can_be_shadowed") TEST_CASE_FIXTURE(BuiltinsFixture, "type_functions_can_be_shadowed")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -328,7 +328,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_functions_can_be_shadowed")
TEST_CASE_FIXTURE(BuiltinsFixture, "type_functions_inhabited_with_normalization") TEST_CASE_FIXTURE(BuiltinsFixture, "type_functions_inhabited_with_normalization")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -346,7 +346,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_functions_inhabited_with_normalization"
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_works") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_works")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -367,7 +367,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_works")
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_works_with_metatables") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_works_with_metatables")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -390,7 +390,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_works_with_metatables")
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_errors_if_it_has_nontable_part") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_errors_if_it_has_nontable_part")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -408,7 +408,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_errors_if_it_has_nontabl
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_string_indexer") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_string_indexer")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -436,7 +436,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_string_indexer")
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_common_subset_if_union_of_differing_tables") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_common_subset_if_union_of_differing_tables")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -457,7 +457,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_common_subset_if_union_o
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_never_for_empty_table") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_never_for_empty_table")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -472,7 +472,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_type_function_never_for_empty_table")
TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_works") TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_works")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -493,7 +493,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_works")
TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_ignores_metatables") TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_ignores_metatables")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -516,7 +516,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_ignores_metatables")
TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_errors_if_it_has_nontable_part") TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_errors_if_it_has_nontable_part")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -534,7 +534,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_errors_if_it_has_nont
TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_common_subset_if_union_of_differing_tables") TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_common_subset_if_union_of_differing_tables")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -555,7 +555,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_common_subset_if_unio
TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_never_for_empty_table") TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_never_for_empty_table")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -570,7 +570,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawkeyof_type_function_never_for_empty_table
TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_works_on_classes") TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_works_on_classes")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -590,7 +590,7 @@ TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_works_on_classes")
TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_errors_if_it_has_nonclass_part") TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_errors_if_it_has_nonclass_part")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -607,7 +607,7 @@ TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_errors_if_it_has_nonclass_p
TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_common_subset_if_union_of_differing_classes") TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_common_subset_if_union_of_differing_classes")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -621,7 +621,7 @@ TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_common_subset_if_union_of_d
TEST_CASE_FIXTURE(ClassFixture, "binary_type_function_works_with_default_argument") TEST_CASE_FIXTURE(ClassFixture, "binary_type_function_works_with_default_argument")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -636,7 +636,7 @@ TEST_CASE_FIXTURE(ClassFixture, "binary_type_function_works_with_default_argumen
TEST_CASE_FIXTURE(ClassFixture, "vector2_multiply_is_overloaded") TEST_CASE_FIXTURE(ClassFixture, "vector2_multiply_is_overloaded")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -659,7 +659,7 @@ TEST_CASE_FIXTURE(ClassFixture, "vector2_multiply_is_overloaded")
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_rfc_example") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_rfc_example")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -690,7 +690,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_rfc_example")
TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_oss_crash_gh1161") TEST_CASE_FIXTURE(BuiltinsFixture, "keyof_oss_crash_gh1161")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -730,7 +730,7 @@ _(setmetatable(_,{[...]=_,}))
TEST_CASE_FIXTURE(BuiltinsFixture, "cyclic_concat_function_at_work") TEST_CASE_FIXTURE(BuiltinsFixture, "cyclic_concat_function_at_work")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -743,7 +743,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "cyclic_concat_function_at_work")
TEST_CASE_FIXTURE(BuiltinsFixture, "exceeded_distributivity_limits") TEST_CASE_FIXTURE(BuiltinsFixture, "exceeded_distributivity_limits")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
ScopedFastInt sfi{DFInt::LuauTypeFamilyApplicationCartesianProductLimit, 10}; ScopedFastInt sfi{DFInt::LuauTypeFamilyApplicationCartesianProductLimit, 10};
@ -776,7 +776,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "exceeded_distributivity_limits")
TEST_CASE_FIXTURE(BuiltinsFixture, "didnt_quite_exceed_distributivity_limits") TEST_CASE_FIXTURE(BuiltinsFixture, "didnt_quite_exceed_distributivity_limits")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
// We duplicate the test here because we want to make sure the test failed // We duplicate the test here because we want to make sure the test failed
@ -810,7 +810,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "didnt_quite_exceed_distributivity_limits")
TEST_CASE_FIXTURE(BuiltinsFixture, "ensure_equivalence_with_distributivity") TEST_CASE_FIXTURE(BuiltinsFixture, "ensure_equivalence_with_distributivity")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
loadDefinition(R"( loadDefinition(R"(
@ -843,7 +843,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "ensure_equivalence_with_distributivity")
TEST_CASE_FIXTURE(BuiltinsFixture, "we_shouldnt_warn_that_a_reducible_type_function_is_uninhabited") TEST_CASE_FIXTURE(BuiltinsFixture, "we_shouldnt_warn_that_a_reducible_type_function_is_uninhabited")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -873,7 +873,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -896,7 +896,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works")
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_array") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_array")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -911,7 +911,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_array")
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_generic_types") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_generic_types")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -933,7 +933,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_generic_types")
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_errors_w_bad_indexer") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_errors_w_bad_indexer")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -949,7 +949,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_errors_w_bad_indexer")
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_errors_w_var_indexer") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_errors_w_var_indexer")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -966,7 +966,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_errors_w_var_indexer")
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_union_type_indexer") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_union_type_indexer")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -984,7 +984,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_union_type_index
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_union_type_indexee") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_union_type_indexee")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1003,7 +1003,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_union_type_index
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_rfc_alternative_section") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_rfc_alternative_section")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1021,7 +1021,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_rfc_alternative_section"
TEST_CASE_FIXTURE(ClassFixture, "index_type_function_works_on_classes") TEST_CASE_FIXTURE(ClassFixture, "index_type_function_works_on_classes")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1035,7 +1035,7 @@ TEST_CASE_FIXTURE(ClassFixture, "index_type_function_works_on_classes")
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_index_metatables") TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_index_metatables")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1061,7 +1061,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_index_metatables
TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works") TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1083,7 +1083,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works")
TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_array") TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_array")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1097,7 +1097,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_array")
TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_errors_w_var_indexer") TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_errors_w_var_indexer")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1113,7 +1113,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_errors_w_var_indexer")
TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_union_type_indexer") TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_union_type_indexer")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1129,7 +1129,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_union_type_inde
TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_union_type_indexee") TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_union_type_indexee")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1146,7 +1146,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_union_type_inde
TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_index_metatables") TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_index_metatables")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1166,7 +1166,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "rawget_type_function_works_w_index_metatable
TEST_CASE_FIXTURE(ClassFixture, "rawget_type_function_errors_w_classes") TEST_CASE_FIXTURE(ClassFixture, "rawget_type_function_errors_w_classes")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(

View File

@ -8,7 +8,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauUserDefinedTypeFunctions) LUAU_FASTFLAG(LuauUserDefinedTypeFunctions)
TEST_SUITE_BEGIN("TypeAliases"); TEST_SUITE_BEGIN("TypeAliases");
@ -72,7 +72,7 @@ TEST_CASE_FIXTURE(Fixture, "cannot_steal_hoisted_type_alias")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK( CHECK(
result.errors[0] == result.errors[0] ==
@ -105,7 +105,7 @@ TEST_CASE_FIXTURE(Fixture, "cannot_steal_hoisted_type_alias")
TEST_CASE_FIXTURE(Fixture, "mismatched_generic_type_param") TEST_CASE_FIXTURE(Fixture, "mismatched_generic_type_param")
{ {
// We erroneously report an extra error in this case when the new solver is enabled. // We erroneously report an extra error in this case when the new solver is enabled.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type T<A> = (A...) -> () type T<A> = (A...) -> ()
@ -205,7 +205,7 @@ TEST_CASE_FIXTURE(Fixture, "mutually_recursive_aliases")
TEST_CASE_FIXTURE(Fixture, "generic_aliases") TEST_CASE_FIXTURE(Fixture, "generic_aliases")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
type T<a> = { v: a } type T<a> = { v: a }
@ -223,7 +223,7 @@ TEST_CASE_FIXTURE(Fixture, "generic_aliases")
TEST_CASE_FIXTURE(Fixture, "dependent_generic_aliases") TEST_CASE_FIXTURE(Fixture, "dependent_generic_aliases")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -244,7 +244,7 @@ TEST_CASE_FIXTURE(Fixture, "dependent_generic_aliases")
TEST_CASE_FIXTURE(Fixture, "mutually_recursive_generic_aliases") TEST_CASE_FIXTURE(Fixture, "mutually_recursive_generic_aliases")
{ {
// CLI-116108 // CLI-116108
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -344,7 +344,7 @@ TEST_CASE_FIXTURE(Fixture, "stringify_type_alias_of_recursive_template_table_typ
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("t1 where t1 = ({ a: t1 }) -> string", toString(tm->wantedType)); CHECK_EQ("t1 where t1 = ({ a: t1 }) -> string", toString(tm->wantedType));
else else
CHECK_EQ("t1 where t1 = ({| a: t1 |}) -> string", toString(tm->wantedType)); CHECK_EQ("t1 where t1 = ({| a: t1 |}) -> string", toString(tm->wantedType));
@ -355,7 +355,7 @@ TEST_CASE_FIXTURE(Fixture, "stringify_type_alias_of_recursive_template_table_typ
TEST_CASE_FIXTURE(Fixture, "cli_38393_recursive_intersection_oom") TEST_CASE_FIXTURE(Fixture, "cli_38393_recursive_intersection_oom")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; // FIXME }; // FIXME
CheckResult result = check(R"( CheckResult result = check(R"(
@ -417,7 +417,7 @@ TEST_CASE_FIXTURE(Fixture, "corecursive_function_types")
TEST_CASE_FIXTURE(Fixture, "generic_param_remap") TEST_CASE_FIXTURE(Fixture, "generic_param_remap")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
const std::string code = R"( const std::string code = R"(
-- An example of a forwarded use of a type that has different type arguments than parameters -- An example of a forwarded use of a type that has different type arguments than parameters
@ -543,7 +543,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_alias_import_mutation")
TEST_CASE_FIXTURE(Fixture, "type_alias_local_mutation") TEST_CASE_FIXTURE(Fixture, "type_alias_local_mutation")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Cool = { a: number, b: string } type Cool = { a: number, b: string }
@ -564,7 +564,7 @@ TEST_CASE_FIXTURE(Fixture, "type_alias_local_mutation")
TEST_CASE_FIXTURE(Fixture, "type_alias_local_rename") TEST_CASE_FIXTURE(Fixture, "type_alias_local_rename")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Cool = { a: number, b: string } type Cool = { a: number, b: string }
@ -660,7 +660,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_alias_of_an_imported_recursive_generic_
ty2 = lookupType("X"); ty2 = lookupType("X");
REQUIRE(ty2); REQUIRE(ty2);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK(toString(*ty1, {true}) == "t1 where t1 = { C: t1?, a: T, b: U }"); CHECK(toString(*ty1, {true}) == "t1 where t1 = { C: t1?, a: T, b: U }");
CHECK(toString(*ty2, {true}) == "t1 where t1 = { C: t1?, a: U, b: T }"); CHECK(toString(*ty2, {true}) == "t1 where t1 = { C: t1?, a: U, b: T }");
@ -712,7 +712,7 @@ TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_restriction_ok")
TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_restriction_not_ok_1") TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_restriction_not_ok_1")
{ {
// CLI-116108 // CLI-116108
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
-- OK because forwarded types are used with their parameters. -- OK because forwarded types are used with their parameters.
@ -726,7 +726,7 @@ TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_restriction_not_ok_1")
TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_restriction_not_ok_2") TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_restriction_not_ok_2")
{ {
// CLI-116108 // CLI-116108
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
-- Not OK because forwarded types are used with different types than their parameters. -- Not OK because forwarded types are used with different types than their parameters.
@ -750,7 +750,7 @@ TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_swapsies_ok")
TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_swapsies_not_ok") TEST_CASE_FIXTURE(Fixture, "mutually_recursive_types_swapsies_not_ok")
{ {
// CLI-116108 // CLI-116108
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Tree1<T,U> = { data: T, children: {Tree2<U,T>} } type Tree1<T,U> = { data: T, children: {Tree2<U,T>} }
@ -855,7 +855,7 @@ TEST_CASE_FIXTURE(Fixture, "forward_declared_alias_is_not_clobbered_by_prior_uni
local d: FutureType = { smth = true } -- missing error, 'd' is resolved to 'any' local d: FutureType = { smth = true } -- missing error, 'd' is resolved to 'any'
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ foo: number }", toString(requireType("d"), {true})); CHECK_EQ("{ foo: number }", toString(requireType("d"), {true}));
else else
CHECK_EQ("{| foo: number |}", toString(requireType("d"), {true})); CHECK_EQ("{| foo: number |}", toString(requireType("d"), {true}));
@ -875,7 +875,7 @@ TEST_CASE_FIXTURE(Fixture, "recursive_types_restriction_ok")
TEST_CASE_FIXTURE(Fixture, "recursive_types_restriction_not_ok") TEST_CASE_FIXTURE(Fixture, "recursive_types_restriction_not_ok")
{ {
// CLI-116108 // CLI-116108
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
-- this would be an infinite type if we allowed it -- this would be an infinite type if we allowed it
@ -888,7 +888,7 @@ TEST_CASE_FIXTURE(Fixture, "recursive_types_restriction_not_ok")
TEST_CASE_FIXTURE(Fixture, "report_shadowed_aliases") TEST_CASE_FIXTURE(Fixture, "report_shadowed_aliases")
{ {
// CLI-116110 // CLI-116110
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
// We allow a previous type alias to depend on a future type alias. That exact feature enables a confusing example, like the following snippet, // We allow a previous type alias to depend on a future type alias. That exact feature enables a confusing example, like the following snippet,
// which has the type alias FakeString point to the type alias `string` that which points to `number`. // which has the type alias FakeString point to the type alias `string` that which points to `number`.
@ -972,7 +972,7 @@ TEST_CASE_FIXTURE(Fixture, "type_alias_locations")
TEST_CASE_FIXTURE(BuiltinsFixture, "dont_lose_track_of_PendingExpansionTypes_after_substitution") TEST_CASE_FIXTURE(BuiltinsFixture, "dont_lose_track_of_PendingExpansionTypes_after_substitution")
{ {
// CLI-114134 - We need egraphs to properly simplify these types. // CLI-114134 - We need egraphs to properly simplify these types.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
fileResolver.source["game/ReactCurrentDispatcher"] = R"( fileResolver.source["game/ReactCurrentDispatcher"] = R"(
export type BasicStateAction<S> = ((S) -> S) | S export type BasicStateAction<S> = ((S) -> S) | S
@ -1115,7 +1115,7 @@ type Foo<T> = Foo<T>
TEST_CASE_FIXTURE(Fixture, "recursive_type_alias_bad_pack_use_warns") TEST_CASE_FIXTURE(Fixture, "recursive_type_alias_bad_pack_use_warns")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1155,7 +1155,7 @@ type Foo<T> = Foo<T> | string
TEST_CASE_FIXTURE(BuiltinsFixture, "type_alias_adds_reduce_constraint_for_type_function") TEST_CASE_FIXTURE(BuiltinsFixture, "type_alias_adds_reduce_constraint_for_type_function")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution || !FFlag::LuauUserDefinedTypeFunctions) if (!FFlag::LuauSolverV2 || !FFlag::LuauUserDefinedTypeFunctions)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(

View File

@ -7,7 +7,7 @@
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(DebugLuauMagicTypes); LUAU_FASTFLAG(DebugLuauMagicTypes);
using namespace Luau; using namespace Luau;
@ -78,7 +78,7 @@ TEST_CASE_FIXTURE(Fixture, "assignment_cannot_transform_a_table_property_type")
TEST_CASE_FIXTURE(Fixture, "assignments_to_unannotated_parameters_can_transform_the_type") TEST_CASE_FIXTURE(Fixture, "assignments_to_unannotated_parameters_can_transform_the_type")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x) function f(x)
@ -94,7 +94,7 @@ TEST_CASE_FIXTURE(Fixture, "assignments_to_unannotated_parameters_can_transform_
TEST_CASE_FIXTURE(Fixture, "assignments_to_annotated_parameters_are_checked") TEST_CASE_FIXTURE(Fixture, "assignments_to_annotated_parameters_are_checked")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x: string) function f(x: string)
@ -264,7 +264,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_of_value_a_via_typeof_with_assignment")
a = "foo" a = "foo"
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("string?" == toString(requireType("a"))); CHECK("string?" == toString(requireType("a")));
CHECK("nil" == toString(requireType("b"))); CHECK("nil" == toString(requireType("b")));

View File

@ -13,7 +13,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
TEST_SUITE_BEGIN("TypeInferAnyError"); TEST_SUITE_BEGIN("TypeInferAnyError");
@ -32,7 +32,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_returns_any")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("any?" == toString(requireType("a"))); CHECK("any?" == toString(requireType("a")));
else else
CHECK(builtinTypes->anyType == requireType("a")); CHECK(builtinTypes->anyType == requireType("a"));
@ -53,7 +53,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_returns_any2")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("any?" == toString(requireType("a"))); CHECK("any?" == toString(requireType("a")));
else else
CHECK("any" == toString(requireType("a"))); CHECK("any" == toString(requireType("a")));
@ -72,7 +72,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_is_any")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("any?" == toString(requireType("a"))); CHECK("any?" == toString(requireType("a")));
else else
CHECK("any" == toString(requireType("a"))); CHECK("any" == toString(requireType("a")));
@ -89,7 +89,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_is_any2")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("any?" == toString(requireType("a"))); CHECK("any?" == toString(requireType("a")));
else else
CHECK("any" == toString(requireType("a"))); CHECK("any" == toString(requireType("a")));
@ -108,7 +108,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_is_any_pack")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("any?" == toString(requireType("a"))); CHECK("any?" == toString(requireType("a")));
else else
CHECK("any" == toString(requireType("a"))); CHECK("any" == toString(requireType("a")));
@ -126,7 +126,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_is_error")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// Bug: We do not simplify at the right time // Bug: We do not simplify at the right time
CHECK_EQ("*error-type*?", toString(requireType("a"))); CHECK_EQ("*error-type*?", toString(requireType("a")));
@ -148,7 +148,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_iterator_is_error2")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-97375(awe): `bar()` is returning `nil` here, which isn't wrong necessarily, // CLI-97375(awe): `bar()` is returning `nil` here, which isn't wrong necessarily,
// but then we're signaling an additional error for the access on `nil`. // but then we're signaling an additional error for the access on `nil`.
@ -277,7 +277,7 @@ TEST_CASE_FIXTURE(Fixture, "calling_error_type_yields_error")
CHECK_EQ("unknown", err->name); CHECK_EQ("unknown", err->name);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("any", toString(requireType("a"))); CHECK_EQ("any", toString(requireType("a")));
else else
CHECK_EQ("*error-type*", toString(requireType("a"))); CHECK_EQ("*error-type*", toString(requireType("a")));
@ -289,7 +289,7 @@ TEST_CASE_FIXTURE(Fixture, "chain_calling_error_type_yields_error")
local a = Utility.Create "Foo" {} local a = Utility.Create "Foo" {}
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("any", toString(requireType("a"))); CHECK_EQ("any", toString(requireType("a")));
else else
CHECK_EQ("*error-type*", toString(requireType("a"))); CHECK_EQ("*error-type*", toString(requireType("a")));
@ -307,7 +307,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "replace_every_free_type_when_unifying_a_comp
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("any?", toString(requireType("b"))); CHECK_EQ("any?", toString(requireType("b")));
else else
CHECK_EQ("any", toString(requireType("b"))); CHECK_EQ("any", toString(requireType("b")));

View File

@ -8,7 +8,8 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauDCRMagicFunctionTypeChecker);
TEST_SUITE_BEGIN("BuiltinTests"); TEST_SUITE_BEGIN("BuiltinTests");
@ -132,7 +133,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "sort_with_predicate")
TEST_CASE_FIXTURE(BuiltinsFixture, "sort_with_bad_predicate") TEST_CASE_FIXTURE(BuiltinsFixture, "sort_with_bad_predicate")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -414,7 +415,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_pack")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ [number]: boolean | number | string, n: number }", toString(requireType("t"))); CHECK_EQ("{ [number]: boolean | number | string, n: number }", toString(requireType("t")));
else else
CHECK_EQ("{| [number]: boolean | number | string, n: number |}", toString(requireType("t"))); CHECK_EQ("{| [number]: boolean | number | string, n: number |}", toString(requireType("t")));
@ -432,7 +433,7 @@ local t = table.pack(f())
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ [number]: number | string, n: number }", toString(requireType("t"))); CHECK_EQ("{ [number]: number | string, n: number }", toString(requireType("t")));
else else
CHECK_EQ("{| [number]: number | string, n: number |}", toString(requireType("t"))); CHECK_EQ("{| [number]: number | string, n: number |}", toString(requireType("t")));
@ -445,7 +446,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_pack_reduce")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ [number]: boolean | number, n: number }", toString(requireType("t"))); CHECK_EQ("{ [number]: boolean | number, n: number }", toString(requireType("t")));
else else
CHECK_EQ("{| [number]: boolean | number, n: number |}", toString(requireType("t"))); CHECK_EQ("{| [number]: boolean | number, n: number |}", toString(requireType("t")));
@ -455,7 +456,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_pack_reduce")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ [number]: string, n: number }", toString(requireType("t"))); CHECK_EQ("{ [number]: string, n: number }", toString(requireType("t")));
else else
CHECK_EQ("{| [number]: string, n: number |}", toString(requireType("t"))); CHECK_EQ("{| [number]: string, n: number |}", toString(requireType("t")));
@ -512,7 +513,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "buffer_is_a_type")
TEST_CASE_FIXTURE(BuiltinsFixture, "coroutine_resume_anything_goes") TEST_CASE_FIXTURE(BuiltinsFixture, "coroutine_resume_anything_goes")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function nifty(x, y) local function nifty(x, y)
@ -551,7 +552,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "coroutine_wrap_anything_goes")
TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_should_not_mutate_persisted_types") TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_should_not_mutate_persisted_types")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -599,7 +600,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "string_format_arg_count_mismatch")
TEST_CASE_FIXTURE(BuiltinsFixture, "string_format_correctly_ordered_types") TEST_CASE_FIXTURE(BuiltinsFixture, "string_format_correctly_ordered_types")
{ {
// CLI-115690 // CLI-115690
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -703,7 +704,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "bad_select_should_not_crash")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// Counterintuitively, the parameter l0 is unconstrained and therefore it is valid to pass nil. // Counterintuitively, the parameter l0 is unconstrained and therefore it is valid to pass nil.
// The new solver therefore considers that parameter to be optional. // The new solver therefore considers that parameter to be optional.
@ -721,7 +722,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "bad_select_should_not_crash")
TEST_CASE_FIXTURE(BuiltinsFixture, "select_way_out_of_range") TEST_CASE_FIXTURE(BuiltinsFixture, "select_way_out_of_range")
{ {
// CLI-115720 // CLI-115720
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -736,7 +737,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "select_way_out_of_range")
TEST_CASE_FIXTURE(BuiltinsFixture, "select_slightly_out_of_range") TEST_CASE_FIXTURE(BuiltinsFixture, "select_slightly_out_of_range")
{ {
// CLI-115720 // CLI-115720
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -770,7 +771,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "select_with_variadic_typepack_tail")
TEST_CASE_FIXTURE(BuiltinsFixture, "select_with_variadic_typepack_tail_and_string_head") TEST_CASE_FIXTURE(BuiltinsFixture, "select_with_variadic_typepack_tail_and_string_head")
{ {
// CLI-115720 // CLI-115720
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -793,7 +794,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "select_with_variadic_typepack_tail_and_strin
TEST_CASE_FIXTURE(Fixture, "string_format_as_method") TEST_CASE_FIXTURE(Fixture, "string_format_as_method")
{ {
// CLI-115690 // CLI-115690
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check("local _ = ('%s'):format(5)"); CheckResult result = check("local _ = ('%s'):format(5)");
@ -820,7 +821,7 @@ TEST_CASE_FIXTURE(Fixture, "string_format_use_correct_argument")
TEST_CASE_FIXTURE(Fixture, "string_format_use_correct_argument2") TEST_CASE_FIXTURE(Fixture, "string_format_use_correct_argument2")
{ {
// CLI-115690 // CLI-115690
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -882,7 +883,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "debug_info_is_crazy")
TEST_CASE_FIXTURE(BuiltinsFixture, "aliased_string_format") TEST_CASE_FIXTURE(BuiltinsFixture, "aliased_string_format")
{ {
// CLI-115690 // CLI-115690
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -945,9 +946,10 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "select_on_variadic")
TEST_CASE_FIXTURE(BuiltinsFixture, "string_format_report_all_type_errors_at_correct_positions") TEST_CASE_FIXTURE(BuiltinsFixture, "string_format_report_all_type_errors_at_correct_positions")
{ {
// CLI-115690 // CLI-115690
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
ScopedFastFlag sff{FFlag::LuauDCRMagicFunctionTypeChecker, true};
CheckResult result = check(R"( CheckResult result = check(R"(
("%s%d%s"):format(1, "hello", true) ("%s%d%s"):format(1, "hello", true)
string.format("%s%d%s", 1, "hello", true) string.format("%s%d%s", 1, "hello", true)
@ -986,7 +988,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "tonumber_returns_optional_number_type")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ( CHECK_EQ(
"Type 'number?' could not be converted into 'number'; type number?[1] (nil) is not a subtype of number (number)", "Type 'number?' could not be converted into 'number'; type number?[1] (nil) is not a subtype of number (number)",
toString(result.errors[0]) toString(result.errors[0])
@ -1009,7 +1011,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dont_add_definitions_to_persistent_types")
{ {
// This test makes no sense with type states and I think it generally makes no sense under the new solver. // This test makes no sense with type states and I think it generally makes no sense under the new solver.
// TODO: clip. // TODO: clip.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1042,7 +1044,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "assert_removes_falsy_types")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("((boolean | number)?) -> number | true", toString(requireType("f"))); CHECK_EQ("((boolean | number)?) -> number | true", toString(requireType("f")));
else else
CHECK_EQ("((boolean | number)?) -> boolean | number", toString(requireType("f"))); CHECK_EQ("((boolean | number)?) -> boolean | number", toString(requireType("f")));
@ -1070,7 +1072,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "assert_removes_falsy_types3")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("((boolean | number)?) -> number | true", toString(requireType("f"))); CHECK_EQ("((boolean | number)?) -> number | true", toString(requireType("f")));
else // without the annotation, the old solver doesn't infer the best return type here else // without the annotation, the old solver doesn't infer the best return type here
CHECK_EQ("((boolean | number)?) -> boolean | number", toString(requireType("f"))); CHECK_EQ("((boolean | number)?) -> boolean | number", toString(requireType("f")));
@ -1078,7 +1080,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "assert_removes_falsy_types3")
TEST_CASE_FIXTURE(BuiltinsFixture, "assert_removes_falsy_types_even_from_type_pack_tail_but_only_for_the_first_type") TEST_CASE_FIXTURE(BuiltinsFixture, "assert_removes_falsy_types_even_from_type_pack_tail_but_only_for_the_first_type")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1093,7 +1095,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "assert_removes_falsy_types_even_from_type_pa
TEST_CASE_FIXTURE(BuiltinsFixture, "assert_returns_false_and_string_iff_it_knows_the_first_argument_cannot_be_truthy") TEST_CASE_FIXTURE(BuiltinsFixture, "assert_returns_false_and_string_iff_it_knows_the_first_argument_cannot_be_truthy")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114134 - egraph simplification // CLI-114134 - egraph simplification
return; return;
@ -1128,7 +1130,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_freeze_is_generic")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Key 'b' not found in table '{ a: number }'" == toString(result.errors[0])); CHECK("Key 'b' not found in table '{ a: number }'" == toString(result.errors[0]));
else else
CHECK_EQ("Key 'b' not found in table '{| a: number |}'", toString(result.errors[0])); CHECK_EQ("Key 'b' not found in table '{| a: number |}'", toString(result.errors[0]));
@ -1138,7 +1140,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_freeze_is_generic")
CHECK_EQ("string", toString(requireType("b"))); CHECK_EQ("string", toString(requireType("b")));
CHECK_EQ("boolean", toString(requireType("c"))); CHECK_EQ("boolean", toString(requireType("c")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("any", toString(requireType("d"))); CHECK_EQ("any", toString(requireType("d")));
else else
CHECK_EQ("*error-type*", toString(requireType("d"))); CHECK_EQ("*error-type*", toString(requireType("d")));
@ -1147,7 +1149,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_freeze_is_generic")
TEST_CASE_FIXTURE(BuiltinsFixture, "set_metatable_needs_arguments") TEST_CASE_FIXTURE(BuiltinsFixture, "set_metatable_needs_arguments")
{ {
// In the new solver, nil can certainly be used where a generic is required, so all generic parameters are optional. // In the new solver, nil can certainly be used where a generic is required, so all generic parameters are optional.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local a = {b=setmetatable} local a = {b=setmetatable}

View File

@ -13,7 +13,7 @@
using namespace Luau; using namespace Luau;
using std::nullopt; using std::nullopt;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
TEST_SUITE_BEGIN("TypeInferClasses"); TEST_SUITE_BEGIN("TypeInferClasses");
@ -128,7 +128,7 @@ TEST_CASE_FIXTURE(ClassFixture, "we_can_infer_that_a_parameter_must_be_a_particu
TEST_CASE_FIXTURE(ClassFixture, "we_can_report_when_someone_is_trying_to_use_a_table_rather_than_a_class") TEST_CASE_FIXTURE(ClassFixture, "we_can_report_when_someone_is_trying_to_use_a_table_rather_than_a_class")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function makeClone(o) function makeClone(o)
@ -156,7 +156,7 @@ TEST_CASE_FIXTURE(ClassFixture, "we_can_report_when_someone_is_trying_to_use_a_t
TEST_CASE_FIXTURE(ClassFixture, "we_can_report_when_someone_is_trying_to_use_a_table_rather_than_a_class_using_new_solver") TEST_CASE_FIXTURE(ClassFixture, "we_can_report_when_someone_is_trying_to_use_a_table_rather_than_a_class_using_new_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function makeClone(o) function makeClone(o)
@ -235,7 +235,7 @@ TEST_CASE_FIXTURE(ClassFixture, "can_assign_to_prop_of_base_class_using_string")
TEST_CASE_FIXTURE(ClassFixture, "cannot_unify_class_instance_with_primitive") TEST_CASE_FIXTURE(ClassFixture, "cannot_unify_class_instance_with_primitive")
{ {
// This is allowed in the new solver // This is allowed in the new solver
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local v = Vector2.New(0, 5) local v = Vector2.New(0, 5)
@ -397,7 +397,7 @@ TEST_CASE_FIXTURE(ClassFixture, "table_class_unification_reports_sane_errors_for
foo(a) foo(a)
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK("Type 'Vector2' could not be converted into '{ Y: number, w: number, x: number }'" == toString(result.errors[0])); CHECK("Type 'Vector2' could not be converted into '{ Y: number, w: number, x: number }'" == toString(result.errors[0]));
@ -454,7 +454,7 @@ b(a)
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("Type 'number' could not be converted into 'string'" == toString(result.errors.at(0))); CHECK("Type 'number' could not be converted into 'string'" == toString(result.errors.at(0)));
} }
@ -472,7 +472,7 @@ Type 'number' could not be converted into 'string')";
TEST_CASE_FIXTURE(ClassFixture, "class_type_mismatch_with_name_conflict") TEST_CASE_FIXTURE(ClassFixture, "class_type_mismatch_with_name_conflict")
{ {
// CLI-116433 // CLI-116433
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local i = ChildClass.New() local i = ChildClass.New()
@ -545,7 +545,7 @@ local b: B = a
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == "Type 'A' could not be converted into 'B'; at [read \"x\"], ChildClass is not exactly BaseClass"); CHECK(toString(result.errors.at(0)) == "Type 'A' could not be converted into 'B'; at [read \"x\"], ChildClass is not exactly BaseClass");
else else
{ {
@ -559,7 +559,7 @@ Type 'ChildClass' could not be converted into 'BaseClass' in an invariant contex
TEST_CASE_FIXTURE(ClassFixture, "optional_class_casts_work_in_new_solver") TEST_CASE_FIXTURE(ClassFixture, "optional_class_casts_work_in_new_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = { x: ChildClass } type A = { x: ChildClass }
@ -664,7 +664,7 @@ TEST_CASE_FIXTURE(ClassFixture, "indexable_classes")
local y = x[true] local y = x[true]
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK( CHECK(
"Type 'boolean' could not be converted into 'number | string'" == toString(result.errors.at(0)) "Type 'boolean' could not be converted into 'number | string'" == toString(result.errors.at(0))
); );
@ -679,7 +679,7 @@ TEST_CASE_FIXTURE(ClassFixture, "indexable_classes")
x[true] = 42 x[true] = 42
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK( CHECK(
"Type 'boolean' could not be converted into 'number | string'" == toString(result.errors.at(0)) "Type 'boolean' could not be converted into 'number | string'" == toString(result.errors.at(0))
); );
@ -696,7 +696,7 @@ TEST_CASE_FIXTURE(ClassFixture, "indexable_classes")
x.key = "string value" x.key = "string value"
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// Disabled for now. CLI-115686 // Disabled for now. CLI-115686
} }
@ -724,7 +724,7 @@ TEST_CASE_FIXTURE(ClassFixture, "indexable_classes")
local x : IndexableNumericKeyClass local x : IndexableNumericKeyClass
x["key"] = 1 x["key"] = 1
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(result.errors.at(0)), "Key 'key' not found in class 'IndexableNumericKeyClass'"); CHECK_EQ(toString(result.errors.at(0)), "Key 'key' not found in class 'IndexableNumericKeyClass'");
else else
CHECK_EQ(toString(result.errors.at(0)), "Type 'string' could not be converted into 'number'"); CHECK_EQ(toString(result.errors.at(0)), "Type 'string' could not be converted into 'number'");
@ -749,7 +749,7 @@ TEST_CASE_FIXTURE(ClassFixture, "indexable_classes")
local x : IndexableNumericKeyClass local x : IndexableNumericKeyClass
local y = x["key"] local y = x["key"]
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == "Key 'key' not found in class 'IndexableNumericKeyClass'"); CHECK(toString(result.errors.at(0)) == "Key 'key' not found in class 'IndexableNumericKeyClass'");
else else
CHECK_EQ(toString(result.errors.at(0)), "Type 'string' could not be converted into 'number'"); CHECK_EQ(toString(result.errors.at(0)), "Type 'string' could not be converted into 'number'");
@ -766,7 +766,7 @@ TEST_CASE_FIXTURE(ClassFixture, "indexable_classes")
TEST_CASE_FIXTURE(Fixture, "read_write_class_properties") TEST_CASE_FIXTURE(Fixture, "read_write_class_properties")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
TypeArena& arena = frontend.globals.globalTypes; TypeArena& arena = frontend.globals.globalTypes;

View File

@ -17,7 +17,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(LuauInstantiateInSubtyping); LUAU_FASTFLAG(LuauInstantiateInSubtyping);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTINT(LuauTarjanChildLimit); LUAU_FASTINT(LuauTarjanChildLimit);
LUAU_DYNAMIC_FASTFLAG(LuauImproveNonFunctionCallError) LUAU_DYNAMIC_FASTFLAG(LuauImproveNonFunctionCallError)
@ -79,7 +79,7 @@ TEST_CASE_FIXTURE(Fixture, "check_function_bodies")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
const TypePackMismatch* tm = get<TypePackMismatch>(result.errors[0]); const TypePackMismatch* tm = get<TypePackMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
@ -238,7 +238,7 @@ TEST_CASE_FIXTURE(Fixture, "list_only_alternative_overloads_that_match_argument_
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
GenericError* g = get<GenericError>(result.errors[0]); GenericError* g = get<GenericError>(result.errors[0]);
REQUIRE(g); REQUIRE(g);
@ -255,7 +255,7 @@ TEST_CASE_FIXTURE(Fixture, "list_only_alternative_overloads_that_match_argument_
ExtraInformation* ei = get<ExtraInformation>(result.errors[1]); ExtraInformation* ei = get<ExtraInformation>(result.errors[1]);
REQUIRE(ei); REQUIRE(ei);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Available overloads: (number) -> number; (number) -> string; and (number, number) -> number" == ei->message); CHECK("Available overloads: (number) -> number; (number) -> string; and (number, number) -> number" == ei->message);
else else
CHECK_EQ("Other overloads are also not viable: (number) -> string", ei->message); CHECK_EQ("Other overloads are also not viable: (number) -> string", ei->message);
@ -312,7 +312,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_return_type_from_selected_overload")
TEST_CASE_FIXTURE(Fixture, "too_many_arguments") TEST_CASE_FIXTURE(Fixture, "too_many_arguments")
{ {
// This is not part of the new non-strict specification currently. // This is not part of the new non-strict specification currently.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -480,7 +480,7 @@ TEST_CASE_FIXTURE(Fixture, "another_higher_order_function")
TEST_CASE_FIXTURE(Fixture, "another_other_higher_order_function") TEST_CASE_FIXTURE(Fixture, "another_other_higher_order_function")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(d) local function f(d)
@ -604,7 +604,7 @@ TEST_CASE_FIXTURE(Fixture, "duplicate_functions_allowed_in_nonstrict")
TEST_CASE_FIXTURE(Fixture, "duplicate_functions_with_different_signatures_not_allowed_in_nonstrict") TEST_CASE_FIXTURE(Fixture, "duplicate_functions_with_different_signatures_not_allowed_in_nonstrict")
{ {
// This is not part of the spec for the new non-strict mode currently. // This is not part of the spec for the new non-strict mode currently.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -883,7 +883,7 @@ TEST_CASE_FIXTURE(Fixture, "another_indirect_function_case_where_it_is_ok_to_pro
TEST_CASE_FIXTURE(Fixture, "report_exiting_without_return_nonstrict") TEST_CASE_FIXTURE(Fixture, "report_exiting_without_return_nonstrict")
{ {
// new non-strict mode spec does not include this error yet. // new non-strict mode spec does not include this error yet.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -1009,7 +1009,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "calling_function_with_anytypepack_doesnt_lea
opts.exhaustive = true; opts.exhaustive = true;
opts.maxTableLength = 0; opts.maxTableLength = 0;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{string}", toString(requireType("tab"), opts)); CHECK_EQ("{string}", toString(requireType("tab"), opts));
else else
CHECK_EQ("{any}", toString(requireType("tab"), opts)); CHECK_EQ("{any}", toString(requireType("tab"), opts));
@ -1018,7 +1018,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "calling_function_with_anytypepack_doesnt_lea
TEST_CASE_FIXTURE(Fixture, "too_many_return_values") TEST_CASE_FIXTURE(Fixture, "too_many_return_values")
{ {
// FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly. // FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -1042,7 +1042,7 @@ TEST_CASE_FIXTURE(Fixture, "too_many_return_values")
TEST_CASE_FIXTURE(Fixture, "too_many_return_values_in_parentheses") TEST_CASE_FIXTURE(Fixture, "too_many_return_values_in_parentheses")
{ {
// FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly. // FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -1066,7 +1066,7 @@ TEST_CASE_FIXTURE(Fixture, "too_many_return_values_in_parentheses")
TEST_CASE_FIXTURE(Fixture, "too_many_return_values_no_function") TEST_CASE_FIXTURE(Fixture, "too_many_return_values_no_function")
{ {
// FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly. // FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -1108,7 +1108,7 @@ TEST_CASE_FIXTURE(Fixture, "function_does_not_return_enough_values")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -1148,7 +1148,7 @@ TEST_CASE_FIXTURE(Fixture, "function_cast_error_uses_correct_language")
REQUIRE(tm1); REQUIRE(tm1);
CHECK_EQ("(string) -> number", toString(tm1->wantedType)); CHECK_EQ("(string) -> number", toString(tm1->wantedType));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(unknown, unknown) -> number", toString(tm1->givenType)); CHECK_EQ("(unknown, unknown) -> number", toString(tm1->givenType));
else else
CHECK_EQ("(string, *error-type*) -> number", toString(tm1->givenType)); CHECK_EQ("(string, *error-type*) -> number", toString(tm1->givenType));
@ -1157,7 +1157,7 @@ TEST_CASE_FIXTURE(Fixture, "function_cast_error_uses_correct_language")
REQUIRE(tm2); REQUIRE(tm2);
CHECK_EQ("(number, number) -> (number, number)", toString(tm2->wantedType)); CHECK_EQ("(number, number) -> (number, number)", toString(tm2->wantedType));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(unknown, unknown) -> number", toString(tm1->givenType)); CHECK_EQ("(unknown, unknown) -> number", toString(tm1->givenType));
else else
CHECK_EQ("(string, *error-type*) -> number", toString(tm2->givenType)); CHECK_EQ("(string, *error-type*) -> number", toString(tm2->givenType));
@ -1177,7 +1177,7 @@ TEST_CASE_FIXTURE(Fixture, "no_lossy_function_type")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
TypeId type = requireTypeAtPosition(Position(6, 14)); TypeId type = requireTypeAtPosition(Position(6, 14));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(unknown, number, number) -> number", toString(type)); CHECK_EQ("(unknown, number, number) -> number", toString(type));
else else
CHECK_EQ("(tbl, number, number) -> number", toString(type)); CHECK_EQ("(tbl, number, number) -> number", toString(type));
@ -1224,7 +1224,7 @@ TEST_CASE_FIXTURE(Fixture, "return_type_by_overload")
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
CHECK_EQ("string", toString(requireType("x"))); CHECK_EQ("string", toString(requireType("x")));
// the new solver does not currently "favor" arity-matching overloads when the call itself is ill-typed. // the new solver does not currently "favor" arity-matching overloads when the call itself is ill-typed.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("string", toString(requireType("y"))); CHECK_EQ("string", toString(requireType("y")));
else else
CHECK_EQ("number", toString(requireType("y"))); CHECK_EQ("number", toString(requireType("y")));
@ -1235,7 +1235,7 @@ TEST_CASE_FIXTURE(Fixture, "return_type_by_overload")
TEST_CASE_FIXTURE(BuiltinsFixture, "infer_anonymous_function_arguments") TEST_CASE_FIXTURE(BuiltinsFixture, "infer_anonymous_function_arguments")
{ {
// FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls // FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
// Simple direct arg to arg propagation // Simple direct arg to arg propagation
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1354,7 +1354,7 @@ f(function(x) return x * 2 end)
TEST_CASE_FIXTURE(BuiltinsFixture, "infer_generic_function_function_argument") TEST_CASE_FIXTURE(BuiltinsFixture, "infer_generic_function_function_argument")
{ {
// FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls // FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function sum<a>(x: a, y: a, f: (a, a) -> a) return f(x, y) end local function sum<a>(x: a, y: a, f: (a, a) -> a) return f(x, y) end
@ -1385,7 +1385,7 @@ local r = foldl(a, {s=0,c=0}, function(a, b) return {s = a.s + b, c = a.c + 1} e
TEST_CASE_FIXTURE(Fixture, "infer_generic_function_function_argument_overloaded") TEST_CASE_FIXTURE(Fixture, "infer_generic_function_function_argument_overloaded")
{ {
// FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls // FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function g1<T>(a: T, f: (T) -> T) return f(a) end local function g1<T>(a: T, f: (T) -> T) return f(a) end
@ -1452,7 +1452,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "variadic_any_is_compatible_with_a_generic_Ty
TEST_CASE_FIXTURE(Fixture, "infer_anonymous_function_arguments_outside_call") TEST_CASE_FIXTURE(Fixture, "infer_anonymous_function_arguments_outside_call")
{ {
// FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls // FIXME: CLI-116133 bidirectional type inference needs to push expected types in for higher-order function calls
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Table = { x: number, y: number } type Table = { x: number, y: number }
@ -1486,7 +1486,7 @@ end
)"); )");
// `h` regresses in the new solver, the return type is not being pushed into the body. // `h` regresses in the new solver, the return type is not being pushed into the body.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
else else
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -1495,7 +1495,7 @@ end
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_arg_count") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_arg_count")
{ {
// FIXME: CLI-116111 test disabled until type path stringification is improved // FIXME: CLI-116111 test disabled until type path stringification is improved
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = (number, number) -> string type A = (number, number) -> string
@ -1518,7 +1518,7 @@ caused by:
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_arg") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_arg")
{ {
// FIXME: CLI-116111 test disabled until type path stringification is improved // FIXME: CLI-116111 test disabled until type path stringification is improved
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = (number, number) -> string type A = (number, number) -> string
@ -1542,7 +1542,7 @@ Type 'string' could not be converted into 'number')";
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_ret_count") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_ret_count")
{ {
// FIXME: CLI-116111 test disabled until type path stringification is improved // FIXME: CLI-116111 test disabled until type path stringification is improved
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = (number, number) -> (number) type A = (number, number) -> (number)
@ -1565,7 +1565,7 @@ caused by:
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_ret") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_ret")
{ {
// FIXME: CLI-116111 test disabled until type path stringification is improved // FIXME: CLI-116111 test disabled until type path stringification is improved
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = (number, number) -> string type A = (number, number) -> string
@ -1589,7 +1589,7 @@ Type 'string' could not be converted into 'number')";
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_ret_mult") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_ret_mult")
{ {
// FIXME: CLI-116111 test disabled until type path stringification is improved // FIXME: CLI-116111 test disabled until type path stringification is improved
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = (number, number) -> (number, string) type A = (number, number) -> (number, string)
@ -1670,7 +1670,7 @@ t.f = function(x)
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ( CHECK_EQ(
@ -1720,7 +1720,7 @@ TEST_CASE_FIXTURE(Fixture, "inferred_higher_order_functions_are_quantified_at_th
{ {
// This test regresses in the new solver, but is sort of nonsensical insofar as `foo` is known to be `nil`, so it's "right" to not be able to call // This test regresses in the new solver, but is sort of nonsensical insofar as `foo` is known to be `nil`, so it's "right" to not be able to call
// it. // it.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local foo local foo
@ -1748,7 +1748,7 @@ t.f = function(x)
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK_EQ( CHECK_EQ(
@ -1789,7 +1789,7 @@ TEST_CASE_FIXTURE(Fixture, "strict_mode_ok_with_missing_arguments")
TEST_CASE_FIXTURE(Fixture, "function_statement_sealed_table_assignment_through_indexer") TEST_CASE_FIXTURE(Fixture, "function_statement_sealed_table_assignment_through_indexer")
{ {
// FIXME: CLI-116122 bug where `t:b` does not check against the type from the indexer annotation on `t`. // FIXME: CLI-116122 bug where `t:b` does not check against the type from the indexer annotation on `t`.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t: {[string]: () -> number} = {} local t: {[string]: () -> number} = {}
@ -1834,7 +1834,7 @@ TEST_CASE_FIXTURE(Fixture, "too_few_arguments_variadic")
TEST_CASE_FIXTURE(Fixture, "too_few_arguments_variadic_generic") TEST_CASE_FIXTURE(Fixture, "too_few_arguments_variadic_generic")
{ {
// FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly. // FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function test(a: number, b: string, ...) function test(a: number, b: string, ...)
@ -1862,7 +1862,7 @@ wrapper(test)
TEST_CASE_FIXTURE(BuiltinsFixture, "too_few_arguments_variadic_generic2") TEST_CASE_FIXTURE(BuiltinsFixture, "too_few_arguments_variadic_generic2")
{ {
// FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly. // FIXME: CLI-116157 variadic and generic type packs seem to be interacting incorrectly.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function test(a: number, b: string, ...) function test(a: number, b: string, ...)
@ -1903,7 +1903,7 @@ TEST_CASE_FIXTURE(Fixture, "occurs_check_failure_in_function_return_type")
TEST_CASE_FIXTURE(Fixture, "free_is_not_bound_to_unknown") TEST_CASE_FIXTURE(Fixture, "free_is_not_bound_to_unknown")
{ {
// This test only makes sense for the old solver // This test only makes sense for the old solver
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1937,7 +1937,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_infer_parameter_types_for_functions_from_their_
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ("<a>(a) -> a", toString(requireType("f"))); CHECK_EQ("<a>(a) -> a", toString(requireType("f")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("({ read p: { read q: unknown } }) -> ~(false?)?", toString(requireType("g"))); CHECK_EQ("({ read p: { read q: unknown } }) -> ~(false?)?", toString(requireType("g")));
else else
CHECK_EQ("({+ p: {+ q: nil +} +}) -> nil", toString(requireType("g"))); CHECK_EQ("({+ p: {+ q: nil +} +}) -> nil", toString(requireType("g")));
@ -1985,7 +1985,7 @@ u.b().foo()
)"); )");
LUAU_REQUIRE_ERROR_COUNT(9, result); LUAU_REQUIRE_ERROR_COUNT(9, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// These improvements to the error messages are currently regressed in the new type solver. // These improvements to the error messages are currently regressed in the new type solver.
CHECK_EQ(toString(result.errors[0]), "Argument count mismatch. Function expects 1 argument, but none are specified"); CHECK_EQ(toString(result.errors[0]), "Argument count mismatch. Function expects 1 argument, but none are specified");
@ -2016,7 +2016,7 @@ u.b().foo()
TEST_CASE_FIXTURE(BuiltinsFixture, "improved_function_arg_mismatch_error_nonstrict") TEST_CASE_FIXTURE(BuiltinsFixture, "improved_function_arg_mismatch_error_nonstrict")
{ {
// This behavior is not part of the current specification of the new type solver. // This behavior is not part of the current specification of the new type solver.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -2031,7 +2031,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "improved_function_arg_mismatch_error_nonstri
TEST_CASE_FIXTURE(Fixture, "luau_subtyping_is_np_hard") TEST_CASE_FIXTURE(Fixture, "luau_subtyping_is_np_hard")
{ {
// The case that _should_ succeed here (`z = x`) does not currently in the new solver. // The case that _should_ succeed here (`z = x`) does not currently in the new solver.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -2153,7 +2153,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "dont_assert_when_the_tarjan_limit_is_exceeded_during_generalization") TEST_CASE_FIXTURE(BuiltinsFixture, "dont_assert_when_the_tarjan_limit_is_exceeded_during_generalization")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
ScopedFastInt sfi{FInt::LuauTarjanChildLimit, 1}; ScopedFastInt sfi{FInt::LuauTarjanChildLimit, 1};
CheckResult result = check(R"( CheckResult result = check(R"(
@ -2199,7 +2199,7 @@ TEST_CASE_FIXTURE(Fixture, "instantiated_type_packs_must_have_a_non_null_scope")
TEST_CASE_FIXTURE(Fixture, "inner_frees_become_generic_in_dcr") TEST_CASE_FIXTURE(Fixture, "inner_frees_become_generic_in_dcr")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -2229,7 +2229,7 @@ TEST_CASE_FIXTURE(Fixture, "function_exprs_are_generalized_at_signature_scope_no
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(requireType("foo")) == "((unknown) -> nil)?"); CHECK(toString(requireType("foo")) == "((unknown) -> nil)?");
else else
{ {
@ -2248,7 +2248,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "param_1_and_2_both_takes_the_same_generic_bu
local ret: number = foo(vec2, { x = 5 }) local ret: number = foo(vec2, { x = 5 })
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -2312,7 +2312,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "param_1_and_2_both_takes_the_same_generic_bu
local z: boolean = f(5, "five") local z: boolean = f(5, "five")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -2342,14 +2342,14 @@ TEST_CASE_FIXTURE(Fixture, "attempt_to_call_an_intersection_of_tables")
if (DFFlag::LuauImproveNonFunctionCallError) if (DFFlag::LuauImproveNonFunctionCallError)
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(result.errors[0]), "Cannot call a value of type { x: number } & { y: string }"); CHECK_EQ(toString(result.errors[0]), "Cannot call a value of type { x: number } & { y: string }");
else else
CHECK_EQ(toString(result.errors[0]), "Cannot call a value of type {| x: number |}"); CHECK_EQ(toString(result.errors[0]), "Cannot call a value of type {| x: number |}");
} }
else else
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(result.errors[0]), "Cannot call non-function { x: number } & { y: string }"); CHECK_EQ(toString(result.errors[0]), "Cannot call non-function { x: number } & { y: string }");
else else
CHECK_EQ(toString(result.errors[0]), "Cannot call non-function {| x: number |}"); CHECK_EQ(toString(result.errors[0]), "Cannot call non-function {| x: number |}");
@ -2373,7 +2373,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "attempt_to_call_an_intersection_of_tables_wi
TEST_CASE_FIXTURE(Fixture, "generic_packs_are_not_variadic") TEST_CASE_FIXTURE(Fixture, "generic_packs_are_not_variadic")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local function apply<a, b..., c...>(f: (a, b...) -> c..., x: a) local function apply<a, b..., c...>(f: (a, b...) -> c..., x: a)
@ -2409,7 +2409,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "num_is_solved_before_num_or_str")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == "Type pack 'string' could not be converted into 'number'; at [0], string is not a subtype of number"); CHECK(toString(result.errors.at(0)) == "Type pack 'string' could not be converted into 'number'; at [0], string is not a subtype of number");
else else
CHECK_EQ("Type 'string' could not be converted into 'number'", toString(result.errors[0])); CHECK_EQ("Type 'string' could not be converted into 'number'", toString(result.errors[0]));
@ -2434,7 +2434,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "num_is_solved_after_num_or_str")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == "Type pack 'string' could not be converted into 'number'; at [0], string is not a subtype of number"); CHECK(toString(result.errors.at(0)) == "Type pack 'string' could not be converted into 'number'; at [0], string is not a subtype of number");
else else
CHECK_EQ("Type 'string' could not be converted into 'number'", toString(result.errors[0])); CHECK_EQ("Type 'string' could not be converted into 'number'", toString(result.errors[0]));
@ -2483,7 +2483,7 @@ a = function(a, b) return a + b end
TEST_CASE_FIXTURE(BuiltinsFixture, "simple_unannotated_mutual_recursion") TEST_CASE_FIXTURE(BuiltinsFixture, "simple_unannotated_mutual_recursion")
{ {
// CLI-117118 - TypeInferFunctions.simple_unannotated_mutual_recursion relies on unstable assertions to pass. // CLI-117118 - TypeInferFunctions.simple_unannotated_mutual_recursion relies on unstable assertions to pass.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
function even(n) function even(n)
@ -2505,7 +2505,7 @@ function odd(n)
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(5, result); LUAU_REQUIRE_ERROR_COUNT(5, result);
// CLI-117117 Constraint solving is incomplete inTypeInferFunctions.simple_unannotated_mutual_recursion // CLI-117117 Constraint solving is incomplete inTypeInferFunctions.simple_unannotated_mutual_recursion
@ -2565,7 +2565,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "tf_suggest_return_type") TEST_CASE_FIXTURE(BuiltinsFixture, "tf_suggest_return_type")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
function fib(n) function fib(n)
@ -2583,7 +2583,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "tf_suggest_arg_type") TEST_CASE_FIXTURE(BuiltinsFixture, "tf_suggest_arg_type")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
function fib(n, u) function fib(n, u)
@ -2602,7 +2602,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "tf_suggest_arg_type_2") TEST_CASE_FIXTURE(BuiltinsFixture, "tf_suggest_arg_type_2")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
// Make sure the error types are cloned to module interface // Make sure the error types are cloned to module interface
@ -2655,7 +2655,7 @@ TEST_CASE_FIXTURE(Fixture, "bidirectional_checking_of_callback_property")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
auto tm = get<TypeMismatch>(result.errors[0]); auto tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
@ -2727,7 +2727,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_infer_overloaded_functions")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("(t1) -> () where t1 = { read FindFirstChild: (t1, string) -> (...unknown) }" == toString(requireType("getR6Attachments"))); CHECK("(t1) -> () where t1 = { read FindFirstChild: (t1, string) -> (...unknown) }" == toString(requireType("getR6Attachments")));
else else
CHECK("<a...>(t1) -> () where t1 = {+ FindFirstChild: (t1, string) -> (a...) +}" == toString(requireType("getR6Attachments"))); CHECK("<a...>(t1) -> () where t1 = {+ FindFirstChild: (t1, string) -> (a...) +}" == toString(requireType("getR6Attachments")));
@ -2891,7 +2891,7 @@ TEST_CASE_FIXTURE(Fixture, "unifier_should_not_bind_free_types")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// The new solver should ideally be able to do better here, but this is no worse than the old solver. // The new solver should ideally be able to do better here, but this is no worse than the old solver.

View File

@ -10,7 +10,7 @@
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(LuauInstantiateInSubtyping); LUAU_FASTFLAG(LuauInstantiateInSubtyping);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
using namespace Luau; using namespace Luau;
@ -70,7 +70,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "unions_and_generics")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("number | {number}", toString(requireType("res"))); CHECK_EQ("number | {number}", toString(requireType("res")));
else // in the old solver, this just totally falls apart else // in the old solver, this just totally falls apart
CHECK_EQ("a", toString(requireType("res"))); CHECK_EQ("a", toString(requireType("res")));
@ -142,7 +142,7 @@ TEST_CASE_FIXTURE(Fixture, "properties_can_be_polytypes")
TEST_CASE_FIXTURE(Fixture, "properties_can_be_instantiated_polytypes") TEST_CASE_FIXTURE(Fixture, "properties_can_be_instantiated_polytypes")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t: { m: (number)->number } = { m = function(x:number) return x+1 end } local t: { m: (number)->number } = { m = function(x:number) return x+1 end }
@ -198,7 +198,7 @@ TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions")
TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions_unannotated") TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions_unannotated")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -220,7 +220,7 @@ TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions_unannotated")
TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions_errors") TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions_errors")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -260,7 +260,7 @@ TEST_CASE_FIXTURE(Fixture, "check_mutual_generic_functions_errors")
TEST_CASE_FIXTURE(Fixture, "generic_functions_in_types_old_solver") TEST_CASE_FIXTURE(Fixture, "generic_functions_in_types_old_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type T = { id: <a>(a) -> a } type T = { id: <a>(a) -> a }
@ -273,7 +273,7 @@ TEST_CASE_FIXTURE(Fixture, "generic_functions_in_types_old_solver")
TEST_CASE_FIXTURE(Fixture, "generic_functions_in_types_new_solver") TEST_CASE_FIXTURE(Fixture, "generic_functions_in_types_new_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type T = { read id: <a>(a) -> a } type T = { read id: <a>(a) -> a }
@ -286,7 +286,7 @@ TEST_CASE_FIXTURE(Fixture, "generic_functions_in_types_new_solver")
TEST_CASE_FIXTURE(Fixture, "generic_factories") TEST_CASE_FIXTURE(Fixture, "generic_factories")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type T<a> = { id: (a) -> a } type T<a> = { id: (a) -> a }
@ -309,7 +309,7 @@ TEST_CASE_FIXTURE(Fixture, "generic_factories")
TEST_CASE_FIXTURE(Fixture, "factories_of_generics") TEST_CASE_FIXTURE(Fixture, "factories_of_generics")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type T = { id: <a>(a) -> a } type T = { id: <a>(a) -> a }
@ -466,7 +466,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_leak_generic_types")
local b: boolean = f(true) local b: boolean = f(true)
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -489,7 +489,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_leak_inferred_generic_types")
local y: number = id(37) local y: number = id(37)
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -648,7 +648,7 @@ TEST_CASE_FIXTURE(Fixture, "generic_type_pack_parentheses")
// This should really error, but the error from the old solver is wrong. // This should really error, but the error from the old solver is wrong.
// `a...` is a generic type pack, and we don't know that it will be non-empty, thus this code may not work. // `a...` is a generic type pack, and we don't know that it will be non-empty, thus this code may not work.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -669,7 +669,7 @@ TEST_CASE_FIXTURE(Fixture, "better_mismatch_error_messages")
SwappedGenericTypeParameter* fErr; SwappedGenericTypeParameter* fErr;
SwappedGenericTypeParameter* gErr; SwappedGenericTypeParameter* gErr;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(3, result); LUAU_REQUIRE_ERROR_COUNT(3, result);
// The first error here is an unknown symbol that is redundant with the `fErr`. // The first error here is an unknown symbol that is redundant with the `fErr`.
@ -774,7 +774,7 @@ return exports
TEST_CASE_FIXTURE(Fixture, "instantiated_function_argument_names_old_solver") TEST_CASE_FIXTURE(Fixture, "instantiated_function_argument_names_old_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f<T, U...>(a: T, ...: U...) end local function f<T, U...>(a: T, ...: U...) end
@ -793,7 +793,7 @@ TEST_CASE_FIXTURE(Fixture, "instantiated_function_argument_names_old_solver")
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_generic_types") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_generic_types")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type C = () -> () type C = () -> ()
@ -810,7 +810,7 @@ local d: D = c
TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_generic_pack") TEST_CASE_FIXTURE(Fixture, "error_detailed_function_mismatch_generic_pack")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type C = () -> () type C = () -> ()
@ -866,7 +866,7 @@ y.a.c = y
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK( CHECK(
toString(result.errors.at(0)) == toString(result.errors.at(0)) ==
R"(Type '{ a: { c: nil, d: number }, b: number }' could not be converted into 'T<number>'; type { a: { c: nil, d: number }, b: number }[read "a"][read "c"] (nil) is not exactly T<number>[read "a"][read "c"][0] (T<number>))" R"(Type '{ a: { c: nil, d: number }, b: number }' could not be converted into 'T<number>'; type { a: { c: nil, d: number }, b: number }[read "a"][read "c"] (nil) is not exactly T<number>[read "a"][read "c"][0] (T<number>))"
@ -886,7 +886,7 @@ Type 'number' could not be converted into 'string' in an invariant context)";
TEST_CASE_FIXTURE(Fixture, "generic_type_pack_unification1") TEST_CASE_FIXTURE(Fixture, "generic_type_pack_unification1")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -906,7 +906,7 @@ local TheDispatcher: Dispatcher = {
TEST_CASE_FIXTURE(Fixture, "generic_type_pack_unification2") TEST_CASE_FIXTURE(Fixture, "generic_type_pack_unification2")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -926,7 +926,7 @@ local TheDispatcher: Dispatcher = {
TEST_CASE_FIXTURE(Fixture, "generic_type_pack_unification3") TEST_CASE_FIXTURE(Fixture, "generic_type_pack_unification3")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -946,7 +946,7 @@ local TheDispatcher: Dispatcher = {
TEST_CASE_FIXTURE(Fixture, "generic_argument_count_too_few") TEST_CASE_FIXTURE(Fixture, "generic_argument_count_too_few")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function test(a: number) function test(a: number)
@ -965,7 +965,7 @@ wrapper(test)
TEST_CASE_FIXTURE(Fixture, "generic_argument_count_too_many") TEST_CASE_FIXTURE(Fixture, "generic_argument_count_too_many")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function test2(a: number, b: string) function test2(a: number, b: string)
@ -1163,7 +1163,7 @@ local a: Self<Table>
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireType("a")), "Table<Table>"); CHECK_EQ(toString(requireType("a")), "Table<Table>");
else else
CHECK_EQ(toString(requireType("a")), "Table"); CHECK_EQ(toString(requireType("a")), "Table");
@ -1182,7 +1182,7 @@ TEST_CASE_FIXTURE(Fixture, "no_stack_overflow_from_quantifying")
std::optional<TypeId> t0 = lookupType("t0"); std::optional<TypeId> t0 = lookupType("t0");
REQUIRE(t0); REQUIRE(t0);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("any", toString(*t0)); CHECK_EQ("any", toString(*t0));
else else
CHECK_EQ("*error-type*", toString(*t0)); CHECK_EQ("*error-type*", toString(*t0));
@ -1202,7 +1202,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "infer_generic_function_function_argument")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
local function sum<a>(x: a, y: a, f: (a, a) -> add<a>) local function sum<a>(x: a, y: a, f: (a, a) -> add<a>)
@ -1259,7 +1259,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "infer_generic_function_function_argument_3")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
REQUIRE_EQ("{ c: number, s: number } | { c: number, s: number }", toString(requireType("r"))); REQUIRE_EQ("{ c: number, s: number } | { c: number, s: number }", toString(requireType("r")));
else else
REQUIRE_EQ("{ c: number, s: number }", toString(requireType("r"))); REQUIRE_EQ("{ c: number, s: number }", toString(requireType("r")));
@ -1301,7 +1301,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "do_not_infer_generic_functions")
CheckResult result; CheckResult result;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
result = check(R"( result = check(R"(
local function sum<a>(x: a, y: a, f: (a, a) -> a) return f(x, y) end local function sum<a>(x: a, y: a, f: (a, a) -> a) return f(x, y) end
@ -1421,7 +1421,7 @@ TEST_CASE_FIXTURE(Fixture, "apply_type_function_nested_generics3")
TEST_CASE_FIXTURE(Fixture, "quantify_functions_even_if_they_have_an_explicit_generic") TEST_CASE_FIXTURE(Fixture, "quantify_functions_even_if_they_have_an_explicit_generic")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo<X>(f, x: X) function foo<X>(f, x: X)
@ -1434,7 +1434,7 @@ TEST_CASE_FIXTURE(Fixture, "quantify_functions_even_if_they_have_an_explicit_gen
TEST_CASE_FIXTURE(Fixture, "do_not_always_instantiate_generic_intersection_types") TEST_CASE_FIXTURE(Fixture, "do_not_always_instantiate_generic_intersection_types")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -1470,7 +1470,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "higher_rank_polymorphism_should_not_accept_instantiated_arguments") TEST_CASE_FIXTURE(BuiltinsFixture, "higher_rank_polymorphism_should_not_accept_instantiated_arguments")
{ {
ScopedFastFlag sffs[] = { ScopedFastFlag sffs[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
{FFlag::LuauInstantiateInSubtyping, true}, {FFlag::LuauInstantiateInSubtyping, true},
}; };
@ -1537,9 +1537,9 @@ TEST_CASE_FIXTURE(Fixture, "missing_generic_type_parameter")
TEST_CASE_FIXTURE(BuiltinsFixture, "generic_type_functions_work_in_subtyping") TEST_CASE_FIXTURE(BuiltinsFixture, "generic_type_functions_work_in_subtyping")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(

View File

@ -9,7 +9,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
TEST_SUITE_BEGIN("IntersectionTypes"); TEST_SUITE_BEGIN("IntersectionTypes");
@ -172,7 +172,7 @@ TEST_CASE_FIXTURE(Fixture, "index_on_an_intersection_type_with_property_guarante
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("(A & B) -> { y: number }" == toString(requireType("f"))); CHECK("(A & B) -> { y: number }" == toString(requireType("f")));
else else
CHECK("(A & B) -> {| y: number |} & {| y: number |}" == toString(requireType("f"))); CHECK("(A & B) -> {| y: number |} & {| y: number |}" == toString(requireType("f")));
@ -191,7 +191,7 @@ TEST_CASE_FIXTURE(Fixture, "index_on_an_intersection_type_works_at_arbitrary_dep
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(A & B) -> string", toString(requireType("f"))); CHECK_EQ("(A & B) -> string", toString(requireType("f")));
else else
CHECK_EQ("(A & B) -> string & string", toString(requireType("f"))); CHECK_EQ("(A & B) -> string & string", toString(requireType("f")));
@ -210,7 +210,7 @@ TEST_CASE_FIXTURE(Fixture, "index_on_an_intersection_type_with_mixed_types")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(A & B) -> never", toString(requireType("f"))); CHECK_EQ("(A & B) -> never", toString(requireType("f")));
else else
CHECK_EQ("(A & B) -> number & string", toString(requireType("f"))); CHECK_EQ("(A & B) -> number & string", toString(requireType("f")));
@ -333,7 +333,7 @@ TEST_CASE_FIXTURE(Fixture, "table_intersection_write_sealed")
TEST_CASE_FIXTURE(Fixture, "table_intersection_write_sealed_indirect") TEST_CASE_FIXTURE(Fixture, "table_intersection_write_sealed_indirect")
{ {
ScopedFastFlag dcr{ ScopedFastFlag dcr{
FFlag::DebugLuauDeferredConstraintResolution, false FFlag::LuauSolverV2, false
}; // CLI-116476 Subtyping between type alias and an equivalent but not named type isn't working. }; // CLI-116476 Subtyping between type alias and an equivalent but not named type isn't working.
CheckResult result = check(R"( CheckResult result = check(R"(
type X = { x: (number) -> number } type X = { x: (number) -> number }
@ -348,7 +348,7 @@ TEST_CASE_FIXTURE(Fixture, "table_intersection_write_sealed_indirect")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ(toString(result.errors[0]), "Cannot add property 'z' to table 'X & Y'"); CHECK_EQ(toString(result.errors[0]), "Cannot add property 'z' to table 'X & Y'");
@ -372,7 +372,7 @@ caused by:
TEST_CASE_FIXTURE(Fixture, "table_write_sealed_indirect") TEST_CASE_FIXTURE(Fixture, "table_write_sealed_indirect")
{ {
ScopedFastFlag dcr{FFlag::DebugLuauDeferredConstraintResolution, false}; // CLI- ScopedFastFlag dcr{FFlag::LuauSolverV2, false}; // CLI-
// After normalization, previous 'table_intersection_write_sealed_indirect' is identical to this one // After normalization, previous 'table_intersection_write_sealed_indirect' is identical to this one
CheckResult result = check(R"( CheckResult result = check(R"(
type XY = { x: (number) -> number, y: (string) -> string } type XY = { x: (number) -> number, y: (string) -> string }
@ -430,7 +430,7 @@ Type 'number' could not be converted into 'X')";
R"(Type 'number' could not be converted into 'X & Y & Z'; type number (number) is not a subtype of X & Y & Z[0] (X) R"(Type 'number' could not be converted into 'X & Y & Z'; type number (number) is not a subtype of X & Y & Z[0] (X)
type number (number) is not a subtype of X & Y & Z[1] (Y) type number (number) is not a subtype of X & Y & Z[1] (Y)
type number (number) is not a subtype of X & Y & Z[2] (Z))"; type number (number) is not a subtype of X & Y & Z[2] (Z))";
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(dcrExprected, toString(result.errors[0])); CHECK_EQ(dcrExprected, toString(result.errors[0]));
else else
CHECK_EQ(expected, toString(result.errors[0])); CHECK_EQ(expected, toString(result.errors[0]));
@ -450,7 +450,7 @@ end
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
R"(Type pack 'X & Y & Z' could not be converted into 'number'; type X & Y & Z[0][0] (X) is not a subtype of number[0] (number) R"(Type pack 'X & Y & Z' could not be converted into 'number'; type X & Y & Z[0][0] (X) is not a subtype of number[0] (number)
@ -503,7 +503,7 @@ TEST_CASE_FIXTURE(Fixture, "intersect_bool_and_false")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
R"(Type 'boolean & false' could not be converted into 'true'; type boolean & false[0] (boolean) is not a subtype of true (true) R"(Type 'boolean & false' could not be converted into 'true'; type boolean & false[0] (boolean) is not a subtype of true (true)
@ -528,7 +528,7 @@ TEST_CASE_FIXTURE(Fixture, "intersect_false_and_bool_and_false")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
// TODO: odd stringification of `false & (boolean & false)`.) // TODO: odd stringification of `false & (boolean & false)`.)
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ( CHECK_EQ(
R"(Type 'boolean & false & false' could not be converted into 'true'; type boolean & false & false[0] (false) is not a subtype of true (true) R"(Type 'boolean & false & false' could not be converted into 'true'; type boolean & false & false[0] (false) is not a subtype of true (true)
type boolean & false & false[1] (boolean) is not a subtype of true (true) type boolean & false & false[1] (boolean) is not a subtype of true (true)
@ -550,7 +550,7 @@ TEST_CASE_FIXTURE(Fixture, "intersect_saturate_overloaded_functions")
local z : (number) -> number = x -- Not OK local z : (number) -> number = x -- Not OK
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
const std::string expected1 = R"(Type const std::string expected1 = R"(Type
@ -582,7 +582,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "union_saturate_overloaded_functions") TEST_CASE_FIXTURE(Fixture, "union_saturate_overloaded_functions")
{ {
ScopedFastFlag dcr{ ScopedFastFlag dcr{
FFlag::DebugLuauDeferredConstraintResolution, false FFlag::LuauSolverV2, false
}; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions }; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x: ((number) -> number) & ((string) -> string)) function f(x: ((number) -> number) & ((string) -> string))
@ -610,7 +610,7 @@ TEST_CASE_FIXTURE(Fixture, "intersection_of_tables")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
const std::string expected = const std::string expected =
(FFlag::DebugLuauDeferredConstraintResolution) (FFlag::LuauSolverV2)
? R"(Type '{ p: number?, q: number?, r: number? } & { p: number?, q: string? }' could not be converted into '{ p: nil }'; type { p: number?, q: number?, r: number? } & { p: number?, q: string? }[0][read "p"][0] (number) is not exactly { p: nil }[read "p"] (nil) ? R"(Type '{ p: number?, q: number?, r: number? } & { p: number?, q: string? }' could not be converted into '{ p: nil }'; type { p: number?, q: number?, r: number? } & { p: number?, q: string? }[0][read "p"][0] (number) is not exactly { p: nil }[read "p"] (nil)
type { p: number?, q: number?, r: number? } & { p: number?, q: string? }[1][read "p"][0] (number) is not exactly { p: nil }[read "p"] (nil))" type { p: number?, q: number?, r: number? } & { p: number?, q: string? }[1][read "p"][0] (number) is not exactly { p: nil }[read "p"] (nil))"
: :
@ -630,7 +630,7 @@ TEST_CASE_FIXTURE(Fixture, "intersection_of_tables_with_top_properties")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK_EQ( CHECK_EQ(
@ -678,7 +678,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_functions_returning_intersections")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ( CHECK_EQ(
@ -726,7 +726,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_functions_mentioning_generic")
end end
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(0, result); LUAU_REQUIRE_ERROR_COUNT(0, result);
} }
@ -753,7 +753,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_functions_mentioning_generics")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -778,7 +778,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_functions_mentioning_generic_packs")
end end
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ( CHECK_EQ(
@ -812,7 +812,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_unknown_result") TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_unknown_result")
{ {
ScopedFastFlag dcr{ ScopedFastFlag dcr{
FFlag::DebugLuauDeferredConstraintResolution, false FFlag::LuauSolverV2, false
}; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions }; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions
CheckResult result = check(R"( CheckResult result = check(R"(
function f<a...,b...>() function f<a...,b...>()
@ -834,7 +834,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_unknown_arguments") TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_unknown_arguments")
{ {
ScopedFastFlag dcr{ ScopedFastFlag dcr{
FFlag::DebugLuauDeferredConstraintResolution, false FFlag::LuauSolverV2, false
}; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions }; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions
CheckResult result = check(R"( CheckResult result = check(R"(
function f<a...,b...>() function f<a...,b...>()
@ -864,7 +864,7 @@ TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_never_result")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ( CHECK_EQ(
@ -907,7 +907,7 @@ TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_never_arguments")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
const std::string expected1 = R"(Type const std::string expected1 = R"(Type
@ -940,7 +940,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_overlapping_results_and_variadics") TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_overlapping_results_and_variadics")
{ {
ScopedFastFlag dcr{ ScopedFastFlag dcr{
FFlag::DebugLuauDeferredConstraintResolution, false FFlag::LuauSolverV2, false
}; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions }; // CLI-116474 Semantic subtyping of assignments needs to decide how to interpret intersections of functions
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x : ((string?) -> (string | number)) & ((number?) -> ...number)) function f(x : ((string?) -> (string | number)) & ((number?) -> ...number))
@ -968,7 +968,7 @@ TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_weird_typepacks_1")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -993,7 +993,7 @@ TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_weird_typepacks_2")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -1018,7 +1018,7 @@ TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_weird_typepacks_3")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -1045,7 +1045,7 @@ TEST_CASE_FIXTURE(Fixture, "overloadeded_functions_with_weird_typepacks_4")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
R"(Type R"(Type
@ -1071,10 +1071,10 @@ could not be converted into
TEST_CASE_FIXTURE(BuiltinsFixture, "intersect_metatables") TEST_CASE_FIXTURE(BuiltinsFixture, "intersect_metatables")
{ {
// CLI-117121 - Intersection of types are not compatible with the equivalent alias // CLI-117121 - Intersection of types are not compatible with the equivalent alias
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
function f(a: string?, b: string?) function f(a: string?, b: string?)
@ -1164,7 +1164,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "intersect_metatables_with_properties")
TEST_CASE_FIXTURE(BuiltinsFixture, "intersect_metatable_with_table") TEST_CASE_FIXTURE(BuiltinsFixture, "intersect_metatable_with_table")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
local x = setmetatable({ a = 5 }, { p = 5 }) local x = setmetatable({ a = 5 }, { p = 5 })
@ -1230,7 +1230,7 @@ TEST_CASE_FIXTURE(Fixture, "CLI-44817")
TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_intersection_types") TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_intersection_types")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1247,7 +1247,7 @@ TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_intersection_types")
TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_intersection_types_2") TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_intersection_types_2")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1293,7 +1293,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_property_table_intersection_2")
TEST_CASE_FIXTURE(Fixture, "cli_80596_simplify_degenerate_intersections") TEST_CASE_FIXTURE(Fixture, "cli_80596_simplify_degenerate_intersections")
{ {
ScopedFastFlag dcr{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag dcr{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = { type A = {
@ -1316,7 +1316,7 @@ TEST_CASE_FIXTURE(Fixture, "cli_80596_simplify_degenerate_intersections")
TEST_CASE_FIXTURE(Fixture, "cli_80596_simplify_more_realistic_intersections") TEST_CASE_FIXTURE(Fixture, "cli_80596_simplify_more_realistic_intersections")
{ {
ScopedFastFlag dcr{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag dcr{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = { type A = {

View File

@ -14,7 +14,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauOkWithIteratingOverTableProperties) LUAU_FASTFLAG(LuauOkWithIteratingOverTableProperties)
LUAU_DYNAMIC_FASTFLAG(LuauImproveNonFunctionCallError) LUAU_DYNAMIC_FASTFLAG(LuauImproveNonFunctionCallError)
@ -32,7 +32,7 @@ TEST_CASE_FIXTURE(Fixture, "for_loop")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// Luau cannot see that the loop must always run at least once, so we // Luau cannot see that the loop must always run at least once, so we
// think that q could be nil. // think that q could be nil.
@ -45,10 +45,10 @@ TEST_CASE_FIXTURE(Fixture, "for_loop")
TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_no_table_passed") TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_no_table_passed")
{ {
// This test may block CI if forced to run outside of DCR. // This test may block CI if forced to run outside of DCR.
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type Iterable = typeof(setmetatable( type Iterable = typeof(setmetatable(
@ -72,7 +72,7 @@ for a, b in t do end
TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_regression_issue_69967") TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_regression_issue_69967")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -93,7 +93,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_regression_issue_69967")
TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_regression_issue_69967_alt") TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_regression_issue_69967_alt")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -114,7 +114,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "iteration_regression_issue_69967_alt")
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// It's possible for the loop body to execute 0 times. // It's possible for the loop body to execute 0 times.
CHECK("number?" == toString(requireType("x"))); CHECK("number?" == toString(requireType("x")));
@ -140,7 +140,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("number?" == toString(requireType("n"))); CHECK("number?" == toString(requireType("n")));
CHECK("string?" == toString(requireType("s"))); CHECK("string?" == toString(requireType("s")));
@ -155,7 +155,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop")
TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_with_next") TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_with_next")
{ {
// CLI-116494 The generics K and V are leaking out of the next() function somehow. // CLI-116494 The generics K and V are leaking out of the next() function somehow.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local n local n
@ -222,7 +222,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_with_just_one_iterator_is_ok")
TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_with_zero_iterators_dcr") TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_with_zero_iterators_dcr")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function no_iter() end function no_iter() end
@ -267,7 +267,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_on_error")
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
TypeId p = requireType("p"); TypeId p = requireType("p");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("*error-type*?", toString(p)); CHECK_EQ("*error-type*?", toString(p));
else else
CHECK_EQ("*error-type*", toString(p)); CHECK_EQ("*error-type*", toString(p));
@ -276,7 +276,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_on_error")
TEST_CASE_FIXTURE(Fixture, "for_in_loop_on_non_function") TEST_CASE_FIXTURE(Fixture, "for_in_loop_on_non_function")
{ {
// We report a spuriouus duplicate error here. // We report a spuriouus duplicate error here.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local bad_iter = 5 local bad_iter = 5
@ -293,7 +293,7 @@ TEST_CASE_FIXTURE(Fixture, "for_in_loop_on_non_function")
TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_error_on_factory_not_returning_the_right_amount_of_values") TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_error_on_factory_not_returning_the_right_amount_of_values")
{ {
// Spurious duplicate errors // Spurious duplicate errors
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function hasDivisors(value: number, table) local function hasDivisors(value: number, table)
@ -345,7 +345,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_error_on_factory_not_returning_t
TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_error_on_iterator_requiring_args_but_none_given") TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_error_on_iterator_requiring_args_but_none_given")
{ {
// CLI-116496 // CLI-116496
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function prime_iter(state, index) function prime_iter(state, index)
@ -419,7 +419,7 @@ TEST_CASE_FIXTURE(Fixture, "while_loop")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("number?" == toString(requireType("i"))); CHECK("number?" == toString(requireType("i")));
else else
CHECK_EQ(*builtinTypes->numberType, *requireType("i")); CHECK_EQ(*builtinTypes->numberType, *requireType("i"));
@ -436,7 +436,7 @@ TEST_CASE_FIXTURE(Fixture, "repeat_loop")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("string?" == toString(requireType("i"))); CHECK("string?" == toString(requireType("i")));
else else
CHECK_EQ(*builtinTypes->stringType, *requireType("i")); CHECK_EQ(*builtinTypes->stringType, *requireType("i"));
@ -478,7 +478,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "varlist_declared_by_for_in_loop_should_be_fr
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
auto err = get<TypeMismatch>(result.errors[0]); auto err = get<TypeMismatch>(result.errors[0]);
@ -535,7 +535,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "properly_infer_iteratee_is_a_free_table")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// In the new solver, we infer iter: unknown and so we warn on use of its properties. // In the new solver, we infer iter: unknown and so we warn on use of its properties.
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -585,7 +585,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "ipairs_produces_integral_indices")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("number?" == toString(requireType("key"))); CHECK("number?" == toString(requireType("key")));
else else
REQUIRE_EQ("number", toString(requireType("key"))); REQUIRE_EQ("number", toString(requireType("key")));
@ -696,7 +696,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "unreachable_code_after_infinite_loop")
TEST_CASE_FIXTURE(BuiltinsFixture, "loop_typecheck_crash_on_empty_optional") TEST_CASE_FIXTURE(BuiltinsFixture, "loop_typecheck_crash_on_empty_optional")
{ {
// CLI-116498 Sometimes you can iterate over tables with no indexers. // CLI-116498 Sometimes you can iterate over tables with no indexers.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
ScopedFastFlag sff{FFlag::LuauOkWithIteratingOverTableProperties, true}; ScopedFastFlag sff{FFlag::LuauOkWithIteratingOverTableProperties, true};
@ -753,7 +753,7 @@ TEST_CASE_FIXTURE(Fixture, "loop_iter_basic")
// The old solver just infers the wrong type here. // The old solver just infers the wrong type here.
// The right type for `key` is `number?` // The right type for `key` is `number?`
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
TypeId keyTy = requireType("key"); TypeId keyTy = requireType("key");
CHECK("number?" == toString(keyTy)); CHECK("number?" == toString(keyTy));
@ -765,7 +765,7 @@ TEST_CASE_FIXTURE(Fixture, "loop_iter_basic")
TEST_CASE_FIXTURE(Fixture, "loop_iter_trailing_nil") TEST_CASE_FIXTURE(Fixture, "loop_iter_trailing_nil")
{ {
// CLI-116498 Sometimes you can iterate over tables with no indexers. // CLI-116498 Sometimes you can iterate over tables with no indexers.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t: {string} = {} local t: {string} = {}
@ -783,7 +783,7 @@ TEST_CASE_FIXTURE(Fixture, "loop_iter_no_indexer_strict")
{ {
// CLI-116498 Sometimes you can iterate over tables with no indexers. // CLI-116498 Sometimes you can iterate over tables with no indexers.
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
{FFlag::LuauOkWithIteratingOverTableProperties, true} {FFlag::LuauOkWithIteratingOverTableProperties, true}
}; };
@ -810,7 +810,7 @@ TEST_CASE_FIXTURE(Fixture, "loop_iter_no_indexer_nonstrict")
TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_nil") TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_nil")
{ {
// CLI-116499 Free types persisting until typechecking time. // CLI-116499 Free types persisting until typechecking time.
if (1 || !FFlag::DebugLuauDeferredConstraintResolution) if (1 || !FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -826,7 +826,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_nil")
TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_not_enough_returns") TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_not_enough_returns")
{ {
// CLI-116500 // CLI-116500
if (1 || !FFlag::DebugLuauDeferredConstraintResolution) if (1 || !FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -848,7 +848,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_not_enough_returns")
TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_ok") TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_ok")
{ {
// CLI-116500 // CLI-116500
if (1 || !FFlag::DebugLuauDeferredConstraintResolution) if (1 || !FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -865,7 +865,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_ok")
TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_ok_with_inference") TEST_CASE_FIXTURE(BuiltinsFixture, "loop_iter_metamethod_ok_with_inference")
{ {
// CLI-116500 // CLI-116500
if (1 || !FFlag::DebugLuauDeferredConstraintResolution) if (1 || !FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -916,7 +916,7 @@ TEST_CASE_FIXTURE(Fixture, "for_loop_lower_bound_is_string_3")
TEST_CASE_FIXTURE(BuiltinsFixture, "cli_68448_iterators_need_not_accept_nil") TEST_CASE_FIXTURE(BuiltinsFixture, "cli_68448_iterators_need_not_accept_nil")
{ {
// CLI-116500 // CLI-116500
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1051,7 +1051,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_iteration_fragmented_keys")
TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_xpath_candidates") TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_xpath_candidates")
{ {
// CLI-116500 // CLI-116500
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1071,7 +1071,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_xpath_candidates")
TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_iteration_on_never_gives_never") TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_iteration_on_never_gives_never")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1084,7 +1084,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_iteration_on_never_gives_never")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("never?" == toString(requireType("ans"))); // CLI-114134 egraph simplification. Should just be nil. CHECK("never?" == toString(requireType("ans"))); // CLI-114134 egraph simplification. Should just be nil.
else else
CHECK(toString(requireType("ans")) == "never"); CHECK(toString(requireType("ans")) == "never");
@ -1093,7 +1093,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dcr_iteration_on_never_gives_never")
TEST_CASE_FIXTURE(BuiltinsFixture, "iterate_over_properties") TEST_CASE_FIXTURE(BuiltinsFixture, "iterate_over_properties")
{ {
// CLI-116498 - Sometimes you can iterate over tables with no indexer. // CLI-116498 - Sometimes you can iterate over tables with no indexer.
ScopedFastFlag sff0{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff0{FFlag::LuauSolverV2, false};
ScopedFastFlag sff{FFlag::LuauOkWithIteratingOverTableProperties, true}; ScopedFastFlag sff{FFlag::LuauOkWithIteratingOverTableProperties, true};
@ -1151,7 +1151,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "pairs_should_not_retroactively_add_an_indexe
print(prices.wwwww) print(prices.wwwww)
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// We regress a little here: The old solver would typecheck the first // We regress a little here: The old solver would typecheck the first
// access to prices.wwwww on a table that had no indexer, and the second // access to prices.wwwww on a table that had no indexer, and the second
@ -1186,7 +1186,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "iterate_array_of_singletons")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
@ -1210,7 +1210,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "iter_mm_results_are_lvalue")
TEST_CASE_FIXTURE(BuiltinsFixture, "forin_metatable_no_iter_mm") TEST_CASE_FIXTURE(BuiltinsFixture, "forin_metatable_no_iter_mm")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local t = setmetatable({1, 2, 3}, {}) local t = setmetatable({1, 2, 3}, {})
@ -1228,7 +1228,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "forin_metatable_no_iter_mm")
TEST_CASE_FIXTURE(BuiltinsFixture, "forin_metatable_iter_mm") TEST_CASE_FIXTURE(BuiltinsFixture, "forin_metatable_iter_mm")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type Iterable<T...> = typeof(setmetatable({}, {} :: { type Iterable<T...> = typeof(setmetatable({}, {} :: {

View File

@ -11,7 +11,7 @@
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(LuauInstantiateInSubtyping) LUAU_FASTFLAG(LuauInstantiateInSubtyping)
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
using namespace Luau; using namespace Luau;
@ -56,7 +56,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "require")
return {hooty=hooty} return {hooty=hooty}
)"; )";
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
fileResolver.source["game/B"] = R"( fileResolver.source["game/B"] = R"(
local Hooty = require(game.A) local Hooty = require(game.A)
@ -237,7 +237,7 @@ local tbl: string = require(game.A)
CheckResult result = frontend.check("game/B"); CheckResult result = frontend.check("game/B");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("Type '{ def: number }' could not be converted into 'string'", toString(result.errors[0])); CHECK_EQ("Type '{ def: number }' could not be converted into 'string'", toString(result.errors[0]));
else else
CHECK_EQ("Type '{| def: number |}' could not be converted into 'string'", toString(result.errors[0])); CHECK_EQ("Type '{| def: number |}' could not be converted into 'string'", toString(result.errors[0]));
@ -424,7 +424,7 @@ local b: B.T = a
CheckResult result = frontend.check("game/C"); CheckResult result = frontend.check("game/C");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == "Type 'T' could not be converted into 'T'; at [read \"x\"], number is not exactly string"); CHECK(toString(result.errors.at(0)) == "Type 'T' could not be converted into 'T'; at [read \"x\"], number is not exactly string");
else else
{ {
@ -465,7 +465,7 @@ local b: B.T = a
CheckResult result = frontend.check("game/D"); CheckResult result = frontend.check("game/D");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == "Type 'T' could not be converted into 'T'; at [read \"x\"], number is not exactly string"); CHECK(toString(result.errors.at(0)) == "Type 'T' could not be converted into 'T'; at [read \"x\"], number is not exactly string");
else else
{ {

View File

@ -51,7 +51,7 @@ TEST_CASE_FIXTURE(NegationFixture, "string_is_not_a_subtype_of_negated_string")
TEST_CASE_FIXTURE(Fixture, "cofinite_strings_can_be_compared_for_equality") TEST_CASE_FIXTURE(Fixture, "cofinite_strings_can_be_compared_for_equality")
{ {
// CLI-117082 Cofinite strings cannot be compared for equality because normalization produces a large type with cycles // CLI-117082 Cofinite strings cannot be compared for equality because normalization produces a large type with cycles
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
function f(e) function f(e)

View File

@ -12,14 +12,14 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
TEST_SUITE_BEGIN("TypeInferOOP"); TEST_SUITE_BEGIN("TypeInferOOP");
TEST_CASE_FIXTURE(Fixture, "dont_suggest_using_colon_rather_than_dot_if_not_defined_with_colon") TEST_CASE_FIXTURE(Fixture, "dont_suggest_using_colon_rather_than_dot_if_not_defined_with_colon")
{ {
// CLI-116571 method calls are missing arity checking? // CLI-116571 method calls are missing arity checking?
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local someTable = {} local someTable = {}
@ -37,7 +37,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_suggest_using_colon_rather_than_dot_if_not_defi
TEST_CASE_FIXTURE(Fixture, "dont_suggest_using_colon_rather_than_dot_if_it_wont_help_2") TEST_CASE_FIXTURE(Fixture, "dont_suggest_using_colon_rather_than_dot_if_it_wont_help_2")
{ {
// CLI-116571 method calls are missing arity checking? // CLI-116571 method calls are missing arity checking?
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local someTable = {} local someTable = {}
@ -144,7 +144,7 @@ TEST_CASE_FIXTURE(Fixture, "inferring_hundreds_of_self_calls_should_not_suffocat
)"); )");
ModulePtr module = getMainModule(); ModulePtr module = getMainModule();
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_GE(80, module->internalTypes.types.size()); CHECK_GE(80, module->internalTypes.types.size());
else else
CHECK_GE(50, module->internalTypes.types.size()); CHECK_GE(50, module->internalTypes.types.size());
@ -346,7 +346,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "augmenting_an_unsealed_table_with_a_metatabl
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("{ @metatable { number: number }, { method: (unknown) -> string } }" == toString(requireType("B"), {true})); CHECK("{ @metatable { number: number }, { method: (unknown) -> string } }" == toString(requireType("B"), {true}));
else else
CHECK("{ @metatable { number: number }, { method: <a>(a) -> string } }" == toString(requireType("B"), {true})); CHECK("{ @metatable { number: number }, { method: <a>(a) -> string } }" == toString(requireType("B"), {true}));
@ -505,7 +505,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "promise_type_error_too_complex" * doctest::t
TEST_CASE_FIXTURE(Fixture, "method_should_not_create_cyclic_type") TEST_CASE_FIXTURE(Fixture, "method_should_not_create_cyclic_type")
{ {
ScopedFastFlag sff(FFlag::DebugLuauDeferredConstraintResolution, true); ScopedFastFlag sff(FFlag::LuauSolverV2, true);
CheckResult result = check(R"( CheckResult result = check(R"(
local Component = {} local Component = {}

View File

@ -16,7 +16,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauRemoveBadRelationalOperatorWarning) LUAU_FASTFLAG(LuauRemoveBadRelationalOperatorWarning)
TEST_SUITE_BEGIN("TypeInferOperators"); TEST_SUITE_BEGIN("TypeInferOperators");
@ -194,7 +194,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_overloaded_multiply_that_is_an_int
CHECK("Vec3" == toString(requireType("c"))); CHECK("Vec3" == toString(requireType("c")));
CHECK("Vec3" == toString(requireType("d"))); CHECK("Vec3" == toString(requireType("d")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("mul<Vec3, string>" == toString(requireType("e"))); CHECK("mul<Vec3, string>" == toString(requireType("e")));
else else
CHECK_EQ("Vec3", toString(requireType("e"))); CHECK_EQ("Vec3", toString(requireType("e")));
@ -232,7 +232,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_overloaded_multiply_that_is_an_int
CHECK("Vec3" == toString(requireType("c"))); CHECK("Vec3" == toString(requireType("c")));
CHECK("Vec3" == toString(requireType("d"))); CHECK("Vec3" == toString(requireType("d")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("mul<string, Vec3>" == toString(requireType("e"))); CHECK("mul<string, Vec3>" == toString(requireType("e")));
else else
CHECK_EQ("Vec3", toString(requireType("e"))); CHECK_EQ("Vec3", toString(requireType("e")));
@ -270,7 +270,7 @@ TEST_CASE_FIXTURE(Fixture, "cannot_indirectly_compare_types_that_do_not_have_a_m
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]); UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]);
REQUIRE(utf); REQUIRE(utf);
@ -300,7 +300,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "cannot_indirectly_compare_types_that_do_not_
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]); UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]);
REQUIRE(utf); REQUIRE(utf);
@ -404,7 +404,7 @@ TEST_CASE_FIXTURE(Fixture, "compound_assign_mismatch_result")
s += 10 s += 10
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK_EQ(result.errors[0], (TypeError{Location{{2, 8}, {2, 9}}, TypeMismatch{builtinTypes->numberType, builtinTypes->stringType}})); CHECK_EQ(result.errors[0], (TypeError{Location{{2, 8}, {2, 9}}, TypeMismatch{builtinTypes->numberType, builtinTypes->stringType}}));
@ -441,7 +441,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "compound_assign_metatable")
TEST_CASE_FIXTURE(BuiltinsFixture, "compound_assign_metatable_with_changing_return_type") TEST_CASE_FIXTURE(BuiltinsFixture, "compound_assign_metatable_with_changing_return_type")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -567,7 +567,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_unary_minus")
CHECK_EQ("string", toString(requireType("a"))); CHECK_EQ("string", toString(requireType("a")));
CHECK_EQ("number", toString(requireType("b"))); CHECK_EQ("number", toString(requireType("b")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
@ -607,7 +607,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_unary_minus_error")
local a = -foo local a = -foo
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
@ -631,7 +631,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_unary_minus_error")
TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_unary_len_error") TEST_CASE_FIXTURE(BuiltinsFixture, "typecheck_unary_len_error")
{ {
// CLI-116463 // CLI-116463
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -702,7 +702,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "disallow_string_and_types_without_metatables
LUAU_REQUIRE_ERROR_COUNT(3, result); LUAU_REQUIRE_ERROR_COUNT(3, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK(get<UninhabitedTypeFunction>(result.errors[0])); CHECK(get<UninhabitedTypeFunction>(result.errors[0]));
CHECK(Location{{2, 18}, {2, 30}} == result.errors[0].location); CHECK(Location{{2, 18}, {2, 30}} == result.errors[0].location);
@ -720,7 +720,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "disallow_string_and_types_without_metatables
GenericError* gen1 = get<GenericError>(result.errors[1]); GenericError* gen1 = get<GenericError>(result.errors[1]);
REQUIRE(gen1); REQUIRE(gen1);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(gen1->message, "Operator + is not applicable for '{ value: number }' and 'number' because neither type has a metatable"); CHECK_EQ(gen1->message, "Operator + is not applicable for '{ value: number }' and 'number' because neither type has a metatable");
else else
CHECK_EQ(gen1->message, "Binary operator '+' not supported by types 'foo' and 'number'"); CHECK_EQ(gen1->message, "Binary operator '+' not supported by types 'foo' and 'number'");
@ -753,7 +753,7 @@ TEST_CASE_FIXTURE(Fixture, "concat_op_on_free_lhs_and_string_rhs")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK("<a>(a) -> concat<a, string>" == toString(requireType("f"))); CHECK("<a>(a) -> concat<a, string>" == toString(requireType("f")));
@ -775,7 +775,7 @@ TEST_CASE_FIXTURE(Fixture, "concat_op_on_string_lhs_and_free_rhs")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("<a>(a) -> concat<string, a>" == toString(requireType("f"))); CHECK("<a>(a) -> concat<string, a>" == toString(requireType("f")));
else else
CHECK_EQ("(string) -> string", toString(requireType("f"))); CHECK_EQ("(string) -> string", toString(requireType("f")));
@ -794,7 +794,7 @@ TEST_CASE_FIXTURE(Fixture, "strict_binary_op_where_lhs_unknown")
CheckResult result = check(src); CheckResult result = check(src);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(ops.size(), result); LUAU_REQUIRE_ERROR_COUNT(ops.size(), result);
CHECK_EQ( CHECK_EQ(
@ -821,7 +821,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "and_binexps_dont_unify")
)"); )");
// This infers a type for `t` of `{unknown}`, and so it makes sense that `t[1].test` would error. // This infers a type for `t` of `{unknown}`, and so it makes sense that `t[1].test` would error.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
else else
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -837,7 +837,7 @@ TEST_CASE_FIXTURE(Fixture, "error_on_invalid_operand_types_to_relational_operato
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]); UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]);
REQUIRE(utf); REQUIRE(utf);
@ -860,7 +860,7 @@ TEST_CASE_FIXTURE(Fixture, "error_on_invalid_operand_types_to_relational_operato
)"); )");
// If DCR is off and the flag to remove this check in the old solver is on, the expected behavior is no errors. // If DCR is off and the flag to remove this check in the old solver is on, the expected behavior is no errors.
if (!FFlag::DebugLuauDeferredConstraintResolution && FFlag::LuauRemoveBadRelationalOperatorWarning) if (!FFlag::LuauSolverV2 && FFlag::LuauRemoveBadRelationalOperatorWarning)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
return; return;
@ -868,7 +868,7 @@ TEST_CASE_FIXTURE(Fixture, "error_on_invalid_operand_types_to_relational_operato
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]); UninhabitedTypeFunction* utf = get<UninhabitedTypeFunction>(result.errors[0]);
REQUIRE(utf); REQUIRE(utf);
@ -885,7 +885,7 @@ TEST_CASE_FIXTURE(Fixture, "error_on_invalid_operand_types_to_relational_operato
TEST_CASE_FIXTURE(Fixture, "cli_38355_recursive_union") TEST_CASE_FIXTURE(Fixture, "cli_38355_recursive_union")
{ {
// There's an extra spurious warning here when the new solver is enabled. // There's an extra spurious warning here when the new solver is enabled.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -901,7 +901,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "UnknownGlobalCompoundAssign")
{ {
// In non-strict mode, global definition is still allowed // In non-strict mode, global definition is still allowed
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -928,7 +928,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "UnknownGlobalCompoundAssign")
// In non-strict mode, compound assignment is not a definition, it's a modification // In non-strict mode, compound assignment is not a definition, it's a modification
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -1047,7 +1047,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_any_in_all_modes_when_lhs_is_unknown")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> add<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> add<a, b>");
@ -1079,7 +1079,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_subtraction")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> sub<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> sub<a, b>");
@ -1099,7 +1099,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_multiplication")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> mul<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> mul<a, b>");
@ -1119,7 +1119,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_division")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> div<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> div<a, b>");
@ -1139,7 +1139,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_floor_division")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> idiv<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> idiv<a, b>");
@ -1159,7 +1159,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_exponentiation")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> pow<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> pow<a, b>");
@ -1179,7 +1179,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_modulo")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> mod<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> mod<a, b>");
@ -1199,7 +1199,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_type_for_generic_concat")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK(toString(requireType("f")) == "<a, b>(a, b) -> concat<a, b>"); CHECK(toString(requireType("f")) == "<a, b>(a, b) -> concat<a, b>");
@ -1294,7 +1294,7 @@ TEST_CASE_FIXTURE(Fixture, "unrelated_primitives_cannot_be_compared")
TEST_CASE_FIXTURE(BuiltinsFixture, "mm_comparisons_must_return_a_boolean") TEST_CASE_FIXTURE(BuiltinsFixture, "mm_comparisons_must_return_a_boolean")
{ {
// CLI-115687 // CLI-115687
if (1 || !FFlag::DebugLuauDeferredConstraintResolution) if (1 || !FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1341,12 +1341,12 @@ local w = c and 1
CHECK("number?" == toString(requireType("x"))); CHECK("number?" == toString(requireType("x")));
CHECK("number" == toString(requireType("y"))); CHECK("number" == toString(requireType("y")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("false | number" == toString(requireType("z"))); CHECK("false | number" == toString(requireType("z")));
else else
CHECK("boolean | number" == toString(requireType("z"))); // 'false' widened to boolean CHECK("boolean | number" == toString(requireType("z"))); // 'false' widened to boolean
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("number?" == toString(requireType("w"))); CHECK("number?" == toString(requireType("w")));
else else
CHECK("(boolean | number)?" == toString(requireType("w"))); CHECK("(boolean | number)?" == toString(requireType("w")));
@ -1372,7 +1372,7 @@ local f1 = f or 'f'
CHECK("number | string" == toString(requireType("a1"))); CHECK("number | string" == toString(requireType("a1")));
CHECK("number" == toString(requireType("b1"))); CHECK("number" == toString(requireType("b1")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("string | true" == toString(requireType("c1"))); CHECK("string | true" == toString(requireType("c1")));
CHECK("string | true" == toString(requireType("d1"))); CHECK("string | true" == toString(requireType("d1")));
@ -1426,7 +1426,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "luau_polyfill_is_array_simplified")
TEST_CASE_FIXTURE(BuiltinsFixture, "luau_polyfill_is_array") TEST_CASE_FIXTURE(BuiltinsFixture, "luau_polyfill_is_array")
{ {
// CLI-116480 Subtyping bug: table should probably be a subtype of {[unknown]: unknown} // CLI-116480 Subtyping bug: table should probably be a subtype of {[unknown]: unknown}
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -1524,7 +1524,7 @@ return startsWith
TEST_CASE_FIXTURE(Fixture, "add_type_function_works") TEST_CASE_FIXTURE(Fixture, "add_type_function_works")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1584,7 +1584,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "compare_singleton_string_to_string")
TEST_CASE_FIXTURE(BuiltinsFixture, "no_infinite_expansion_of_free_type" * doctest::timeout(1.0)) TEST_CASE_FIXTURE(BuiltinsFixture, "no_infinite_expansion_of_free_type" * doctest::timeout(1.0))
{ {
ScopedFastFlag sff(FFlag::DebugLuauDeferredConstraintResolution, true); ScopedFastFlag sff(FFlag::LuauSolverV2, true);
check(R"( check(R"(
local tooltip = {} local tooltip = {}

View File

@ -84,7 +84,7 @@ TEST_CASE_FIXTURE(Fixture, "check_methods_of_number")
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("Expected type table, got 'number' instead" == toString(result.errors[0])); CHECK("Expected type table, got 'number' instead" == toString(result.errors[0]));
CHECK("Type 'number' could not be converted into 'string'" == toString(result.errors[1])); CHECK("Type 'number' could not be converted into 'string'" == toString(result.errors[1]));

View File

@ -10,7 +10,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTINT(LuauNormalizeCacheLimit); LUAU_FASTINT(LuauNormalizeCacheLimit);
LUAU_FASTINT(LuauTarjanChildLimit); LUAU_FASTINT(LuauTarjanChildLimit);
LUAU_FASTINT(LuauTypeInferIterationLimit); LUAU_FASTINT(LuauTypeInferIterationLimit);
@ -65,7 +65,7 @@ TEST_CASE_FIXTURE(Fixture, "typeguard_inference_incomplete")
end end
)"; )";
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(expectedWithNewSolver, decorateWithTypes(code)); CHECK_EQ(expectedWithNewSolver, decorateWithTypes(code));
else else
CHECK_EQ(expected, decorateWithTypes(code)); CHECK_EQ(expected, decorateWithTypes(code));
@ -73,7 +73,7 @@ TEST_CASE_FIXTURE(Fixture, "typeguard_inference_incomplete")
TEST_CASE_FIXTURE(BuiltinsFixture, "luau-polyfill.Array.filter") TEST_CASE_FIXTURE(BuiltinsFixture, "luau-polyfill.Array.filter")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
// This test exercises the fact that we should reduce sealed/unsealed/free tables // This test exercises the fact that we should reduce sealed/unsealed/free tables
// res is a unsealed table with type {((T & ~nil)?) & any} // res is a unsealed table with type {((T & ~nil)?) & any}
@ -172,7 +172,7 @@ TEST_CASE_FIXTURE(Fixture, "it_should_be_agnostic_of_actual_size")
// For now, infer it as just a free table. // For now, infer it as just a free table.
TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_constrains_free_type_into_free_table") TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_constrains_free_type_into_free_table")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local a = {} local a = {}
@ -192,7 +192,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_constrains_free_type_into_free_
// Luau currently doesn't yet know how to allow assignments when the binding was refined. // Luau currently doesn't yet know how to allow assignments when the binding was refined.
TEST_CASE_FIXTURE(Fixture, "while_body_are_also_refined") TEST_CASE_FIXTURE(Fixture, "while_body_are_also_refined")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Node<T> = { value: T, child: Node<T>? } type Node<T> = { value: T, child: Node<T>? }
@ -217,7 +217,7 @@ TEST_CASE_FIXTURE(Fixture, "while_body_are_also_refined")
// We should be type checking the metamethod at the call site of setmetatable. // We should be type checking the metamethod at the call site of setmetatable.
TEST_CASE_FIXTURE(BuiltinsFixture, "error_on_eq_metamethod_returning_a_type_other_than_boolean") TEST_CASE_FIXTURE(BuiltinsFixture, "error_on_eq_metamethod_returning_a_type_other_than_boolean")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local tab = {a = 1} local tab = {a = 1}
@ -277,7 +277,7 @@ TEST_CASE_FIXTURE(Fixture, "discriminate_from_x_not_equal_to_nil")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("{ x: string, y: number }", toString(requireTypeAtPosition({5, 28}))); CHECK_EQ("{ x: string, y: number }", toString(requireTypeAtPosition({5, 28})));
CHECK_EQ("{ x: nil, y: nil }", toString(requireTypeAtPosition({7, 28}))); CHECK_EQ("{ x: nil, y: nil }", toString(requireTypeAtPosition({7, 28})));
@ -359,7 +359,7 @@ TEST_CASE_FIXTURE(Fixture, "do_not_ice_when_trying_to_pick_first_of_generic_type
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("() -> ()" == toString(requireType("f"))); CHECK("() -> ()" == toString(requireType("f")));
CHECK("() -> ()" == toString(requireType("g"))); CHECK("() -> ()" == toString(requireType("g")));
@ -382,7 +382,7 @@ TEST_CASE_FIXTURE(Fixture, "specialization_binds_with_prototypes_too_early")
local s2s: (string) -> string = id local s2s: (string) -> string = id
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
LUAU_REQUIRE_ERRORS(result); // Should not have any errors. LUAU_REQUIRE_ERRORS(result); // Should not have any errors.
@ -393,7 +393,7 @@ TEST_CASE_FIXTURE(Fixture, "weird_fail_to_unify_type_pack")
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
// I'm not sure why this is broken without DCR, but it seems to be fixed // I'm not sure why this is broken without DCR, but it seems to be fixed
// when DCR is enabled. // when DCR is enabled.
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -477,7 +477,7 @@ TEST_CASE_FIXTURE(Fixture, "free_is_not_bound_to_any")
TEST_CASE_FIXTURE(Fixture, "dcr_can_partially_dispatch_a_constraint") TEST_CASE_FIXTURE(Fixture, "dcr_can_partially_dispatch_a_constraint")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -509,7 +509,7 @@ TEST_CASE_FIXTURE(Fixture, "dcr_can_partially_dispatch_a_constraint")
// to be solved later. This should be faster and theoretically less prone // to be solved later. This should be faster and theoretically less prone
// to cyclic constraint dependencies. // to cyclic constraint dependencies.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("(unknown, number) -> ()" == toString(requireType("prime_iter"))); CHECK("(unknown, number) -> ()" == toString(requireType("prime_iter")));
else else
CHECK("<a>(a, number) -> ()" == toString(requireType("prime_iter"))); CHECK("<a>(a, number) -> ()" == toString(requireType("prime_iter")));
@ -517,7 +517,7 @@ TEST_CASE_FIXTURE(Fixture, "dcr_can_partially_dispatch_a_constraint")
TEST_CASE_FIXTURE(Fixture, "free_options_cannot_be_unified_together") TEST_CASE_FIXTURE(Fixture, "free_options_cannot_be_unified_together")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
TypeArena arena; TypeArena arena;
TypeId nilType = builtinTypes->nilType; TypeId nilType = builtinTypes->nilType;
@ -535,7 +535,7 @@ TEST_CASE_FIXTURE(Fixture, "free_options_cannot_be_unified_together")
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}}; Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
Unifier u{NotNull{&normalizer}, NotNull{scope.get()}, Location{}, Variance::Covariant}; Unifier u{NotNull{&normalizer}, NotNull{scope.get()}, Location{}, Variance::Covariant};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
u.enableNewSolver(); u.enableNewSolver();
u.tryUnify(option1, option2); u.tryUnify(option1, option2);
@ -553,7 +553,7 @@ TEST_CASE_FIXTURE(Fixture, "free_options_cannot_be_unified_together")
TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_with_zero_iterators") TEST_CASE_FIXTURE(BuiltinsFixture, "for_in_loop_with_zero_iterators")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function no_iter() end function no_iter() end
@ -600,7 +600,7 @@ return wrapStrictTable(Constants, "Constants")
std::optional<TypeId> result = first(m->returnType); std::optional<TypeId> result = first(m->returnType);
REQUIRE(result); REQUIRE(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("unknown", toString(*result)); CHECK_EQ("unknown", toString(*result));
else else
CHECK_MESSAGE(get<AnyType>(*result), *result); CHECK_MESSAGE(get<AnyType>(*result), *result);
@ -643,7 +643,7 @@ return wrapStrictTable(Constants, "Constants")
std::optional<TypeId> result = first(m->returnType); std::optional<TypeId> result = first(m->returnType);
REQUIRE(result); REQUIRE(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("unknown" == toString(*result)); CHECK("unknown" == toString(*result));
else else
CHECK("any" == toString(*result)); CHECK("any" == toString(*result));
@ -829,7 +829,7 @@ TEST_CASE_FIXTURE(Fixture, "assign_table_with_refined_property_with_a_similar_ty
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); // This is wrong. We should be rejecting this assignment. LUAU_REQUIRE_NO_ERRORS(result); // This is wrong. We should be rejecting this assignment.
else else
{ {
@ -847,7 +847,7 @@ Type 'number?' could not be converted into 'number' in an invariant context)";
TEST_CASE_FIXTURE(BuiltinsFixture, "table_insert_with_a_singleton_argument") TEST_CASE_FIXTURE(BuiltinsFixture, "table_insert_with_a_singleton_argument")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function foo(t, x) local function foo(t, x)
@ -864,7 +864,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_insert_with_a_singleton_argument")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{string}", toString(requireType("t"))); CHECK_EQ("{string}", toString(requireType("t")));
else else
{ {
@ -904,7 +904,7 @@ TEST_CASE_FIXTURE(Fixture, "expected_type_should_be_a_helpful_deduction_guide_fo
local x: Ref<number?> = useRef(nil) local x: Ref<number?> = useRef(nil)
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// This bug is fixed in the new solver. // This bug is fixed in the new solver.
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -921,7 +921,7 @@ TEST_CASE_FIXTURE(Fixture, "expected_type_should_be_a_helpful_deduction_guide_fo
TEST_CASE_FIXTURE(Fixture, "floating_generics_should_not_be_allowed") TEST_CASE_FIXTURE(Fixture, "floating_generics_should_not_be_allowed")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local assign : <T, U, V, W>(target: T, source0: U?, source1: V?, source2: W?, ...any) -> T & U & V & W = (nil :: any) local assign : <T, U, V, W>(target: T, source0: U?, source1: V?, source2: W?, ...any) -> T & U & V & W = (nil :: any)
@ -945,7 +945,7 @@ TEST_CASE_FIXTURE(Fixture, "floating_generics_should_not_be_allowed")
TEST_CASE_FIXTURE(Fixture, "free_options_can_be_unified_together") TEST_CASE_FIXTURE(Fixture, "free_options_can_be_unified_together")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
TypeArena arena; TypeArena arena;
TypeId nilType = builtinTypes->nilType; TypeId nilType = builtinTypes->nilType;
@ -963,7 +963,7 @@ TEST_CASE_FIXTURE(Fixture, "free_options_can_be_unified_together")
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}}; Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
Unifier u{NotNull{&normalizer}, NotNull{scope.get()}, Location{}, Variance::Covariant}; Unifier u{NotNull{&normalizer}, NotNull{scope.get()}, Location{}, Variance::Covariant};
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
u.enableNewSolver(); u.enableNewSolver();
u.tryUnify(option1, option2); u.tryUnify(option1, option2);
@ -992,7 +992,7 @@ TEST_CASE_FIXTURE(Fixture, "unify_more_complex_unions_that_include_nil")
TEST_CASE_FIXTURE(Fixture, "optional_class_instances_are_invariant_old_solver") TEST_CASE_FIXTURE(Fixture, "optional_class_instances_are_invariant_old_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
createSomeClasses(&frontend); createSomeClasses(&frontend);
@ -1010,7 +1010,7 @@ TEST_CASE_FIXTURE(Fixture, "optional_class_instances_are_invariant_old_solver")
TEST_CASE_FIXTURE(Fixture, "optional_class_instances_are_invariant_new_solver") TEST_CASE_FIXTURE(Fixture, "optional_class_instances_are_invariant_new_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
createSomeClasses(&frontend); createSomeClasses(&frontend);
@ -1076,7 +1076,7 @@ end
TEST_CASE_FIXTURE(BuiltinsFixture, "table_unification_infinite_recursion") TEST_CASE_FIXTURE(BuiltinsFixture, "table_unification_infinite_recursion")
{ {
// The new solver doesn't recurse as heavily in this situation. // The new solver doesn't recurse as heavily in this situation.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
#if defined(_NOOPT) || defined(_DEBUG) #if defined(_NOOPT) || defined(_DEBUG)
ScopedFastInt LuauTypeInferRecursionLimit{FInt::LuauTypeInferRecursionLimit, 100}; ScopedFastInt LuauTypeInferRecursionLimit{FInt::LuauTypeInferRecursionLimit, 100};
@ -1113,7 +1113,7 @@ tbl:f3()
TEST_CASE_FIXTURE(BuiltinsFixture, "normalization_limit_in_unify_with_any") TEST_CASE_FIXTURE(BuiltinsFixture, "normalization_limit_in_unify_with_any")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
// With default limit, this test will take 10 seconds in NoOpt // With default limit, this test will take 10 seconds in NoOpt
@ -1148,7 +1148,7 @@ foo(1 :: any)
TEST_CASE_FIXTURE(Fixture, "luau_roact_useState_nilable_state_1") TEST_CASE_FIXTURE(Fixture, "luau_roact_useState_nilable_state_1")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type Dispatch<A> = (A) -> () type Dispatch<A> = (A) -> ()
@ -1173,7 +1173,7 @@ TEST_CASE_FIXTURE(Fixture, "luau_roact_useState_nilable_state_1")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
{ {
@ -1189,7 +1189,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "luau_roact_useState_minimization")
{ {
// We don't expect this test to work on the old solver, but it also does not yet work on the new solver. // We don't expect this test to work on the old solver, but it also does not yet work on the new solver.
// So, we can't just put a scoped fast flag here, or it would block CI. // So, we can't just put a scoped fast flag here, or it would block CI.
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1307,7 +1307,7 @@ TEST_CASE_FIXTURE(Fixture, "we_cannot_infer_functions_that_return_inconsistently
#else #else
// This is what actually happens right now. // This is what actually happens right now.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_CHECK_ERROR_COUNT(2, result); LUAU_CHECK_ERROR_COUNT(2, result);

View File

@ -7,7 +7,7 @@
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
using namespace Luau; using namespace Luau;
@ -255,7 +255,7 @@ TEST_CASE_FIXTURE(Fixture, "a_and_b_or_a_and_c")
CHECK_EQ("string", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("string", toString(requireTypeAtPosition({3, 28})));
CHECK_EQ("number?", toString(requireTypeAtPosition({4, 28}))); CHECK_EQ("number?", toString(requireTypeAtPosition({4, 28})));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("boolean", toString(requireTypeAtPosition({5, 28}))); CHECK_EQ("boolean", toString(requireTypeAtPosition({5, 28})));
else else
CHECK_EQ("true", toString(requireTypeAtPosition({5, 28}))); // oh no! :( CHECK_EQ("true", toString(requireTypeAtPosition({5, 28}))); // oh no! :(
@ -278,7 +278,7 @@ TEST_CASE_FIXTURE(Fixture, "type_assertion_expr_carry_its_constraints")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("number?", toString(requireTypeAtPosition({3, 26}))); CHECK_EQ("number?", toString(requireTypeAtPosition({3, 26})));
CHECK_EQ("string?", toString(requireTypeAtPosition({4, 26}))); CHECK_EQ("string?", toString(requireTypeAtPosition({4, 26})));
@ -307,7 +307,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typeguard_in_if_condition_position")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
// DCR changes refinements to preserve error suppression. // DCR changes refinements to preserve error suppression.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("*error-type* | number", toString(requireTypeAtPosition({3, 26}))); CHECK_EQ("*error-type* | number", toString(requireTypeAtPosition({3, 26})));
else else
CHECK_EQ("number", toString(requireTypeAtPosition({3, 26}))); CHECK_EQ("number", toString(requireTypeAtPosition({3, 26})));
@ -326,7 +326,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typeguard_in_assert_position")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("<a>(a) -> a & number" == toString(requireType("f"))); CHECK("<a>(a) -> a & number" == toString(requireType("f")));
else else
CHECK("<a>(a) -> number" == toString(requireType("f"))); CHECK("<a>(a) -> number" == toString(requireType("f")));
@ -346,7 +346,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table_then_test_a_prop")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
{ {
@ -376,7 +376,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table_then_test_a_nested_p
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
const UnknownProperty* up = get<UnknownProperty>(result.errors[0]); const UnknownProperty* up = get<UnknownProperty>(result.errors[0]);
@ -410,7 +410,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table_then_test_a_tested_n
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
{ {
@ -486,7 +486,7 @@ TEST_CASE_FIXTURE(Fixture, "truthy_constraint_on_properties")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115281 - Types produced by refinements don't always get simplified // CLI-115281 - Types produced by refinements don't always get simplified
CHECK("{ x: number? } & { x: ~(false?) }" == toString(requireTypeAtPosition({4, 23}))); CHECK("{ x: number? } & { x: ~(false?) }" == toString(requireTypeAtPosition({4, 23})));
@ -573,7 +573,7 @@ TEST_CASE_FIXTURE(Fixture, "term_is_equal_to_an_lvalue")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ(toString(requireTypeAtPosition({3, 28})), R"("hello")"); // a == "hello" CHECK_EQ(toString(requireTypeAtPosition({3, 28})), R"("hello")"); // a == "hello"
CHECK_EQ(toString(requireTypeAtPosition({5, 28})), R"(((string & ~"hello") | number)?)"); // a ~= "hello" CHECK_EQ(toString(requireTypeAtPosition({5, 28})), R"(((string & ~"hello") | number)?)"); // a ~= "hello"
@ -600,7 +600,7 @@ TEST_CASE_FIXTURE(Fixture, "lvalue_is_not_nil")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ(toString(requireTypeAtPosition({3, 28})), "number | string"); // a ~= nil CHECK_EQ(toString(requireTypeAtPosition({3, 28})), "number | string"); // a ~= nil
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireTypeAtPosition({5, 28})), "nil"); // a == nil :) CHECK_EQ(toString(requireTypeAtPosition({5, 28})), "nil"); // a == nil :)
else else
CHECK_EQ(toString(requireTypeAtPosition({5, 28})), "(number | string)?"); // a == nil CHECK_EQ(toString(requireTypeAtPosition({5, 28})), "(number | string)?"); // a == nil
@ -618,7 +618,7 @@ TEST_CASE_FIXTURE(Fixture, "free_type_is_equal_to_an_lvalue")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireTypeAtPosition({3, 33})), "unknown"); // a == b CHECK_EQ(toString(requireTypeAtPosition({3, 33})), "unknown"); // a == b
else else
CHECK_EQ(toString(requireTypeAtPosition({3, 33})), "a"); // a == b CHECK_EQ(toString(requireTypeAtPosition({3, 33})), "a"); // a == b
@ -639,7 +639,7 @@ TEST_CASE_FIXTURE(Fixture, "unknown_lvalue_is_not_synonymous_with_other_on_not_e
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ(toString(requireTypeAtPosition({3, 33})), "any"); // a ~= b CHECK_EQ(toString(requireTypeAtPosition({3, 33})), "any"); // a ~= b
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireTypeAtPosition({3, 36})), "{ x: number }?"); // a ~= b CHECK_EQ(toString(requireTypeAtPosition({3, 36})), "{ x: number }?"); // a ~= b
else else
CHECK_EQ(toString(requireTypeAtPosition({3, 36})), "{| x: number |}?"); // a ~= b CHECK_EQ(toString(requireTypeAtPosition({3, 36})), "{| x: number |}?"); // a ~= b
@ -664,7 +664,7 @@ TEST_CASE_FIXTURE(Fixture, "string_not_equal_to_string_or_nil")
CHECK_EQ(toString(requireTypeAtPosition({6, 29})), "string"); // a ~= b CHECK_EQ(toString(requireTypeAtPosition({6, 29})), "string"); // a ~= b
CHECK_EQ(toString(requireTypeAtPosition({6, 32})), "string?"); // a ~= b CHECK_EQ(toString(requireTypeAtPosition({6, 32})), "string?"); // a ~= b
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ(toString(requireTypeAtPosition({8, 29})), "string?"); // a == b CHECK_EQ(toString(requireTypeAtPosition({8, 29})), "string?"); // a == b
CHECK_EQ(toString(requireTypeAtPosition({8, 32})), "string?"); // a == b CHECK_EQ(toString(requireTypeAtPosition({8, 32})), "string?"); // a == b
@ -703,7 +703,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_narrow_to_vector")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("never", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("never", toString(requireTypeAtPosition({3, 28})));
else else
CHECK_EQ("*error-type*", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("*error-type*", toString(requireTypeAtPosition({3, 28})));
@ -729,7 +729,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "nonoptional_type_can_narrow_to_nil_if_sense_
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115281 Types produced by refinements do not consistently get simplified // CLI-115281 Types produced by refinements do not consistently get simplified
CHECK_EQ("(nil & string)?", toString(requireTypeAtPosition({4, 24}))); // type(v) == "nil" CHECK_EQ("(nil & string)?", toString(requireTypeAtPosition({4, 24}))); // type(v) == "nil"
@ -780,7 +780,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typeguard_narrows_for_table")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ x: number } | { y: boolean }", toString(requireTypeAtPosition({3, 28}))); // type(x) == "table" CHECK_EQ("{ x: number } | { y: boolean }", toString(requireTypeAtPosition({3, 28}))); // type(x) == "table"
else else
CHECK_EQ("{| x: number |} | {| y: boolean |}", toString(requireTypeAtPosition({3, 28}))); // type(x) == "table" CHECK_EQ("{| x: number |} | {| y: boolean |}", toString(requireTypeAtPosition({3, 28}))); // type(x) == "table"
@ -822,7 +822,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_guard_can_filter_for_intersection_of_ta
ToStringOptions opts; ToStringOptions opts;
opts.exhaustive = true; opts.exhaustive = true;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ x: number } & { y: number }", toString(requireTypeAtPosition({4, 28}), opts)); CHECK_EQ("{ x: number } & { y: number }", toString(requireTypeAtPosition({4, 28}), opts));
else else
CHECK_EQ("{| x: number |} & {| y: number |}", toString(requireTypeAtPosition({4, 28}), opts)); CHECK_EQ("{| x: number |} & {| y: number |}", toString(requireTypeAtPosition({4, 28}), opts));
@ -863,7 +863,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_guard_narrowed_into_nothingness")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115281 Types produced by refinements do not consistently get simplified // CLI-115281 Types produced by refinements do not consistently get simplified
CHECK_EQ("{ x: number } & ~table", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("{ x: number } & ~table", toString(requireTypeAtPosition({3, 28})));
@ -955,7 +955,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "either_number_or_string")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("*error-type* | number | string", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("*error-type* | number | string", toString(requireTypeAtPosition({3, 28})));
else else
CHECK_EQ("number | string", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("number | string", toString(requireTypeAtPosition({3, 28})));
@ -974,7 +974,7 @@ TEST_CASE_FIXTURE(Fixture, "not_t_or_some_prop_of_t")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115281 Types produced by refinements do not consistently get simplified // CLI-115281 Types produced by refinements do not consistently get simplified
CHECK_EQ("({ x: boolean } & { x: ~(false?) })?", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("({ x: boolean } & { x: ~(false?) })?", toString(requireTypeAtPosition({3, 28})));
@ -1082,7 +1082,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_comparison_ifelse_expression")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("*error-type* | number", toString(requireTypeAtPosition({6, 49}))); CHECK_EQ("*error-type* | number", toString(requireTypeAtPosition({6, 49})));
CHECK_EQ("*error-type* | ~number", toString(requireTypeAtPosition({6, 66}))); CHECK_EQ("*error-type* | ~number", toString(requireTypeAtPosition({6, 66})));
@ -1094,7 +1094,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_comparison_ifelse_expression")
} }
CHECK_EQ("number", toString(requireTypeAtPosition({10, 49}))); CHECK_EQ("number", toString(requireTypeAtPosition({10, 49})));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("~number", toString(requireTypeAtPosition({10, 66}))); CHECK_EQ("~number", toString(requireTypeAtPosition({10, 66})));
else else
CHECK_EQ("unknown", toString(requireTypeAtPosition({10, 66}))); CHECK_EQ("unknown", toString(requireTypeAtPosition({10, 66})));
@ -1224,7 +1224,7 @@ TEST_CASE_FIXTURE(Fixture, "discriminate_from_truthiness_of_x")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115281 Types produced by refinements do not consistently get simplified // CLI-115281 Types produced by refinements do not consistently get simplified
CHECK("{ tag: \"exists\", x: string } & { x: ~(false?) }" == toString(requireTypeAtPosition({5, 28}))); CHECK("{ tag: \"exists\", x: string } & { x: ~(false?) }" == toString(requireTypeAtPosition({5, 28})));
@ -1360,7 +1360,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "discriminate_from_isa_of_x")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK(R"({ tag: "Part", x: Part })" == toString(requireTypeAtPosition({5, 28}))); CHECK(R"({ tag: "Part", x: Part })" == toString(requireTypeAtPosition({5, 28})));
CHECK(R"({ tag: "Folder", x: Folder })" == toString(requireTypeAtPosition({7, 28}))); CHECK(R"({ tag: "Folder", x: Folder })" == toString(requireTypeAtPosition({7, 28})));
@ -1375,7 +1375,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "discriminate_from_isa_of_x")
TEST_CASE_FIXTURE(RefinementClassFixture, "typeguard_cast_free_table_to_vector") TEST_CASE_FIXTURE(RefinementClassFixture, "typeguard_cast_free_table_to_vector")
{ {
// CLI-115286 - Refining via type(x) == 'vector' does not work in the new solver // CLI-115286 - Refining via type(x) == 'vector' does not work in the new solver
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(vec) local function f(vec)
@ -1450,7 +1450,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "type_narrow_but_the_discriminant_type
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("never", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("never", toString(requireTypeAtPosition({3, 28})));
CHECK_EQ("Instance | Vector3 | number | string", toString(requireTypeAtPosition({5, 28}))); CHECK_EQ("Instance | Vector3 | number | string", toString(requireTypeAtPosition({5, 28})));
@ -1501,7 +1501,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "narrow_from_subclasses_of_instance_or
TEST_CASE_FIXTURE(RefinementClassFixture, "x_as_any_if_x_is_instance_elseif_x_is_table") TEST_CASE_FIXTURE(RefinementClassFixture, "x_as_any_if_x_is_instance_elseif_x_is_table")
{ {
// CLI-117136 - this code doesn't finish constraint solving and has blocked types in the output // CLI-117136 - this code doesn't finish constraint solving and has blocked types in the output
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -1517,7 +1517,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "x_as_any_if_x_is_instance_elseif_x_is
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("Folder & Instance & {- -}", toString(requireTypeAtPosition({5, 28}))); CHECK_EQ("Folder & Instance & {- -}", toString(requireTypeAtPosition({5, 28})));
CHECK_EQ("(~Folder | ~Instance) & {- -} & never", toString(requireTypeAtPosition({7, 28}))); CHECK_EQ("(~Folder | ~Instance) & {- -} & never", toString(requireTypeAtPosition({7, 28})));
@ -1569,7 +1569,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "isa_type_refinement_must_be_known_ahe
{ {
// CLI-115087 - The new solver does not consistently combine tables with // CLI-115087 - The new solver does not consistently combine tables with
// class types when they appear in the upper bounds of a free type. // class types when they appear in the upper bounds of a free type.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(x): Instance local function f(x): Instance
@ -1592,7 +1592,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "isa_type_refinement_must_be_known_ahe
TEST_CASE_FIXTURE(RefinementClassFixture, "x_is_not_instance_or_else_not_part") TEST_CASE_FIXTURE(RefinementClassFixture, "x_is_not_instance_or_else_not_part")
{ {
// CLI-117135 - RefinementTests.x_is_not_instance_or_else_not_part not correctly applying refinements to a function parameter // CLI-117135 - RefinementTests.x_is_not_instance_or_else_not_part not correctly applying refinements to a function parameter
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(x: Part | Folder | string) local function f(x: Part | Folder | string)
@ -1641,7 +1641,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknowns")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("string", toString(requireTypeAtPosition({3, 28}))); CHECK_EQ("string", toString(requireTypeAtPosition({3, 28})));
CHECK_EQ("~string", toString(requireTypeAtPosition({5, 28}))); CHECK_EQ("~string", toString(requireTypeAtPosition({5, 28})));
@ -1779,7 +1779,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table_then_take_the_length
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ("table", toString(requireTypeAtPosition({3, 29}))); CHECK_EQ("table", toString(requireTypeAtPosition({3, 29})));
@ -1801,7 +1801,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table_then_clone_it")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
@ -1814,7 +1814,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table_then_clone_it")
TEST_CASE_FIXTURE(RefinementClassFixture, "refine_a_param_that_got_resolved_during_constraint_solving_stage") TEST_CASE_FIXTURE(RefinementClassFixture, "refine_a_param_that_got_resolved_during_constraint_solving_stage")
{ {
// CLI-117134 - Applying a refinement causes an optional value access error. // CLI-117134 - Applying a refinement causes an optional value access error.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
type Id<T> = T type Id<T> = T
@ -1849,7 +1849,7 @@ TEST_CASE_FIXTURE(RefinementClassFixture, "refine_a_param_that_got_resolved_duri
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ("Part", toString(requireTypeAtPosition({5, 28}))); CHECK_EQ("Part", toString(requireTypeAtPosition({5, 28})));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("Instance & ~Part", toString(requireTypeAtPosition({7, 28}))); CHECK_EQ("Instance & ~Part", toString(requireTypeAtPosition({7, 28})));
else else
CHECK_EQ("Instance", toString(requireTypeAtPosition({7, 28}))); CHECK_EQ("Instance", toString(requireTypeAtPosition({7, 28})));
@ -1865,7 +1865,7 @@ TEST_CASE_FIXTURE(Fixture, "refine_a_property_of_some_global")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(3, result); LUAU_REQUIRE_ERROR_COUNT(3, result);
@ -1908,7 +1908,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dataflow_analysis_can_tell_refinements_when_
CHECK_EQ("nil", toString(requireTypeAtPosition({12, 28}))); CHECK_EQ("nil", toString(requireTypeAtPosition({12, 28})));
CHECK_EQ("string", toString(requireTypeAtPosition({14, 28}))); CHECK_EQ("string", toString(requireTypeAtPosition({14, 28})));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115281 - Types produced by refinements don't always get simplified // CLI-115281 - Types produced by refinements don't always get simplified
CHECK_EQ("nil & string", toString(requireTypeAtPosition({18, 28}))); CHECK_EQ("nil & string", toString(requireTypeAtPosition({18, 28})));
@ -1998,7 +1998,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_annotations_arent_relevant_when_doing_d
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ("nil", toString(requireTypeAtPosition({8, 28}))); CHECK_EQ("nil", toString(requireTypeAtPosition({8, 28})));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115478 - This should be never // CLI-115478 - This should be never
CHECK_EQ("nil", toString(requireTypeAtPosition({9, 28}))); CHECK_EQ("nil", toString(requireTypeAtPosition({9, 28})));
@ -2009,7 +2009,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_annotations_arent_relevant_when_doing_d
TEST_CASE_FIXTURE(BuiltinsFixture, "function_call_with_colon_after_refining_not_to_be_nil") TEST_CASE_FIXTURE(BuiltinsFixture, "function_call_with_colon_after_refining_not_to_be_nil")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -2049,7 +2049,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refinements_should_preserve_error_suppressio
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -2075,7 +2075,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "many_refinements_on_val")
TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table") TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
// this test is DCR-only as an instance of DCR fixing a bug in the old solver // this test is DCR-only as an instance of DCR fixing a bug in the old solver
CheckResult result = check(R"( CheckResult result = check(R"(
@ -2097,7 +2097,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "refine_unknown_to_table")
TEST_CASE_FIXTURE(BuiltinsFixture, "conditional_refinement_should_stay_error_suppressing") TEST_CASE_FIXTURE(BuiltinsFixture, "conditional_refinement_should_stay_error_suppressing")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local function test(element: any?) local function test(element: any?)
@ -2118,7 +2118,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "globals_can_be_narrowed_too")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114134 // CLI-114134
CHECK("string & typeof(string)" == toString(requireTypeAtPosition(Position{2, 24}))); CHECK("string & typeof(string)" == toString(requireTypeAtPosition(Position{2, 24})));

View File

@ -6,7 +6,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
TEST_SUITE_BEGIN("TypeSingletons"); TEST_SUITE_BEGIN("TypeSingletons");
@ -46,7 +46,7 @@ TEST_CASE_FIXTURE(Fixture, "string_singletons")
TEST_CASE_FIXTURE(Fixture, "string_singleton_function_call") TEST_CASE_FIXTURE(Fixture, "string_singleton_function_call")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -153,7 +153,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_function_call_with_singletons")
TEST_CASE_FIXTURE(Fixture, "overloaded_function_call_with_singletons_mismatch") TEST_CASE_FIXTURE(Fixture, "overloaded_function_call_with_singletons_mismatch")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(g: ((true, string) -> ()) & ((false, number) -> ())) function f(g: ((true, string) -> ()) & ((false, number) -> ()))
@ -162,7 +162,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_function_call_with_singletons_mismatch")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("None of the overloads for function that accept 2 arguments are compatible.", toString(result.errors[0])); CHECK_EQ("None of the overloads for function that accept 2 arguments are compatible.", toString(result.errors[0]));
CHECK_EQ("Available overloads: (true, string) -> (); and (false, number) -> ()", toString(result.errors[1])); CHECK_EQ("Available overloads: (true, string) -> (); and (false, number) -> ()", toString(result.errors[1]));
@ -195,7 +195,7 @@ TEST_CASE_FIXTURE(Fixture, "enums_using_singletons_mismatch")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Type '\"bang\"' could not be converted into '\"bar\" | \"baz\" | \"foo\"'" == toString(result.errors[0])); CHECK("Type '\"bang\"' could not be converted into '\"bar\" | \"baz\" | \"foo\"'" == toString(result.errors[0]));
else else
CHECK_EQ( CHECK_EQ(
@ -256,7 +256,7 @@ TEST_CASE_FIXTURE(Fixture, "tagged_unions_immutable_tag")
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CannotAssignToNever* tm = get<CannotAssignToNever>(result.errors[0]); CannotAssignToNever* tm = get<CannotAssignToNever>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
@ -343,7 +343,7 @@ TEST_CASE_FIXTURE(Fixture, "table_properties_type_error_escapes")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK( CHECK(
"Type\n" "Type\n"
" '{ [\"\\n\"]: number }'\n" " '{ [\"\\n\"]: number }'\n"
@ -368,7 +368,7 @@ local a: Animal = { tag = 'cat', cafood = 'something' }
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Type '{ cafood: string, tag: \"cat\" }' could not be converted into 'Cat | Dog'" == toString(result.errors[0])); CHECK("Type '{ cafood: string, tag: \"cat\" }' could not be converted into 'Cat | Dog'" == toString(result.errors[0]));
else else
{ {
@ -391,7 +391,7 @@ local a: Result = { success = false, result = 'something' }
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Type '{ result: string, success: boolean }' could not be converted into 'Bad | Good'" == toString(result.errors[0])); CHECK("Type '{ result: string, success: boolean }' could not be converted into 'Bad | Good'" == toString(result.errors[0]));
else else
{ {
@ -406,7 +406,7 @@ Table type 'a' not compatible with type 'Bad' because the former is missing fiel
TEST_CASE_FIXTURE(Fixture, "parametric_tagged_union_alias") TEST_CASE_FIXTURE(Fixture, "parametric_tagged_union_alias")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
type Ok<T> = {success: true, result: T} type Ok<T> = {success: true, result: T}
@ -442,7 +442,7 @@ local a: Animal = if true then { tag = 'cat', catfood = 'something' } else { tag
TEST_CASE_FIXTURE(Fixture, "widen_the_supertype_if_it_is_free_and_subtype_has_singleton") TEST_CASE_FIXTURE(Fixture, "widen_the_supertype_if_it_is_free_and_subtype_has_singleton")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function foo(f, x) local function foo(f, x)
@ -462,7 +462,7 @@ TEST_CASE_FIXTURE(Fixture, "widen_the_supertype_if_it_is_free_and_subtype_has_si
TEST_CASE_FIXTURE(Fixture, "return_type_of_f_is_not_widened") TEST_CASE_FIXTURE(Fixture, "return_type_of_f_is_not_widened")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function foo(f, x): "hello"? -- anyone there? local function foo(f, x): "hello"? -- anyone there?
@ -488,7 +488,7 @@ TEST_CASE_FIXTURE(Fixture, "widening_happens_almost_everywhere")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(R"("foo")", toString(requireType("copy"))); CHECK_EQ(R"("foo")", toString(requireType("copy")));
else else
CHECK_EQ("string", toString(requireType("copy"))); CHECK_EQ("string", toString(requireType("copy")));
@ -613,7 +613,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "singletons_stick_around_under_assignment")
print(kind == "Bar") -- type of equality refines to `false` print(kind == "Bar") -- type of equality refines to `false`
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);

View File

@ -15,7 +15,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauInstantiateInSubtyping) LUAU_FASTFLAG(LuauInstantiateInSubtyping)
LUAU_FASTFLAG(LuauFixIndexerSubtypingOrdering) LUAU_FASTFLAG(LuauFixIndexerSubtypingOrdering)
LUAU_FASTFLAG(LuauAcceptIndexingTableUnionsIntersections) LUAU_FASTFLAG(LuauAcceptIndexingTableUnionsIntersections)
@ -26,7 +26,7 @@ TEST_SUITE_BEGIN("TableTests");
TEST_CASE_FIXTURE(BuiltinsFixture, "generalization_shouldnt_seal_table_in_len_function_fn") TEST_CASE_FIXTURE(BuiltinsFixture, "generalization_shouldnt_seal_table_in_len_function_fn")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
local t = {} local t = {}
@ -136,7 +136,7 @@ TEST_CASE_FIXTURE(Fixture, "index_expression_is_checked_against_the_indexer_type
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_MESSAGE(get<CannotExtendTable>(result.errors[0]), "Expected CannotExtendTable but got " << toString(result.errors[0])); CHECK_MESSAGE(get<CannotExtendTable>(result.errors[0]), "Expected CannotExtendTable but got " << toString(result.errors[0]));
else else
CHECK(get<TypeMismatch>(result.errors[0])); CHECK(get<TypeMismatch>(result.errors[0]));
@ -163,7 +163,7 @@ TEST_CASE_FIXTURE(Fixture, "cannot_augment_sealed_table")
// TODO: better, more robust comparison of type vars // TODO: better, more robust comparison of type vars
auto s = toString(error->tableType, ToStringOptions{/*exhaustive*/ true}); auto s = toString(error->tableType, ToStringOptions{/*exhaustive*/ true});
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(s, "{ prop: number }"); CHECK_EQ(s, "{ prop: number }");
else else
CHECK_EQ(s, "{| prop: number |}"); CHECK_EQ(s, "{| prop: number |}");
@ -318,7 +318,7 @@ TEST_CASE_FIXTURE(Fixture, "call_method_with_explicit_self_argument")
TEST_CASE_FIXTURE(Fixture, "used_dot_instead_of_colon") TEST_CASE_FIXTURE(Fixture, "used_dot_instead_of_colon")
{ {
// CLI-114792 Dot vs colon warnings aren't in the new solver yet. // CLI-114792 Dot vs colon warnings aren't in the new solver yet.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local T = {} local T = {}
@ -371,7 +371,7 @@ TEST_CASE_FIXTURE(Fixture, "used_dot_instead_of_colon_but_correctly")
TEST_CASE_FIXTURE(Fixture, "used_colon_instead_of_dot") TEST_CASE_FIXTURE(Fixture, "used_colon_instead_of_dot")
{ {
// CLI-114792 Dot vs colon warnings aren't in the new solver yet. // CLI-114792 Dot vs colon warnings aren't in the new solver yet.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local T = {} local T = {}
@ -396,7 +396,7 @@ TEST_CASE_FIXTURE(Fixture, "used_colon_instead_of_dot")
TEST_CASE_FIXTURE(Fixture, "open_table_unification_2") TEST_CASE_FIXTURE(Fixture, "open_table_unification_2")
{ {
// CLI-114792 We don't report MissingProperties in many places where the old solver does. // CLI-114792 We don't report MissingProperties in many places where the old solver does.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local a = {} local a = {}
@ -480,7 +480,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_param_width_subtyping_2")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
// CLI 114792 We don't report MissingProperties in many places where the old solver does // CLI 114792 We don't report MissingProperties in many places where the old solver does
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
TypeMismatch* error = get<TypeMismatch>(result.errors[0]); TypeMismatch* error = get<TypeMismatch>(result.errors[0]);
REQUIRE_MESSAGE(error != nullptr, "Expected TypeMismatch but got " << toString(result.errors[0])); REQUIRE_MESSAGE(error != nullptr, "Expected TypeMismatch but got " << toString(result.errors[0]));
@ -513,7 +513,7 @@ TEST_CASE_FIXTURE(Fixture, "table_param_width_subtyping_3")
CHECK(result.errors[0].location == Location{Position{6, 8}, Position{6, 9}}); CHECK(result.errors[0].location == Location{Position{6, 8}, Position{6, 9}});
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors[0]) == "Type 'T' could not be converted into '{ read baz: unknown }'"); CHECK(toString(result.errors[0]) == "Type 'T' could not be converted into '{ read baz: unknown }'");
else else
{ {
@ -536,7 +536,7 @@ TEST_CASE_FIXTURE(Fixture, "table_param_width_subtyping_3")
TEST_CASE_FIXTURE(Fixture, "table_unification_4") TEST_CASE_FIXTURE(Fixture, "table_unification_4")
{ {
// CLI-114134 - Use egraphs to simplify types better. // CLI-114134 - Use egraphs to simplify types better.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(o) function foo(o)
@ -567,7 +567,7 @@ TEST_CASE_FIXTURE(Fixture, "ok_to_add_property_to_free_table")
TEST_CASE_FIXTURE(Fixture, "okay_to_add_property_to_unsealed_tables_by_assignment") TEST_CASE_FIXTURE(Fixture, "okay_to_add_property_to_unsealed_tables_by_assignment")
{ {
// CLI-114872 // CLI-114872
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -586,7 +586,7 @@ TEST_CASE_FIXTURE(Fixture, "okay_to_add_property_to_unsealed_tables_by_assignmen
TEST_CASE_FIXTURE(Fixture, "okay_to_add_property_to_unsealed_tables_by_function_call") TEST_CASE_FIXTURE(Fixture, "okay_to_add_property_to_unsealed_tables_by_function_call")
{ {
// CLI-114873 // CLI-114873
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -691,7 +691,7 @@ TEST_CASE_FIXTURE(Fixture, "indexers_get_quantified_too")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("({unknown}) -> ()" == toString(requireType("swap"))); CHECK("({unknown}) -> ()" == toString(requireType("swap")));
else else
{ {
@ -763,7 +763,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_indexer_from_array_like_table")
CHECK_EQ(*builtinTypes->numberType, *indexer.indexType); CHECK_EQ(*builtinTypes->numberType, *indexer.indexType);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114134 - Use egraphs to simplify types // CLI-114134 - Use egraphs to simplify types
CHECK("string | string | string" == toString(indexer.indexResultType)); CHECK("string | string | string" == toString(indexer.indexResultType));
@ -802,7 +802,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_indexer_from_value_property_in_literal")
CHECK(bool(retType->indexer)); CHECK(bool(retType->indexer));
const TableIndexer& indexer = *retType->indexer; const TableIndexer& indexer = *retType->indexer;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ __name: string }", toString(indexer.indexType)); CHECK_EQ("{ __name: string }", toString(indexer.indexType));
else else
CHECK_EQ("{| __name: string |}", toString(indexer.indexType)); CHECK_EQ("{| __name: string |}", toString(indexer.indexType));
@ -811,7 +811,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_indexer_from_value_property_in_literal")
TEST_CASE_FIXTURE(Fixture, "infer_indexer_from_its_variable_type_and_unifiable") TEST_CASE_FIXTURE(Fixture, "infer_indexer_from_its_variable_type_and_unifiable")
{ {
// This code is totally different in the new solver. We instead create a new type state for t2. // This code is totally different in the new solver. We instead create a new type state for t2.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t1: { [string]: string } = {} local t1: { [string]: string } = {}
@ -851,7 +851,7 @@ TEST_CASE_FIXTURE(Fixture, "indexer_mismatch")
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm != nullptr); REQUIRE(tm != nullptr);
CHECK(toString(tm->wantedType) == "{number}"); CHECK(toString(tm->wantedType) == "{number}");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(tm->givenType) == "{ [string]: string }"); CHECK(toString(tm->givenType) == "{ [string]: string }");
else else
CHECK(toString(tm->givenType) == "{| [string]: string |}"); CHECK(toString(tm->givenType) == "{| [string]: string |}");
@ -893,7 +893,7 @@ TEST_CASE_FIXTURE(Fixture, "sealed_table_value_can_infer_an_indexer")
TEST_CASE_FIXTURE(Fixture, "array_factory_function") TEST_CASE_FIXTURE(Fixture, "array_factory_function")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function empty() return {} end function empty() return {} end
@ -913,7 +913,7 @@ TEST_CASE_FIXTURE(Fixture, "sealed_table_indexers_must_unify")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114879 - Error path reporting is not great // CLI-114879 - Error path reporting is not great
CHECK( CHECK(
@ -930,7 +930,7 @@ TEST_CASE_FIXTURE(Fixture, "indexer_on_sealed_table_must_unify_with_free_table")
// CLI-114134 What should be happening here is that the type of `t` should // CLI-114134 What should be happening here is that the type of `t` should
// be reduced from `{number} & {string}` to `never`, but that's not // be reduced from `{number} & {string}` to `never`, but that's not
// happening. // happening.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function F(t): {number} function F(t): {number}
@ -993,7 +993,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "indexing_from_a_table_should_prefer_properti
TEST_CASE_FIXTURE(Fixture, "any_when_indexing_into_an_unsealed_table_with_no_indexer_in_nonstrict_mode") TEST_CASE_FIXTURE(Fixture, "any_when_indexing_into_an_unsealed_table_with_no_indexer_in_nonstrict_mode")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -1030,7 +1030,7 @@ TEST_CASE_FIXTURE(Fixture, "disallow_indexing_into_an_unsealed_table_with_no_ind
local k1 = getConstant("key1") local k1 = getConstant("key1")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("unknown" == toString(requireType("k1"))); CHECK("unknown" == toString(requireType("k1")));
else else
CHECK("any" == toString(requireType("k1"))); CHECK("any" == toString(requireType("k1")));
@ -1145,7 +1145,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "meta_add_inferred")
TEST_CASE_FIXTURE(BuiltinsFixture, "meta_add_both_ways") TEST_CASE_FIXTURE(BuiltinsFixture, "meta_add_both_ways")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type VectorMt = { __add: (Vector, number) -> Vector } type VectorMt = { __add: (Vector, number) -> Vector }
@ -1165,7 +1165,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "meta_add_both_ways")
TEST_CASE_FIXTURE(BuiltinsFixture, "meta_add_both_ways_lti") TEST_CASE_FIXTURE(BuiltinsFixture, "meta_add_both_ways_lti")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local vectorMt = {} local vectorMt = {}
@ -1523,7 +1523,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "found_multiple_like_keys")
TEST_CASE_FIXTURE(BuiltinsFixture, "dont_suggest_exact_match_keys") TEST_CASE_FIXTURE(BuiltinsFixture, "dont_suggest_exact_match_keys")
{ {
// CLI-114977 Unsealed table writes don't account for order properly // CLI-114977 Unsealed table writes don't account for order properly
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t = {} local t = {}
@ -1566,7 +1566,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "getmetatable_returns_pointer_to_metatable")
TEST_CASE_FIXTURE(BuiltinsFixture, "metatable_mismatch_should_fail") TEST_CASE_FIXTURE(BuiltinsFixture, "metatable_mismatch_should_fail")
{ {
// This test is invalid because we now create a new type state for t1 at the assignment. // This test is invalid because we now create a new type state for t1 at the assignment.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t1 = {x = 1} local t1 = {x = 1}
@ -1610,7 +1610,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "property_lookup_through_tabletypevar_metatab
TEST_CASE_FIXTURE(BuiltinsFixture, "missing_metatable_for_sealed_tables_do_not_get_inferred") TEST_CASE_FIXTURE(BuiltinsFixture, "missing_metatable_for_sealed_tables_do_not_get_inferred")
{ {
// This test is invalid because we now create a new type state for t at the assignment. // This test is invalid because we now create a new type state for t at the assignment.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local t = {x = 1} local t = {x = 1}
@ -1665,7 +1665,7 @@ TEST_CASE_FIXTURE(Fixture, "right_table_missing_key")
TEST_CASE_FIXTURE(Fixture, "right_table_missing_key2") TEST_CASE_FIXTURE(Fixture, "right_table_missing_key2")
{ {
// CLI-114792 We don't report MissingProperties // CLI-114792 We don't report MissingProperties
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(t: {}): { [string]: string, a: string } function f(t: {}): { [string]: string, a: string }
@ -1698,7 +1698,7 @@ TEST_CASE_FIXTURE(Fixture, "casting_unsealed_tables_with_props_into_table_with_i
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("{ [string]: string }", toString(tm->wantedType, o)); CHECK_EQ("{ [string]: string }", toString(tm->wantedType, o));
CHECK_EQ("{ [string]: number }", toString(tm->givenType, o)); CHECK_EQ("{ [string]: number }", toString(tm->givenType, o));
@ -1726,7 +1726,7 @@ TEST_CASE_FIXTURE(Fixture, "casting_sealed_tables_with_props_into_table_with_ind
ToStringOptions o{/* exhaustive= */ true}; ToStringOptions o{/* exhaustive= */ true};
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("{ [string]: string }", toString(tm->wantedType, o)); CHECK_EQ("{ [string]: string }", toString(tm->wantedType, o));
CHECK_EQ("{ foo: number }", toString(tm->givenType, o)); CHECK_EQ("{ foo: number }", toString(tm->givenType, o));
@ -1761,7 +1761,7 @@ TEST_CASE_FIXTURE(Fixture, "casting_tables_with_props_into_table_with_indexer3")
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("string" == toString(tm->wantedType)); CHECK("string" == toString(tm->wantedType));
CHECK("number" == toString(tm->givenType)); CHECK("number" == toString(tm->givenType));
@ -1796,7 +1796,7 @@ TEST_CASE_FIXTURE(Fixture, "table_subtyping_with_missing_props_dont_report_multi
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
"Type pack '{ x: number }' could not be converted into '{ x: number, y: number, z: number }';" "Type pack '{ x: number }' could not be converted into '{ x: number, y: number, z: number }';"
@ -1825,7 +1825,7 @@ TEST_CASE_FIXTURE(Fixture, "table_subtyping_with_missing_props_dont_report_multi
local t: MixedTable = {"fail"} local t: MixedTable = {"fail"}
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -1864,7 +1864,7 @@ TEST_CASE_FIXTURE(Fixture, "table_subtyping_with_extra_props_dont_report_multipl
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("{{ x: number }}", toString(tm->wantedType)); CHECK_EQ("{{ x: number }}", toString(tm->wantedType));
CHECK_EQ("{{ x: number, y: number, z: number }}", toString(tm->givenType)); CHECK_EQ("{{ x: number, y: number, z: number }}", toString(tm->givenType));
@ -1902,7 +1902,7 @@ TEST_CASE_FIXTURE(Fixture, "type_mismatch_on_massive_table_is_cut_short")
TypeMismatch* tm = get<TypeMismatch>(result.errors[0]); TypeMismatch* tm = get<TypeMismatch>(result.errors[0]);
REQUIRE(tm); REQUIRE(tm);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("{ a: number, b: number, c: number, d: number, e: number, ... 1 more ... }" == toString(requireType("t"))); CHECK("{ a: number, b: number, c: number, d: number, e: number, ... 1 more ... }" == toString(requireType("t")));
CHECK_EQ("number", toString(tm->givenType)); CHECK_EQ("number", toString(tm->givenType));
@ -1927,7 +1927,7 @@ TEST_CASE_FIXTURE(Fixture, "type_mismatch_on_massive_table_is_cut_short")
TEST_CASE_FIXTURE(Fixture, "ok_to_set_nil_even_on_non_lvalue_base_expr") TEST_CASE_FIXTURE(Fixture, "ok_to_set_nil_even_on_non_lvalue_base_expr")
{ {
// CLI-100076 Assigning nil to an indexer should always succeed // CLI-100076 Assigning nil to an indexer should always succeed
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(): { [string]: number } local function f(): { [string]: number }
@ -1949,7 +1949,7 @@ TEST_CASE_FIXTURE(Fixture, "ok_to_provide_a_subtype_during_construction")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114134 Use egraphs to simplify types more consistently // CLI-114134 Use egraphs to simplify types more consistently
CHECK("{number | number | string}" == toString(requireType("t"), {/*exhaustive*/ true})); CHECK("{number | number | string}" == toString(requireType("t"), {/*exhaustive*/ true}));
@ -1969,7 +1969,7 @@ TEST_CASE_FIXTURE(Fixture, "reasonable_error_when_adding_a_nonexistent_property_
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CannotExtendTable* cet = get<CannotExtendTable>(result.errors[0]); CannotExtendTable* cet = get<CannotExtendTable>(result.errors[0]);
REQUIRE_MESSAGE(cet, "Expected CannotExtendTable but got " << result.errors[0]); REQUIRE_MESSAGE(cet, "Expected CannotExtendTable but got " << result.errors[0]);
@ -2013,7 +2013,7 @@ TEST_CASE_FIXTURE(Fixture, "only_ascribe_synthetic_names_at_module_scope")
CHECK_EQ("TopLevel", toString(requireType("TopLevel"))); CHECK_EQ("TopLevel", toString(requireType("TopLevel")));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{number}?", toString(requireType("foo"))); CHECK_EQ("{number}?", toString(requireType("foo")));
else else
CHECK_EQ("{number}", toString(requireType("foo"))); CHECK_EQ("{number}", toString(requireType("foo")));
@ -2037,7 +2037,7 @@ TEST_CASE_FIXTURE(Fixture, "hide_table_error_properties")
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("Cannot add property 'a' to table '{ x: number }'", toString(result.errors[0])); CHECK_EQ("Cannot add property 'a' to table '{ x: number }'", toString(result.errors[0]));
CHECK_EQ("Cannot add property 'b' to table '{ x: number }'", toString(result.errors[1])); CHECK_EQ("Cannot add property 'b' to table '{ x: number }'", toString(result.errors[1]));
@ -2096,7 +2096,7 @@ local Test: {Table} = {
TEST_CASE_FIXTURE(Fixture, "common_table_element_general") TEST_CASE_FIXTURE(Fixture, "common_table_element_general")
{ {
// CLI-115275 - Bidirectional inference does not always propagate indexer types into the expression // CLI-115275 - Bidirectional inference does not always propagate indexer types into the expression
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Table = { type Table = {
@ -2218,7 +2218,7 @@ foo({
TEST_CASE_FIXTURE(Fixture, "common_table_element_union_in_call_tail") TEST_CASE_FIXTURE(Fixture, "common_table_element_union_in_call_tail")
{ {
// CLI-115239 - Bidirectional checking does not work for __call metamethods // CLI-115239 - Bidirectional checking does not work for __call metamethods
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Foo = {x: number | string} type Foo = {x: number | string}
@ -2265,7 +2265,7 @@ TEST_CASE_FIXTURE(Fixture, "invariant_table_properties_means_instantiating_table
local c : string = t.m("hi") local c : string = t.m("hi")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
@ -2320,7 +2320,7 @@ local b: B = a
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == R"(Type 'A' could not be converted into 'B'; at [read "y"], number is not exactly string)"); CHECK(toString(result.errors.at(0)) == R"(Type 'A' could not be converted into 'B'; at [read "y"], number is not exactly string)");
else else
{ {
@ -2347,7 +2347,7 @@ local b: B = a
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors.at(0)) == R"(Type 'A' could not be converted into 'B'; at [read "b"][read "y"], number is not exactly string)"); CHECK(toString(result.errors.at(0)) == R"(Type 'A' could not be converted into 'B'; at [read "b"][read "y"], number is not exactly string)");
else else
{ {
@ -2396,7 +2396,7 @@ Type
could not be converted into could not be converted into
'<a>(a) -> ()'; different number of generic type parameters)"; '<a>(a) -> ()'; different number of generic type parameters)";
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// The assignment of c2 to b2 is, surprisingly, allowed under the new // The assignment of c2 to b2 is, surprisingly, allowed under the new
// solver for two reasons: // solver for two reasons:
@ -2461,7 +2461,7 @@ TEST_CASE_FIXTURE(Fixture, "error_detailed_indexer_key")
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("Type 'A' could not be converted into 'B'; at indexer(), number is not exactly string" == toString(result.errors[0])); CHECK("Type 'A' could not be converted into 'B'; at indexer(), number is not exactly string" == toString(result.errors[0]));
} }
@ -2487,7 +2487,7 @@ TEST_CASE_FIXTURE(Fixture, "error_detailed_indexer_value")
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("Type 'A' could not be converted into 'B'; at indexResult(), number is not exactly string" == toString(result.errors[0])); CHECK("Type 'A' could not be converted into 'B'; at indexResult(), number is not exactly string" == toString(result.errors[0]));
} }
@ -2504,7 +2504,7 @@ Type 'number' could not be converted into 'string' in an invariant context)";
TEST_CASE_FIXTURE(Fixture, "explicitly_typed_table") TEST_CASE_FIXTURE(Fixture, "explicitly_typed_table")
{ {
// Table properties like HasSuper.p must be invariant. The new solver rightly rejects this program. // Table properties like HasSuper.p must be invariant. The new solver rightly rejects this program.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -2536,7 +2536,7 @@ local y: number = tmp.p.y
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK( CHECK(
"Type 'tmp' could not be converted into 'HasSuper'; at [read \"p\"], { x: number, y: number } is not exactly Super" == "Type 'tmp' could not be converted into 'HasSuper'; at [read \"p\"], { x: number, y: number } is not exactly Super" ==
toString(result.errors[0]) toString(result.errors[0])
@ -2554,7 +2554,7 @@ Table type '{ x: number, y: number }' not compatible with type 'Super' because t
TEST_CASE_FIXTURE(Fixture, "explicitly_typed_table_with_indexer") TEST_CASE_FIXTURE(Fixture, "explicitly_typed_table_with_indexer")
{ {
// CLI-114791 Bidirectional inference should be able to cause the inference engine to forget that a table literal has some property // CLI-114791 Bidirectional inference should be able to cause the inference engine to forget that a table literal has some property
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -2572,7 +2572,7 @@ TEST_CASE_FIXTURE(Fixture, "explicitly_typed_table_with_indexer")
TEST_CASE_FIXTURE(BuiltinsFixture, "recursive_metatable_type_call") TEST_CASE_FIXTURE(BuiltinsFixture, "recursive_metatable_type_call")
{ {
// CLI-114782 // CLI-114782
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local b local b
@ -2704,7 +2704,7 @@ TEST_CASE_FIXTURE(Fixture, "confusing_indexing")
local foo = f({p = "string"}) local foo = f({p = "string"})
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114781 Bidirectional checking can't see through the intersection // CLI-114781 Bidirectional checking can't see through the intersection
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
@ -2730,7 +2730,7 @@ TEST_CASE_FIXTURE(Fixture, "pass_a_union_of_tables_to_a_function_that_requires_a
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
REQUIRE_EQ("{ y: number }", toString(requireType("b"))); REQUIRE_EQ("{ y: number }", toString(requireType("b")));
else else
REQUIRE_EQ("{- y: number -}", toString(requireType("b"))); REQUIRE_EQ("{- y: number -}", toString(requireType("b")));
@ -2751,7 +2751,7 @@ TEST_CASE_FIXTURE(Fixture, "pass_a_union_of_tables_to_a_function_that_requires_a
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
REQUIRE_EQ("{ y: number }", toString(requireType("b"))); REQUIRE_EQ("{ y: number }", toString(requireType("b")));
else else
REQUIRE_EQ("{- y: number -}", toString(requireType("b"))); REQUIRE_EQ("{- y: number -}", toString(requireType("b")));
@ -2827,7 +2827,7 @@ TEST_CASE_FIXTURE(Fixture, "table_length")
TEST_CASE_FIXTURE(Fixture, "nil_assign_doesnt_hit_indexer") TEST_CASE_FIXTURE(Fixture, "nil_assign_doesnt_hit_indexer")
{ {
// CLI-100076 - Assigning a table key to `nil` in the presence of an indexer should always be permitted // CLI-100076 - Assigning a table key to `nil` in the presence of an indexer should always be permitted
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check("local a = {} a[0] = 7 a[0] = nil"); CheckResult result = check("local a = {} a[0] = 7 a[0] = nil");
LUAU_REQUIRE_ERROR_COUNT(0, result); LUAU_REQUIRE_ERROR_COUNT(0, result);
@ -2933,7 +2933,7 @@ TEST_CASE_FIXTURE(Fixture, "tables_get_names_from_their_locals")
TEST_CASE_FIXTURE(Fixture, "should_not_unblock_table_type_twice") TEST_CASE_FIXTURE(Fixture, "should_not_unblock_table_type_twice")
{ {
// don't run this when the DCR flag isn't set // don't run this when the DCR flag isn't set
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
check(R"( check(R"(
@ -2973,7 +2973,7 @@ TEST_CASE_FIXTURE(Fixture, "generalize_table_argument")
const TableType* fooArg1Table = get<TableType>(follow(*fooArg1)); const TableType* fooArg1Table = get<TableType>(follow(*fooArg1));
REQUIRE(fooArg1Table); REQUIRE(fooArg1Table);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(fooArg1Table->state, TableState::Sealed); CHECK_EQ(fooArg1Table->state, TableState::Sealed);
else else
CHECK_EQ(fooArg1Table->state, TableState::Generic); CHECK_EQ(fooArg1Table->state, TableState::Generic);
@ -3059,7 +3059,7 @@ TEST_CASE_FIXTURE(Fixture, "inferring_crazy_table_should_also_be_quick")
)"); )");
ModulePtr module = getMainModule(); ModulePtr module = getMainModule();
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_GE(500, module->internalTypes.types.size()); CHECK_GE(500, module->internalTypes.types.size());
else else
CHECK_GE(100, module->internalTypes.types.size()); CHECK_GE(100, module->internalTypes.types.size());
@ -3119,7 +3119,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dont_crash_when_setmetatable_does_not_produc
{ {
CheckResult result = check("local x = setmetatable({})"); CheckResult result = check("local x = setmetatable({})");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-114665: Generic parameters should not also be optional. // CLI-114665: Generic parameters should not also be optional.
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -3224,7 +3224,7 @@ local baz = foo[bar]
TEST_CASE_FIXTURE(BuiltinsFixture, "table_call_metamethod_basic") TEST_CASE_FIXTURE(BuiltinsFixture, "table_call_metamethod_basic")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -3239,7 +3239,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_call_metamethod_basic")
local foo = a(12) local foo = a(12)
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK(get<ExplicitFunctionAnnotationRecommended>(result.errors[0])); CHECK(get<ExplicitFunctionAnnotationRecommended>(result.errors[0]));
@ -3261,7 +3261,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_call_metamethod_must_be_callable")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
if (DFFlag::LuauImproveNonFunctionCallError) if (DFFlag::LuauImproveNonFunctionCallError)
CHECK("Cannot call a value of type a" == toString(result.errors[0])); CHECK("Cannot call a value of type a" == toString(result.errors[0]));
@ -3300,7 +3300,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "table_call_metamethod_generic")
TEST_CASE_FIXTURE(BuiltinsFixture, "table_simple_call") TEST_CASE_FIXTURE(BuiltinsFixture, "table_simple_call")
{ {
// The new solver can see that this function is safe to oversaturate. // The new solver can see that this function is safe to oversaturate.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local a = setmetatable({ x = 2 }, { local a = setmetatable({ x = 2 }, {
@ -3334,7 +3334,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "access_index_metamethod_that_returns_variadi
ToStringOptions o; ToStringOptions o;
o.exhaustive = true; o.exhaustive = true;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ x: string }", toString(requireType("foo"), o)); CHECK_EQ("{ x: string }", toString(requireType("foo"), o));
else else
CHECK_EQ("{| x: string |}", toString(requireType("foo"), o)); CHECK_EQ("{| x: string |}", toString(requireType("foo"), o));
@ -3386,7 +3386,7 @@ TEST_CASE_FIXTURE(Fixture, "checked_prop_too_early")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("Value of type '{ x: number? }?' could be nil", toString(result.errors[0])); CHECK_EQ("Value of type '{ x: number? }?' could be nil", toString(result.errors[0]));
CHECK_EQ("number | { x: number }", toString(requireType("u"))); CHECK_EQ("number | { x: number }", toString(requireType("u")));
@ -3406,7 +3406,7 @@ TEST_CASE_FIXTURE(Fixture, "accidentally_checked_prop_in_opposite_branch")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("Value of type '{ x: number? }?' could be nil", toString(result.errors[0])); CHECK_EQ("Value of type '{ x: number? }?' could be nil", toString(result.errors[0]));
else else
CHECK_EQ("Value of type '{| x: number? |}?' could be nil", toString(result.errors[0])); CHECK_EQ("Value of type '{| x: number? |}?' could be nil", toString(result.errors[0]));
@ -3485,7 +3485,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "dont_leak_free_table_props")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("({ read blah: unknown }) -> ()", toString(requireType("a"))); CHECK_EQ("({ read blah: unknown }) -> ()", toString(requireType("a")));
CHECK_EQ("({ read gwar: unknown }) -> ()", toString(requireType("b"))); CHECK_EQ("({ read gwar: unknown }) -> ()", toString(requireType("b")));
@ -3505,7 +3505,7 @@ TEST_CASE_FIXTURE(Fixture, "mixed_tables_with_implicit_numbered_keys")
local t: { [string]: number } = { 5, 6, 7 } local t: { [string]: number } = { 5, 6, 7 }
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK( CHECK(
@ -3572,7 +3572,7 @@ TEST_CASE_FIXTURE(Fixture, "prop_access_on_unions_of_indexers_where_key_whose_ty
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("Type '{ [boolean]: number } | {number}' does not have key 'x'", toString(result.errors[0])); CHECK_EQ("Type '{ [boolean]: number } | {number}' does not have key 'x'", toString(result.errors[0]));
else else
CHECK_EQ("Type '{number} | {| [boolean]: number |}' does not have key 'x'", toString(result.errors[0])); CHECK_EQ("Type '{number} | {| [boolean]: number |}' does not have key 'x'", toString(result.errors[0]));
@ -3593,7 +3593,7 @@ local b = a.x
TEST_CASE_FIXTURE(Fixture, "scalar_is_a_subtype_of_a_compatible_polymorphic_shape_type") TEST_CASE_FIXTURE(Fixture, "scalar_is_a_subtype_of_a_compatible_polymorphic_shape_type")
{ {
// CLI-115087 The new solver cannot infer that a table-like type is actually string // CLI-115087 The new solver cannot infer that a table-like type is actually string
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(s) local function f(s)
@ -3620,7 +3620,7 @@ TEST_CASE_FIXTURE(Fixture, "scalar_is_not_a_subtype_of_a_compatible_polymorphic_
f("baz" :: "bar" | "baz") f("baz" :: "bar" | "baz")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// CLI-115090 Error reporting is quite bad in this case. // CLI-115090 Error reporting is quite bad in this case.
@ -3682,7 +3682,7 @@ Table type 'typeof(string)' not compatible with type 't1 where t1 = {- absolutel
TEST_CASE_FIXTURE(Fixture, "a_free_shape_can_turn_into_a_scalar_if_it_is_compatible") TEST_CASE_FIXTURE(Fixture, "a_free_shape_can_turn_into_a_scalar_if_it_is_compatible")
{ {
// CLI-115087 The new solver cannot infer that a table-like type is actually string // CLI-115087 The new solver cannot infer that a table-like type is actually string
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(s): string local function f(s): string
@ -3704,7 +3704,7 @@ TEST_CASE_FIXTURE(Fixture, "a_free_shape_cannot_turn_into_a_scalar_if_it_is_not_
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(4, result); LUAU_REQUIRE_ERROR_COUNT(4, result);
@ -3737,7 +3737,7 @@ Table type 'typeof(string)' not compatible with type 't1 where t1 = {+ absolutel
TEST_CASE_FIXTURE(BuiltinsFixture, "a_free_shape_can_turn_into_a_scalar_directly") TEST_CASE_FIXTURE(BuiltinsFixture, "a_free_shape_can_turn_into_a_scalar_directly")
{ {
// We need egraphs to simplify the type of `out` here. CLI-114134 // We need egraphs to simplify the type of `out` here. CLI-114134
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function stringByteList(str) local function stringByteList(str)
@ -3775,7 +3775,7 @@ TEST_CASE_FIXTURE(Fixture, "invariant_table_properties_means_instantiating_table
local c : string = t.m("hi") local c : string = t.m("hi")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// FIXME. We really should be reporting just one error in this case. CLI-114509 // FIXME. We really should be reporting just one error in this case. CLI-114509
LUAU_REQUIRE_ERROR_COUNT(3, result); LUAU_REQUIRE_ERROR_COUNT(3, result);
@ -3813,7 +3813,7 @@ local g : ({ p : number, q : string }) -> ({ p : number, r : boolean }) = f
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
const TypeMismatch* error = get<TypeMismatch>(result.errors[0]); const TypeMismatch* error = get<TypeMismatch>(result.errors[0]);
REQUIRE_MESSAGE(error, "Expected TypeMismatch but got " << result.errors[0]); REQUIRE_MESSAGE(error, "Expected TypeMismatch but got " << result.errors[0]);
@ -3833,7 +3833,7 @@ local g : ({ p : number, q : string }) -> ({ p : number, r : boolean }) = f
TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_has_a_side_effect") TEST_CASE_FIXTURE(BuiltinsFixture, "setmetatable_has_a_side_effect")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -3971,7 +3971,7 @@ TEST_CASE_FIXTURE(Fixture, "when_augmenting_an_unsealed_table_with_an_indexer_ap
CHECK(tt->props.empty()); CHECK(tt->props.empty());
REQUIRE(tt->indexer); REQUIRE(tt->indexer);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("unknown" == toString(tt->indexer->indexType)); CHECK("unknown" == toString(tt->indexer->indexType));
else else
CHECK("string" == toString(tt->indexer->indexType)); CHECK("string" == toString(tt->indexer->indexType));
@ -3999,7 +3999,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_extend_unsealed_tables_in_rvalue_position")
CHECK(0 == ttv->props.count("")); CHECK(0 == ttv->props.count(""));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
else else
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
@ -4152,7 +4152,7 @@ TEST_CASE_FIXTURE(Fixture, "cli_84607_missing_prop_in_array_or_dict")
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
const TypeMismatch* err1 = get<TypeMismatch>(result.errors[0]); const TypeMismatch* err1 = get<TypeMismatch>(result.errors[0]);
REQUIRE_MESSAGE(err1, "Expected TypeMismatch but got " << result.errors[0]); REQUIRE_MESSAGE(err1, "Expected TypeMismatch but got " << result.errors[0]);
@ -4200,7 +4200,7 @@ TEST_CASE_FIXTURE(Fixture, "simple_method_definition")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ m: (unknown) -> number }", toString(getMainModule()->returnType, ToStringOptions{true})); CHECK_EQ("{ m: (unknown) -> number }", toString(getMainModule()->returnType, ToStringOptions{true}));
else else
CHECK_EQ("{| m: <a>(a) -> number |}", toString(getMainModule()->returnType, ToStringOptions{true})); CHECK_EQ("{| m: <a>(a) -> number |}", toString(getMainModule()->returnType, ToStringOptions{true}));
@ -4208,7 +4208,7 @@ TEST_CASE_FIXTURE(Fixture, "simple_method_definition")
TEST_CASE_FIXTURE(Fixture, "identify_all_problematic_table_fields") TEST_CASE_FIXTURE(Fixture, "identify_all_problematic_table_fields")
{ {
ScopedFastFlag sff_DebugLuauDeferredConstraintResolution{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff_LuauSolverV2{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type T = { type T = {
@ -4236,7 +4236,7 @@ TEST_CASE_FIXTURE(Fixture, "identify_all_problematic_table_fields")
TEST_CASE_FIXTURE(Fixture, "read_and_write_only_table_properties_are_unsupported") TEST_CASE_FIXTURE(Fixture, "read_and_write_only_table_properties_are_unsupported")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -4276,7 +4276,7 @@ TEST_CASE_FIXTURE(Fixture, "read_ond_write_only_indexers_are_unsupported")
TEST_CASE_FIXTURE(Fixture, "infer_write_property") TEST_CASE_FIXTURE(Fixture, "infer_write_property")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(t) function f(t)
@ -4308,7 +4308,7 @@ TEST_CASE_FIXTURE(Fixture, "table_subtyping_error_suppression")
// the new solver reports specifically the inner mismatch, rather than the whole table // the new solver reports specifically the inner mismatch, rather than the whole table
// honestly not sure which of these is a better developer experience. // honestly not sure which of these is a better developer experience.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ(*tm->wantedType, *builtinTypes->stringType); CHECK_EQ(*tm->wantedType, *builtinTypes->stringType);
CHECK_EQ(*tm->givenType, *builtinTypes->numberType); CHECK_EQ(*tm->givenType, *builtinTypes->numberType);
@ -4322,7 +4322,7 @@ TEST_CASE_FIXTURE(Fixture, "table_subtyping_error_suppression")
TEST_CASE_FIXTURE(Fixture, "write_to_read_only_property") TEST_CASE_FIXTURE(Fixture, "write_to_read_only_property")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(t: {read x: number}) function f(t: {read x: number})
@ -4344,7 +4344,7 @@ TEST_CASE_FIXTURE(Fixture, "write_to_read_only_property")
TEST_CASE_FIXTURE(Fixture, "write_to_unusually_named_read_only_property") TEST_CASE_FIXTURE(Fixture, "write_to_unusually_named_read_only_property")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(t: {read ["hello world"]: number}) function f(t: {read ["hello world"]: number})
@ -4359,7 +4359,7 @@ TEST_CASE_FIXTURE(Fixture, "write_to_unusually_named_read_only_property")
TEST_CASE_FIXTURE(Fixture, "write_annotations_are_unsupported_even_with_the_new_solver") TEST_CASE_FIXTURE(Fixture, "write_annotations_are_unsupported_even_with_the_new_solver")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(t: {write foo: number}) function f(t: {write foo: number})
@ -4374,7 +4374,7 @@ TEST_CASE_FIXTURE(Fixture, "write_annotations_are_unsupported_even_with_the_new_
TEST_CASE_FIXTURE(Fixture, "read_and_write_only_table_properties_are_unsupported") TEST_CASE_FIXTURE(Fixture, "read_and_write_only_table_properties_are_unsupported")
{ {
ScopedFastFlag sff[] = {{FFlag::DebugLuauDeferredConstraintResolution, false}}; ScopedFastFlag sff[] = {{FFlag::LuauSolverV2, false}};
CheckResult result = check(R"( CheckResult result = check(R"(
type W = {read x: number} type W = {read x: number}
@ -4398,7 +4398,7 @@ TEST_CASE_FIXTURE(Fixture, "read_and_write_only_table_properties_are_unsupported
TEST_CASE_FIXTURE(Fixture, "read_ond_write_only_indexers_are_unsupported") TEST_CASE_FIXTURE(Fixture, "read_ond_write_only_indexers_are_unsupported")
{ {
ScopedFastFlag sff[] = {{FFlag::DebugLuauDeferredConstraintResolution, false}}; ScopedFastFlag sff[] = {{FFlag::LuauSolverV2, false}};
CheckResult result = check(R"( CheckResult result = check(R"(
type T = {read [string]: number} type T = {read [string]: number}
@ -4415,10 +4415,10 @@ TEST_CASE_FIXTURE(Fixture, "read_ond_write_only_indexers_are_unsupported")
TEST_CASE_FIXTURE(Fixture, "table_writes_introduce_write_properties") TEST_CASE_FIXTURE(Fixture, "table_writes_introduce_write_properties")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
ScopedFastFlag sff[] = {{FFlag::DebugLuauDeferredConstraintResolution, true}}; ScopedFastFlag sff[] = {{FFlag::LuauSolverV2, true}};
CheckResult result = check(R"( CheckResult result = check(R"(
function oc(player, speaker) function oc(player, speaker)
@ -4474,7 +4474,7 @@ TEST_CASE_FIXTURE(Fixture, "refined_thing_can_be_an_array")
TEST_CASE_FIXTURE(Fixture, "parameter_was_set_an_indexer_and_bounded_by_string") TEST_CASE_FIXTURE(Fixture, "parameter_was_set_an_indexer_and_bounded_by_string")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -4493,7 +4493,7 @@ TEST_CASE_FIXTURE(Fixture, "parameter_was_set_an_indexer_and_bounded_by_string")
TEST_CASE_FIXTURE(Fixture, "parameter_was_set_an_indexer_and_bounded_by_another_parameter") TEST_CASE_FIXTURE(Fixture, "parameter_was_set_an_indexer_and_bounded_by_another_parameter")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -4512,7 +4512,7 @@ TEST_CASE_FIXTURE(Fixture, "parameter_was_set_an_indexer_and_bounded_by_another_
TEST_CASE_FIXTURE(Fixture, "write_to_union_property_not_all_present") TEST_CASE_FIXTURE(Fixture, "write_to_union_property_not_all_present")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
type Animal = {tag: "Cat", meow: boolean} | {tag: "Dog", woof: boolean} type Animal = {tag: "Cat", meow: boolean} | {tag: "Dog", woof: boolean}
@ -4632,7 +4632,7 @@ TEST_CASE_FIXTURE(Fixture, "cant_index_this")
TEST_CASE_FIXTURE(Fixture, "setindexer_multiple_tables_intersection") TEST_CASE_FIXTURE(Fixture, "setindexer_multiple_tables_intersection")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(t: { [string]: number } & { [thread]: boolean }, x) local function f(t: { [string]: number } & { [thread]: boolean }, x)
@ -4658,7 +4658,7 @@ TEST_CASE_FIXTURE(Fixture, "insert_a_and_f_of_a_into_table_res_in_a_loop")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK(get<FunctionExitsWithoutReturning>(result.errors[0])); CHECK(get<FunctionExitsWithoutReturning>(result.errors[0]));
@ -4678,7 +4678,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "ipairs_adds_an_unbounded_indexer")
// The old solver erroneously leaves a free type dangling here. The new // The old solver erroneously leaves a free type dangling here. The new
// solver does better. // solver does better.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("{unknown}" == toString(requireType("a"), {true})); CHECK("{unknown}" == toString(requireType("a"), {true}));
else else
CHECK("{a}" == toString(requireType("a"), {true})); CHECK("{a}" == toString(requireType("a"), {true}));
@ -4808,7 +4808,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "indexing_branching_table")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
// unfortunate type duplication in the union // unfortunate type duplication in the union
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("number | string | string" == toString(requireType("test2"))); CHECK("number | string | string" == toString(requireType("test2")));
else else
CHECK("number | string" == toString(requireType("test2"))); CHECK("number | string" == toString(requireType("test2")));
@ -4826,7 +4826,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "indexing_branching_table2")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
// unfortunate type duplication in the union // unfortunate type duplication in the union
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("unknown | unknown" == toString(requireType("test2"))); CHECK("unknown | unknown" == toString(requireType("test2")));
else else
CHECK("any" == toString(requireType("test2"))); CHECK("any" == toString(requireType("test2")));

View File

@ -17,7 +17,7 @@
#include <algorithm> #include <algorithm>
LUAU_FASTFLAG(LuauFixLocationSpanTableIndexExpr); LUAU_FASTFLAG(LuauFixLocationSpanTableIndexExpr);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauInstantiateInSubtyping); LUAU_FASTFLAG(LuauInstantiateInSubtyping);
LUAU_FASTINT(LuauCheckRecursionLimit); LUAU_FASTINT(LuauCheckRecursionLimit);
LUAU_FASTINT(LuauNormalizeCacheLimit); LUAU_FASTINT(LuauNormalizeCacheLimit);
@ -49,7 +49,7 @@ TEST_CASE_FIXTURE(Fixture, "tc_error")
{ {
CheckResult result = check("local a = 7 local b = 'hi' a = b"); CheckResult result = check("local a = 7 local b = 'hi' a = b");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK("number | string" == toString(requireType("a"))); CHECK("number | string" == toString(requireType("a")));
@ -69,7 +69,7 @@ TEST_CASE_FIXTURE(Fixture, "tc_error_2")
{ {
CheckResult result = check("local a = 7 a = 'hi'"); CheckResult result = check("local a = 7 a = 'hi'");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK("number | string" == toString(requireType("a"))); CHECK("number | string" == toString(requireType("a")));
@ -96,7 +96,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_locals_with_nil_value")
CheckResult result = check("local f = nil; f = 'hello world'"); CheckResult result = check("local f = nil; f = 'hello world'");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("string?" == toString(requireType("f"))); CHECK("string?" == toString(requireType("f")));
} }
@ -128,7 +128,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_locals_via_assignment_from_its_call_site")
f("foo") f("foo")
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("unknown" == toString(requireType("a"))); CHECK("unknown" == toString(requireType("a")));
CHECK("(unknown) -> ()" == toString(requireType("f"))); CHECK("(unknown) -> ()" == toString(requireType("f")));
@ -146,7 +146,7 @@ TEST_CASE_FIXTURE(Fixture, "infer_locals_via_assignment_from_its_call_site")
TEST_CASE_FIXTURE(Fixture, "infer_in_nocheck_mode") TEST_CASE_FIXTURE(Fixture, "infer_in_nocheck_mode")
{ {
ScopedFastFlag sff[]{ ScopedFastFlag sff[]{
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -194,7 +194,7 @@ TEST_CASE_FIXTURE(Fixture, "if_statement")
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK("string?" == toString(requireType("a"))); CHECK("string?" == toString(requireType("a")));
CHECK("number?" == toString(requireType("b"))); CHECK("number?" == toString(requireType("b")));
@ -224,7 +224,7 @@ TEST_CASE_FIXTURE(Fixture, "statements_are_topologically_sorted")
TEST_CASE_FIXTURE(Fixture, "unify_nearly_identical_recursive_types") TEST_CASE_FIXTURE(Fixture, "unify_nearly_identical_recursive_types")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local o local o
@ -265,7 +265,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "weird_case")
TEST_CASE_FIXTURE(Fixture, "dont_ice_when_failing_the_occurs_check") TEST_CASE_FIXTURE(Fixture, "dont_ice_when_failing_the_occurs_check")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -318,7 +318,7 @@ TEST_CASE_FIXTURE(Fixture, "type_errors_infer_types")
CHECK_EQ("x", err->key); CHECK_EQ("x", err->key);
// TODO: Should we assert anything about these tests when DCR is being used? // TODO: Should we assert anything about these tests when DCR is being used?
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
{ {
CHECK_EQ("*error-type*", toString(requireType("c"))); CHECK_EQ("*error-type*", toString(requireType("c")));
CHECK_EQ("*error-type*", toString(requireType("d"))); CHECK_EQ("*error-type*", toString(requireType("d")));
@ -384,7 +384,7 @@ TEST_CASE_FIXTURE(Fixture, "exponential_blowup_from_copying_types")
// checker. We also want it to somewhat match up with production values, so we push up the parser recursion limit a little bit instead. // checker. We also want it to somewhat match up with production values, so we push up the parser recursion limit a little bit instead.
TEST_CASE_FIXTURE(Fixture, "check_type_infer_recursion_count") TEST_CASE_FIXTURE(Fixture, "check_type_infer_recursion_count")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
#if defined(LUAU_ENABLE_ASAN) #if defined(LUAU_ENABLE_ASAN)
int limit = 250; int limit = 250;
@ -442,7 +442,7 @@ TEST_CASE_FIXTURE(Fixture, "check_expr_recursion_limit")
TEST_CASE_FIXTURE(Fixture, "globals") TEST_CASE_FIXTURE(Fixture, "globals")
{ {
// The new solver does not permit assignments to globals like this. // The new solver does not permit assignments to globals like this.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -456,7 +456,7 @@ TEST_CASE_FIXTURE(Fixture, "globals")
TEST_CASE_FIXTURE(Fixture, "globals2") TEST_CASE_FIXTURE(Fixture, "globals2")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!nonstrict --!nonstrict
@ -506,7 +506,7 @@ TEST_CASE_FIXTURE(Fixture, "correctly_scope_locals_do")
TEST_CASE_FIXTURE(Fixture, "checking_should_not_ice") TEST_CASE_FIXTURE(Fixture, "checking_should_not_ice")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CHECK_NOTHROW(check(R"( CHECK_NOTHROW(check(R"(
--!nonstrict --!nonstrict
@ -600,7 +600,7 @@ TEST_CASE_FIXTURE(Fixture, "tc_after_error_recovery_no_assert")
TEST_CASE_FIXTURE(BuiltinsFixture, "tc_after_error_recovery_no_replacement_name_in_error") TEST_CASE_FIXTURE(BuiltinsFixture, "tc_after_error_recovery_no_replacement_name_in_error")
{ {
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -622,7 +622,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "tc_after_error_recovery_no_replacement_name_
} }
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -697,7 +697,7 @@ TEST_CASE_FIXTURE(Fixture, "cli_39932_use_unifier_in_ensure_methods")
TEST_CASE_FIXTURE(Fixture, "dont_report_type_errors_within_an_AstStatError") TEST_CASE_FIXTURE(Fixture, "dont_report_type_errors_within_an_AstStatError")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
foo foo
@ -708,7 +708,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_report_type_errors_within_an_AstStatError")
TEST_CASE_FIXTURE(Fixture, "dont_report_type_errors_within_an_AstExprError") TEST_CASE_FIXTURE(Fixture, "dont_report_type_errors_within_an_AstExprError")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local a = foo: local a = foo:
@ -759,7 +759,7 @@ TEST_CASE_FIXTURE(Fixture, "no_stack_overflow_from_isoptional")
std::optional<TypeId> t0 = lookupType("t0"); std::optional<TypeId> t0 = lookupType("t0");
REQUIRE(t0); REQUIRE(t0);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("any" == toString(*t0)); CHECK("any" == toString(*t0));
else else
CHECK_EQ("*error-type*", toString(*t0)); CHECK_EQ("*error-type*", toString(*t0));
@ -819,7 +819,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "no_heap_use_after_free_error")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
else else
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
@ -1099,7 +1099,7 @@ end
TEST_CASE_FIXTURE(Fixture, "cli_50041_committing_txnlog_in_apollo_client_error") TEST_CASE_FIXTURE(Fixture, "cli_50041_committing_txnlog_in_apollo_client_error")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
--!strict --!strict
@ -1177,7 +1177,7 @@ TEST_CASE_FIXTURE(Fixture, "type_infer_recursion_limit_no_ice")
LUAU_REQUIRE_ERRORS(result); LUAU_REQUIRE_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Type contains a self-recursive construct that cannot be resolved" == toString(result.errors[0])); CHECK("Type contains a self-recursive construct that cannot be resolved" == toString(result.errors[0]));
else else
CHECK_EQ("Code is too complex to typecheck! Consider simplifying the code around this area", toString(result.errors[0])); CHECK_EQ("Code is too complex to typecheck! Consider simplifying the code around this area", toString(result.errors[0]));
@ -1199,7 +1199,7 @@ TEST_CASE_FIXTURE(Fixture, "type_infer_recursion_limit_normalizer")
CHECK(1 == result.errors.size()); CHECK(1 == result.errors.size());
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(Location{{3, 22}, {3, 42}} == result.errors[0].location); CHECK(Location{{3, 22}, {3, 42}} == result.errors[0].location);
else else
CHECK(Location{{3, 12}, {3, 46}} == result.errors[0].location); CHECK(Location{{3, 12}, {3, 46}} == result.errors[0].location);
@ -1222,7 +1222,7 @@ TEST_CASE_FIXTURE(Fixture, "type_infer_cache_limit_normalizer")
TEST_CASE_FIXTURE(Fixture, "follow_on_new_types_in_substitution") TEST_CASE_FIXTURE(Fixture, "follow_on_new_types_in_substitution")
{ {
// CLI-114134 // CLI-114134
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local obj = {} local obj = {}
@ -1358,7 +1358,7 @@ end
TEST_CASE_FIXTURE(Fixture, "dcr_delays_expansion_of_function_containing_blocked_parameter_type") TEST_CASE_FIXTURE(Fixture, "dcr_delays_expansion_of_function_containing_blocked_parameter_type")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
}; };
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1392,7 +1392,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "recursive_function_that_invokes_itself_with_
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("(unknown) -> ()" == toString(requireType("readValue"))); CHECK("(unknown) -> ()" == toString(requireType("readValue")));
else else
CHECK("<a>(a) -> ()" == toString(requireType("readValue"))); CHECK("<a>(a) -> ()" == toString(requireType("readValue")));
@ -1408,7 +1408,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "recursive_function_that_invokes_itself_with_
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("(unknown) -> ()" == toString(requireType("readValue"))); CHECK("(unknown) -> ()" == toString(requireType("readValue")));
else else
CHECK("(number) -> ()" == toString(requireType("readValue"))); CHECK("(number) -> ()" == toString(requireType("readValue")));
@ -1527,7 +1527,7 @@ TEST_CASE_FIXTURE(Fixture, "promote_tail_type_packs")
TEST_CASE_FIXTURE(BuiltinsFixture, "lti_must_record_contributing_locations") TEST_CASE_FIXTURE(BuiltinsFixture, "lti_must_record_contributing_locations")
{ {
ScopedFastFlag sff_DebugLuauDeferredConstraintResolution{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff_LuauSolverV2{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local function f(a) local function f(a)
@ -1563,7 +1563,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "lti_must_record_contributing_locations")
*/ */
TEST_CASE_FIXTURE(BuiltinsFixture, "be_sure_to_use_active_txnlog_when_evaluating_a_variadic_overload") TEST_CASE_FIXTURE(BuiltinsFixture, "be_sure_to_use_active_txnlog_when_evaluating_a_variadic_overload")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local function concat<T>(target: {T}, ...: {T} | T): {T} local function concat<T>(target: {T}, ...: {T} | T): {T}
@ -1615,7 +1615,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "bad_iter_metamethod")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);

View File

@ -11,13 +11,13 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauUnifierRecursionOnRestart); LUAU_FASTFLAG(LuauUnifierRecursionOnRestart);
struct TryUnifyFixture : Fixture struct TryUnifyFixture : Fixture
{ {
// Cannot use `TryUnifyFixture` under DCR. // Cannot use `TryUnifyFixture` under DCR.
ScopedFastFlag noDcr{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag noDcr{FFlag::LuauSolverV2, false};
TypeArena arena; TypeArena arena;
ScopePtr globalScope{new Scope{arena.addTypePack({TypeId{}})}}; ScopePtr globalScope{new Scope{arena.addTypePack({TypeId{}})}};
@ -154,7 +154,7 @@ TEST_CASE_FIXTURE(Fixture, "uninhabited_intersection_sub_anything")
TEST_CASE_FIXTURE(Fixture, "uninhabited_table_sub_never") TEST_CASE_FIXTURE(Fixture, "uninhabited_table_sub_never")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(arg : { prop : string & number }) : never function f(arg : { prop : string & number }) : never
@ -166,7 +166,7 @@ TEST_CASE_FIXTURE(Fixture, "uninhabited_table_sub_never")
TEST_CASE_FIXTURE(Fixture, "uninhabited_table_sub_anything") TEST_CASE_FIXTURE(Fixture, "uninhabited_table_sub_anything")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(arg : { prop : string & number }) : boolean function f(arg : { prop : string & number }) : boolean
@ -178,7 +178,7 @@ TEST_CASE_FIXTURE(Fixture, "uninhabited_table_sub_anything")
TEST_CASE_FIXTURE(Fixture, "members_of_failed_typepack_unification_are_unified_with_errorType") TEST_CASE_FIXTURE(Fixture, "members_of_failed_typepack_unification_are_unified_with_errorType")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(arg: number) end function f(arg: number) end
@ -195,7 +195,7 @@ TEST_CASE_FIXTURE(Fixture, "members_of_failed_typepack_unification_are_unified_w
TEST_CASE_FIXTURE(Fixture, "result_of_failed_typepack_unification_is_constrained") TEST_CASE_FIXTURE(Fixture, "result_of_failed_typepack_unification_is_constrained")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(arg: number) return arg end function f(arg: number) return arg end
@ -278,7 +278,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "cli_41095_concat_log_in_sealed_table_unifica
LUAU_REQUIRE_ERROR_COUNT(2, result); LUAU_REQUIRE_ERROR_COUNT(2, result);
CHECK_EQ(toString(result.errors[0]), "No overload for function accepts 0 arguments."); CHECK_EQ(toString(result.errors[0]), "No overload for function accepts 0 arguments.");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(result.errors[1]), "Available overloads: <V>({V}, V) -> (); and <V>({V}, number, V) -> ()"); CHECK_EQ(toString(result.errors[1]), "Available overloads: <V>({V}, V) -> (); and <V>({V}, number, V) -> ()");
else else
CHECK_EQ(toString(result.errors[1]), "Available overloads: ({a}, a) -> (); and ({a}, number, a) -> ()"); CHECK_EQ(toString(result.errors[1]), "Available overloads: ({a}, a) -> (); and ({a}, number, a) -> ()");

View File

@ -9,7 +9,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAG(LuauInstantiateInSubtyping); LUAU_FASTFLAG(LuauInstantiateInSubtyping);
TEST_SUITE_BEGIN("TypePackTests"); TEST_SUITE_BEGIN("TypePackTests");
@ -316,7 +316,7 @@ local c: Packed<string, number, boolean>
tf = lookupType("Packed"); tf = lookupType("Packed");
REQUIRE(tf); REQUIRE(tf);
CHECK_EQ(toString(*tf), "Packed<T, U...>"); CHECK_EQ(toString(*tf), "Packed<T, U...>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(*tf, {true}), "{ f: (T, U...) -> (T, U...) }"); CHECK_EQ(toString(*tf, {true}), "{ f: (T, U...) -> (T, U...) }");
else else
CHECK_EQ(toString(*tf, {true}), "{| f: (T, U...) -> (T, U...) |}"); CHECK_EQ(toString(*tf, {true}), "{| f: (T, U...) -> (T, U...) |}");
@ -324,7 +324,7 @@ local c: Packed<string, number, boolean>
auto ttvA = get<TableType>(requireType("a")); auto ttvA = get<TableType>(requireType("a"));
REQUIRE(ttvA); REQUIRE(ttvA);
CHECK_EQ(toString(requireType("a")), "Packed<number>"); CHECK_EQ(toString(requireType("a")), "Packed<number>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireType("a"), {true}), "{ f: (number) -> number }"); CHECK_EQ(toString(requireType("a"), {true}), "{ f: (number) -> number }");
else else
CHECK_EQ(toString(requireType("a"), {true}), "{| f: (number) -> number |}"); CHECK_EQ(toString(requireType("a"), {true}), "{| f: (number) -> number |}");
@ -336,7 +336,7 @@ local c: Packed<string, number, boolean>
auto ttvB = get<TableType>(requireType("b")); auto ttvB = get<TableType>(requireType("b"));
REQUIRE(ttvB); REQUIRE(ttvB);
CHECK_EQ(toString(requireType("b")), "Packed<string, number>"); CHECK_EQ(toString(requireType("b")), "Packed<string, number>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireType("b"), {true}), "{ f: (string, number) -> (string, number) }"); CHECK_EQ(toString(requireType("b"), {true}), "{ f: (string, number) -> (string, number) }");
else else
CHECK_EQ(toString(requireType("b"), {true}), "{| f: (string, number) -> (string, number) |}"); CHECK_EQ(toString(requireType("b"), {true}), "{| f: (string, number) -> (string, number) |}");
@ -348,7 +348,7 @@ local c: Packed<string, number, boolean>
auto ttvC = get<TableType>(requireType("c")); auto ttvC = get<TableType>(requireType("c"));
REQUIRE(ttvC); REQUIRE(ttvC);
CHECK_EQ(toString(requireType("c")), "Packed<string, number, boolean>"); CHECK_EQ(toString(requireType("c")), "Packed<string, number, boolean>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireType("c"), {true}), "{ f: (string, number, boolean) -> (string, number, boolean) }"); CHECK_EQ(toString(requireType("c"), {true}), "{ f: (string, number, boolean) -> (string, number, boolean) }");
else else
CHECK_EQ(toString(requireType("c"), {true}), "{| f: (string, number, boolean) -> (string, number, boolean) |}"); CHECK_EQ(toString(requireType("c"), {true}), "{| f: (string, number, boolean) -> (string, number, boolean) |}");
@ -381,7 +381,7 @@ local d: { a: typeof(c) }
REQUIRE(tf); REQUIRE(tf);
CHECK_EQ(toString(*tf), "Packed<T, U...>"); CHECK_EQ(toString(*tf), "Packed<T, U...>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ(toString(*tf, {true}), "{ a: T, b: (U...) -> () }"); CHECK_EQ(toString(*tf, {true}), "{ a: T, b: (U...) -> () }");
@ -421,12 +421,12 @@ type C<X...> = Import.Packed<string, (number, X...)>
auto tf = lookupType("Alias"); auto tf = lookupType("Alias");
REQUIRE(tf); REQUIRE(tf);
CHECK_EQ(toString(*tf), "Alias<S, T, R...>"); CHECK_EQ(toString(*tf), "Alias<S, T, R...>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(*tf, {true}), "{ a: S, b: (T, R...) -> () }"); CHECK_EQ(toString(*tf, {true}), "{ a: S, b: (T, R...) -> () }");
else else
CHECK_EQ(toString(*tf, {true}), "{| a: S, b: (T, R...) -> () |}"); CHECK_EQ(toString(*tf, {true}), "{| a: S, b: (T, R...) -> () |}");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(requireType("a"), {true}), "{ a: string, b: (number, boolean) -> () }"); CHECK_EQ(toString(requireType("a"), {true}), "{ a: string, b: (number, boolean) -> () }");
else else
CHECK_EQ(toString(requireType("a"), {true}), "{| a: string, b: (number, boolean) -> () |}"); CHECK_EQ(toString(requireType("a"), {true}), "{| a: string, b: (number, boolean) -> () |}");
@ -434,7 +434,7 @@ type C<X...> = Import.Packed<string, (number, X...)>
tf = lookupType("B"); tf = lookupType("B");
REQUIRE(tf); REQUIRE(tf);
CHECK_EQ(toString(*tf), "B<X...>"); CHECK_EQ(toString(*tf), "B<X...>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(*tf, {true}), "{ a: string, b: (X...) -> () }"); CHECK_EQ(toString(*tf, {true}), "{ a: string, b: (X...) -> () }");
else else
CHECK_EQ(toString(*tf, {true}), "{| a: string, b: (X...) -> () |}"); CHECK_EQ(toString(*tf, {true}), "{| a: string, b: (X...) -> () |}");
@ -442,7 +442,7 @@ type C<X...> = Import.Packed<string, (number, X...)>
tf = lookupType("C"); tf = lookupType("C");
REQUIRE(tf); REQUIRE(tf);
CHECK_EQ(toString(*tf), "C<X...>"); CHECK_EQ(toString(*tf), "C<X...>");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(*tf, {true}), "{ a: string, b: (number, X...) -> () }"); CHECK_EQ(toString(*tf, {true}), "{ a: string, b: (number, X...) -> () }");
else else
CHECK_EQ(toString(*tf, {true}), "{| a: string, b: (number, X...) -> () |}"); CHECK_EQ(toString(*tf, {true}), "{| a: string, b: (number, X...) -> () |}");
@ -787,7 +787,7 @@ local d: Y<number, string, ...boolean, ...() -> ()>
TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors") TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Y<T = T> = { a: T } type Y<T = T> = { a: T }
@ -811,7 +811,7 @@ TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors2")
TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors3") TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors3")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Y<T = string, U... = ...string> = { a: (T) -> U... } type Y<T = string, U... = ...string> = { a: (T) -> U... }
@ -824,7 +824,7 @@ TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors3")
TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors4") TEST_CASE_FIXTURE(Fixture, "type_alias_default_type_errors4")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type Packed<T> = (T) -> T type Packed<T> = (T) -> T
@ -935,7 +935,7 @@ type R = { m: F<R> }
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ(toString(*lookupType("R"), {true}), "t1 where t1 = { m: (t1) -> (t1) -> () }"); CHECK_EQ(toString(*lookupType("R"), {true}), "t1 where t1 = { m: (t1) -> (t1) -> () }");
else else
CHECK_EQ(toString(*lookupType("R"), {true}), "t1 where t1 = {| m: (t1) -> (t1) -> () |}"); CHECK_EQ(toString(*lookupType("R"), {true}), "t1 where t1 = {| m: (t1) -> (t1) -> () |}");
@ -951,7 +951,7 @@ a = b
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
const std::string expected = const std::string expected =
"Type\n" "Type\n"
@ -1065,7 +1065,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "detect_cyclic_typepacks2")
TEST_CASE_FIXTURE(Fixture, "unify_variadic_tails_in_arguments") TEST_CASE_FIXTURE(Fixture, "unify_variadic_tails_in_arguments")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function foo(...: string): number function foo(...: string): number
@ -1094,7 +1094,7 @@ TEST_CASE_FIXTURE(Fixture, "unify_variadic_tails_in_arguments_free")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK( CHECK(
toString(result.errors.at(0)) == toString(result.errors.at(0)) ==
"Type pack '...number' could not be converted into 'boolean'; type ...number.tail() (...number) is not a subtype of boolean (boolean)" "Type pack '...number' could not be converted into 'boolean'; type ...number.tail() (...number) is not a subtype of boolean (boolean)"
@ -1106,7 +1106,7 @@ TEST_CASE_FIXTURE(Fixture, "unify_variadic_tails_in_arguments_free")
TEST_CASE_FIXTURE(BuiltinsFixture, "type_packs_with_tails_in_vararg_adjustment") TEST_CASE_FIXTURE(BuiltinsFixture, "type_packs_with_tails_in_vararg_adjustment")
{ {
std::optional<ScopedFastFlag> sff; std::optional<ScopedFastFlag> sff;
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
sff = {FFlag::LuauInstantiateInSubtyping, true}; sff = {FFlag::LuauInstantiateInSubtyping, true};
CheckResult result = check(R"( CheckResult result = check(R"(
@ -1127,7 +1127,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "type_packs_with_tails_in_vararg_adjustment")
TEST_CASE_FIXTURE(BuiltinsFixture, "generalize_expectedTypes_with_proper_scope") TEST_CASE_FIXTURE(BuiltinsFixture, "generalize_expectedTypes_with_proper_scope")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, true}, {FFlag::LuauSolverV2, true},
{FFlag::LuauInstantiateInSubtyping, true}, {FFlag::LuauInstantiateInSubtyping, true},
}; };

View File

@ -3,7 +3,7 @@
#include "doctest.h" #include "doctest.h"
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
using namespace Luau; using namespace Luau;
@ -11,7 +11,7 @@ namespace
{ {
struct TypeStateFixture : BuiltinsFixture struct TypeStateFixture : BuiltinsFixture
{ {
ScopedFastFlag dcr{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag dcr{FFlag::LuauSolverV2, true};
}; };
} // namespace } // namespace
@ -73,7 +73,7 @@ TEST_CASE_FIXTURE(TypeStateFixture, "parameter_x_was_constrained_by_two_types")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
// `y` is annotated `string | number` which is explicitly not compatible with `string?` // `y` is annotated `string | number` which is explicitly not compatible with `string?`
// as such, we produce an error here for that mismatch. // as such, we produce an error here for that mismatch.
@ -392,7 +392,7 @@ TEST_CASE_FIXTURE(TypeStateFixture, "prototyped_recursive_functions")
TEST_CASE_FIXTURE(BuiltinsFixture, "prototyped_recursive_functions_but_has_future_assignments") TEST_CASE_FIXTURE(BuiltinsFixture, "prototyped_recursive_functions_but_has_future_assignments")
{ {
// early return if the flag isn't set since this is blocking gated commits // early return if the flag isn't set since this is blocking gated commits
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -461,7 +461,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typestates_preserve_error_suppression_proper
// early return if the flag isn't set since this is blocking gated commits // early return if the flag isn't set since this is blocking gated commits
// unconditional return // unconditional return
// CLI-117098 Type states with error suppressing properties doesn't infer the correct type for properties. // CLI-117098 Type states with error suppressing properties doesn't infer the correct type for properties.
if (!FFlag::DebugLuauDeferredConstraintResolution || FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2 || FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -477,7 +477,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typestates_preserve_error_suppression_proper
TEST_CASE_FIXTURE(BuiltinsFixture, "typestates_do_not_apply_to_the_initial_local_definition") TEST_CASE_FIXTURE(BuiltinsFixture, "typestates_do_not_apply_to_the_initial_local_definition")
{ {
// early return if the flag isn't set since this is blocking gated commits // early return if the flag isn't set since this is blocking gated commits
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -495,7 +495,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "typestates_do_not_apply_to_the_initial_local
TEST_CASE_FIXTURE(Fixture, "typestate_globals") TEST_CASE_FIXTURE(Fixture, "typestate_globals")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
loadDefinition(R"( loadDefinition(R"(
declare foo: string | number declare foo: string | number
@ -512,7 +512,7 @@ TEST_CASE_FIXTURE(Fixture, "typestate_globals")
TEST_CASE_FIXTURE(Fixture, "typestate_unknown_global") TEST_CASE_FIXTURE(Fixture, "typestate_unknown_global")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
x = 5 x = 5

View File

@ -8,7 +8,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
LUAU_FASTFLAG(LuauAcceptIndexingTableUnionsIntersections) LUAU_FASTFLAG(LuauAcceptIndexingTableUnionsIntersections)
TEST_SUITE_BEGIN("UnionTypes"); TEST_SUITE_BEGIN("UnionTypes");
@ -36,7 +36,7 @@ TEST_CASE_FIXTURE(Fixture, "return_types_can_be_disjoint")
{ {
// CLI-114134 We need egraphs to consistently reduce the cyclic union // CLI-114134 We need egraphs to consistently reduce the cyclic union
// introduced by the increment here. // introduced by the increment here.
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local count = 0 local count = 0
@ -122,7 +122,7 @@ TEST_CASE_FIXTURE(Fixture, "optional_arguments")
TEST_CASE_FIXTURE(Fixture, "optional_arguments_table") TEST_CASE_FIXTURE(Fixture, "optional_arguments_table")
{ {
// CLI-115588 - Bidirectional inference does not happen for assignments // CLI-115588 - Bidirectional inference does not happen for assignments
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local a:{a:string, b:string?} local a:{a:string, b:string?}
@ -237,7 +237,7 @@ TEST_CASE_FIXTURE(Fixture, "index_on_a_union_type_with_missing_property")
REQUIRE(mup); REQUIRE(mup);
CHECK_EQ("Key 'x' is missing from 'B' in the type 'A | B'", toString(result.errors[0])); CHECK_EQ("Key 'x' is missing from 'B' in the type 'A | B'", toString(result.errors[0]));
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(A | B) -> number", toString(requireType("f"))); CHECK_EQ("(A | B) -> number", toString(requireType("f")));
else else
CHECK_EQ("(A | B) -> *error-type*", toString(requireType("f"))); CHECK_EQ("(A | B) -> *error-type*", toString(requireType("f")));
@ -411,7 +411,7 @@ TEST_CASE_FIXTURE(Fixture, "optional_assignment_errors_2")
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
auto s = toString(result.errors[0]); auto s = toString(result.errors[0]);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("Value of type '({ x: number } & { y: number })?' could be nil", s); CHECK_EQ("Value of type '({ x: number } & { y: number })?' could be nil", s);
else else
CHECK_EQ("Value of type '({| x: number |} & {| y: number |})?' could be nil", s); CHECK_EQ("Value of type '({| x: number |} & {| y: number |})?' could be nil", s);
@ -473,7 +473,7 @@ end
TEST_CASE_FIXTURE(Fixture, "unify_unsealed_table_union_check") TEST_CASE_FIXTURE(Fixture, "unify_unsealed_table_union_check")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
local x = { x = 3 } local x = { x = 3 }
@ -534,7 +534,7 @@ end
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ( CHECK_EQ(
toString(result.errors[0]), toString(result.errors[0]),
@ -566,7 +566,7 @@ TEST_CASE_FIXTURE(Fixture, "error_detailed_union_all")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK(toString(result.errors[0]) == "Type '{ w: number }' could not be converted into 'X | Y | Z'"); CHECK(toString(result.errors[0]) == "Type '{ w: number }' could not be converted into 'X | Y | Z'");
else else
CHECK_EQ(toString(result.errors[0]), R"(Type 'a' could not be converted into 'X | Y | Z'; none of the union options are compatible)"); CHECK_EQ(toString(result.errors[0]), R"(Type 'a' could not be converted into 'X | Y | Z'; none of the union options are compatible)");
@ -581,7 +581,7 @@ local a: X? = { w = 4 }
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK("Type '{ w: number }' could not be converted into 'X?'" == toString(result.errors[0])); CHECK("Type '{ w: number }' could not be converted into 'X?'" == toString(result.errors[0]));
else else
{ {
@ -647,7 +647,7 @@ TEST_CASE_FIXTURE(Fixture, "indexing_into_a_cyclic_union_doesnt_crash")
TEST_CASE_FIXTURE(BuiltinsFixture, "table_union_write_indirect") TEST_CASE_FIXTURE(BuiltinsFixture, "table_union_write_indirect")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
type A = { x: number, y: (number) -> string } | { z: number, y: (number) -> string } type A = { x: number, y: (number) -> string } | { z: number, y: (number) -> string }
@ -723,7 +723,7 @@ TEST_CASE_FIXTURE(Fixture, "union_of_generic_typepack_functions")
TEST_CASE_FIXTURE(Fixture, "union_of_functions_mentioning_generics") TEST_CASE_FIXTURE(Fixture, "union_of_functions_mentioning_generics")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f<a,b>() function f<a,b>()
@ -743,7 +743,7 @@ TEST_CASE_FIXTURE(Fixture, "union_of_functions_mentioning_generics")
TEST_CASE_FIXTURE(Fixture, "union_of_functions_mentioning_generic_typepacks") TEST_CASE_FIXTURE(Fixture, "union_of_functions_mentioning_generic_typepacks")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f<a...>() function f<a...>()
@ -764,7 +764,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_arg_arities") TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_arg_arities")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x : (number) -> number?) function f(x : (number) -> number?)
@ -783,7 +783,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_result_arities") TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_result_arities")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x : () -> (number | string)) function f(x : () -> (number | string))
@ -802,7 +802,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_variadics") TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_variadics")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x : (...nil) -> (...number?)) function f(x : (...nil) -> (...number?))
@ -829,7 +829,7 @@ TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_arg_variadics")
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK(R"(Type CHECK(R"(Type
'(number) -> ()' '(number) -> ()'
@ -848,7 +848,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_result_variadics") TEST_CASE_FIXTURE(Fixture, "union_of_functions_with_mismatching_result_variadics")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(x : () -> (number?, ...number)) function f(x : () -> (number?, ...number))
@ -867,7 +867,7 @@ could not be converted into
TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_union_types") TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_union_types")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -884,7 +884,7 @@ TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_union_types")
TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_union_types_2") TEST_CASE_FIXTURE(Fixture, "less_greedy_unification_with_union_types_2")
{ {
if (!FFlag::DebugLuauDeferredConstraintResolution) if (!FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
@ -916,7 +916,7 @@ TEST_CASE_FIXTURE(Fixture, "union_table_any_property")
TEST_CASE_FIXTURE(Fixture, "union_function_any_args") TEST_CASE_FIXTURE(Fixture, "union_function_any_args")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f(sup : ((...any) -> (...any))?, sub : ((number) -> (...any))) function f(sup : ((...any) -> (...any))?, sub : ((number) -> (...any)))
@ -940,7 +940,7 @@ TEST_CASE_FIXTURE(Fixture, "optional_any")
TEST_CASE_FIXTURE(Fixture, "generic_function_with_optional_arg") TEST_CASE_FIXTURE(Fixture, "generic_function_with_optional_arg")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, false}; ScopedFastFlag sff{FFlag::LuauSolverV2, false};
CheckResult result = check(R"( CheckResult result = check(R"(
function f<T>(x : T?) : {T} function f<T>(x : T?) : {T}
@ -974,7 +974,7 @@ TEST_CASE_FIXTURE(Fixture, "lookup_prop_of_intersection_containing_unions")
TEST_CASE_FIXTURE(Fixture, "suppress_errors_for_prop_lookup_of_a_union_that_includes_error") TEST_CASE_FIXTURE(Fixture, "suppress_errors_for_prop_lookup_of_a_union_that_includes_error")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
registerHiddenTypes(&frontend); registerHiddenTypes(&frontend);

View File

@ -6,7 +6,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
TEST_SUITE_BEGIN("TypeInferUnknownNever"); TEST_SUITE_BEGIN("TypeInferUnknownNever");
@ -118,7 +118,7 @@ TEST_CASE_FIXTURE(Fixture, "type_packs_containing_never_is_itself_uninhabitable"
local x, y, z = f() local x, y, z = f()
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK("Function only returns 2 values, but 3 are required here" == toString(result.errors[0])); CHECK("Function only returns 2 values, but 3 are required here" == toString(result.errors[0]));
@ -149,7 +149,7 @@ TEST_CASE_FIXTURE(Fixture, "type_packs_containing_never_is_itself_uninhabitable2
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CHECK_EQ("string", toString(requireType("x1"))); CHECK_EQ("string", toString(requireType("x1")));
CHECK_EQ("never", toString(requireType("x2"))); CHECK_EQ("never", toString(requireType("x2")));
@ -199,7 +199,7 @@ TEST_CASE_FIXTURE(Fixture, "assign_to_local_which_is_never")
t = 3 t = 3
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
} }
@ -266,7 +266,7 @@ TEST_CASE_FIXTURE(Fixture, "pick_never_from_variadic_type_pack")
TEST_CASE_FIXTURE(Fixture, "index_on_union_of_tables_for_properties_that_is_never") TEST_CASE_FIXTURE(Fixture, "index_on_union_of_tables_for_properties_that_is_never")
{ {
// CLI-117116 - We are erroneously warning when passing a valid table literal where we expect a union of tables. // CLI-117116 - We are erroneously warning when passing a valid table literal where we expect a union of tables.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
type Disjoint = {foo: never, bar: unknown, tag: "ok"} | {foo: never, baz: unknown, tag: "err"} type Disjoint = {foo: never, bar: unknown, tag: "ok"} | {foo: never, baz: unknown, tag: "err"}
@ -286,7 +286,7 @@ TEST_CASE_FIXTURE(Fixture, "index_on_union_of_tables_for_properties_that_is_neve
TEST_CASE_FIXTURE(Fixture, "index_on_union_of_tables_for_properties_that_is_sorta_never") TEST_CASE_FIXTURE(Fixture, "index_on_union_of_tables_for_properties_that_is_sorta_never")
{ {
// CLI-117116 - We are erroneously warning when passing a valid table literal where we expect a union of tables. // CLI-117116 - We are erroneously warning when passing a valid table literal where we expect a union of tables.
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
return; return;
CheckResult result = check(R"( CheckResult result = check(R"(
type Disjoint = {foo: string, bar: unknown, tag: "ok"} | {foo: never, baz: unknown, tag: "err"} type Disjoint = {foo: string, bar: unknown, tag: "ok"} | {foo: never, baz: unknown, tag: "err"}
@ -335,7 +335,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_unify_operands_if_one_of_the_operand_is_never_i
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("(nil, unknown) -> boolean", toString(requireType("ord"))); CHECK_EQ("(nil, unknown) -> boolean", toString(requireType("ord")));
else else
CHECK_EQ("<a>(nil, a) -> boolean", toString(requireType("ord"))); CHECK_EQ("<a>(nil, a) -> boolean", toString(requireType("ord")));
@ -349,7 +349,7 @@ TEST_CASE_FIXTURE(Fixture, "math_operators_and_never")
end end
)"); )");
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_ERROR_COUNT(1, result);
CHECK(get<ExplicitFunctionAnnotationRecommended>(result.errors[0])); CHECK(get<ExplicitFunctionAnnotationRecommended>(result.errors[0]));
@ -379,7 +379,7 @@ TEST_CASE_FIXTURE(Fixture, "compare_never")
TEST_CASE_FIXTURE(Fixture, "lti_error_at_declaration_for_never_normalizations") TEST_CASE_FIXTURE(Fixture, "lti_error_at_declaration_for_never_normalizations")
{ {
ScopedFastFlag sff_DebugLuauDeferredConstraintResolution{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff_LuauSolverV2{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local function num(x: number) end local function num(x: number) end
@ -403,7 +403,7 @@ TEST_CASE_FIXTURE(Fixture, "lti_error_at_declaration_for_never_normalizations")
TEST_CASE_FIXTURE(Fixture, "lti_permit_explicit_never_annotation") TEST_CASE_FIXTURE(Fixture, "lti_permit_explicit_never_annotation")
{ {
ScopedFastFlag sff_DebugLuauDeferredConstraintResolution{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff_LuauSolverV2{FFlag::LuauSolverV2, true};
CheckResult result = check(R"( CheckResult result = check(R"(
local function num(x: number) end local function num(x: number) end

View File

@ -15,17 +15,17 @@
using namespace Luau; using namespace Luau;
using namespace Luau::TypePath; using namespace Luau::TypePath;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution); LUAU_FASTFLAG(LuauSolverV2);
LUAU_DYNAMIC_FASTINT(LuauTypePathMaximumTraverseSteps); LUAU_DYNAMIC_FASTINT(LuauTypePathMaximumTraverseSteps);
struct TypePathFixture : Fixture struct TypePathFixture : Fixture
{ {
ScopedFastFlag sff1{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff1{FFlag::LuauSolverV2, true};
}; };
struct TypePathBuiltinsFixture : BuiltinsFixture struct TypePathBuiltinsFixture : BuiltinsFixture
{ {
ScopedFastFlag sff1{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff1{FFlag::LuauSolverV2, true};
}; };
TEST_SUITE_BEGIN("TypePathManipulation"); TEST_SUITE_BEGIN("TypePathManipulation");
@ -522,7 +522,7 @@ TEST_SUITE_BEGIN("TypePathToString");
TEST_CASE("field") TEST_CASE("field")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
CHECK(toString(PathBuilder().prop("foo").build()) == R"(["foo"])"); CHECK(toString(PathBuilder().prop("foo").build()) == R"(["foo"])");
@ -551,7 +551,7 @@ TEST_CASE("empty_path")
TEST_CASE("prop") TEST_CASE("prop")
{ {
ScopedFastFlag sff[] = { ScopedFastFlag sff[] = {
{FFlag::DebugLuauDeferredConstraintResolution, false}, {FFlag::LuauSolverV2, false},
}; };
Path p = PathBuilder().prop("foo").build(); Path p = PathBuilder().prop("foo").build();
@ -592,7 +592,7 @@ TEST_CASE("fields")
TEST_CASE("chained") TEST_CASE("chained")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
CHECK( CHECK(
PathBuilder().index(0).readProp("foo").mt().readProp("bar").args().index(1).build() == PathBuilder().index(0).readProp("foo").mt().readProp("bar").args().index(1).build() ==

View File

@ -304,7 +304,7 @@ TEST_CASE_FIXTURE(Fixture, "substitution_skip_failure")
REQUIRE(!anyification.normalizationTooComplex); REQUIRE(!anyification.normalizationTooComplex);
REQUIRE(any.has_value()); REQUIRE(any.has_value());
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
CHECK_EQ("{ f: t1 } where t1 = () -> { f: () -> { f: ({ f: t1 }) -> (), signal: { f: (any) -> () } } }", toString(*any)); CHECK_EQ("{ f: t1 } where t1 = () -> { f: () -> { f: ({ f: t1 }) -> (), signal: { f: (any) -> () } } }", toString(*any));
else else
CHECK_EQ("{| f: t1 |} where t1 = () -> {| f: () -> {| f: ({| f: t1 |}) -> (), signal: {| f: (any) -> () |} |} |}", toString(*any)); CHECK_EQ("{| f: t1 |} where t1 = () -> {| f: () -> {| f: ({| f: t1 |}) -> (), signal: {| f: (any) -> () |} |} |}", toString(*any));

View File

@ -12,7 +12,7 @@
using namespace Luau; using namespace Luau;
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
struct Unifier2Fixture struct Unifier2Fixture
{ {
@ -23,7 +23,7 @@ struct Unifier2Fixture
Unifier2 u2{NotNull{&arena}, NotNull{&builtinTypes}, NotNull{&scope}, NotNull{&iceReporter}}; Unifier2 u2{NotNull{&arena}, NotNull{&builtinTypes}, NotNull{&scope}, NotNull{&iceReporter}};
ToStringOptions opts; ToStringOptions opts;
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
std::pair<TypeId, FreeType*> freshType() std::pair<TypeId, FreeType*> freshType()
{ {

View File

@ -9,13 +9,13 @@
using namespace Luau; using namespace Luau;
LUAU_FASTINT(LuauVisitRecursionLimit); LUAU_FASTINT(LuauVisitRecursionLimit);
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution) LUAU_FASTFLAG(LuauSolverV2)
TEST_SUITE_BEGIN("VisitType"); TEST_SUITE_BEGIN("VisitType");
TEST_CASE_FIXTURE(Fixture, "throw_when_limit_is_exceeded") TEST_CASE_FIXTURE(Fixture, "throw_when_limit_is_exceeded")
{ {
if (FFlag::DebugLuauDeferredConstraintResolution) if (FFlag::LuauSolverV2)
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
local t : {a: {b: {c: {d: {e: boolean}}}}} local t : {a: {b: {c: {d: {e: boolean}}}}}
@ -61,7 +61,7 @@ TEST_CASE_FIXTURE(Fixture, "some_free_types_do_not_have_bounds")
TEST_CASE_FIXTURE(Fixture, "some_free_types_have_bounds") TEST_CASE_FIXTURE(Fixture, "some_free_types_have_bounds")
{ {
ScopedFastFlag sff{FFlag::DebugLuauDeferredConstraintResolution, true}; ScopedFastFlag sff{FFlag::LuauSolverV2, true};
Scope scope{builtinTypes->anyTypePack}; Scope scope{builtinTypes->anyTypePack};
Type t{FreeType{&scope, builtinTypes->neverType, builtinTypes->numberType}}; Type t{FreeType{&scope, builtinTypes->neverType, builtinTypes->numberType}};

View File

@ -371,7 +371,7 @@ def luau_typepath_property_summary(valobj, internal_dict, options):
read_write = False read_write = False
try: try:
fflag_valobj = valobj.GetFrame().GetValueForVariablePath( fflag_valobj = valobj.GetFrame().GetValueForVariablePath(
"FFlag::DebugLuauDeferredConstraintResolution::value") "FFlag::LuauSolverV2::value")
read_write = fflag_valobj.GetValue() == "true" read_write = fflag_valobj.GetValue() == "true"
except Exception as e: except Exception as e:

View File

@ -136,7 +136,7 @@ def main():
failList = loadFailList() failList = loadFailList()
flags = ["true", "DebugLuauDeferredConstraintResolution"] flags = ["true", "LuauSolverV2"]
commandLine = [args.path, "--reporters=xml", "--fflags=" + ",".join(flags)] commandLine = [args.path, "--reporters=xml", "--fflags=" + ",".join(flags)]