|
10 | 10 | #include "Luau/DenseHash.h" |
11 | 11 | #include "Luau/Error.h" |
12 | 12 | #include "Luau/Frontend.h" |
13 | | -#include "Luau/InferPolarity.h" |
14 | 13 | #include "Luau/Module.h" |
15 | 14 | #include "Luau/NotNull.h" |
16 | 15 | #include "Luau/Subtyping.h" |
|
34 | 33 | LUAU_FASTFLAG(LuauSolverV2) |
35 | 34 | LUAU_FASTFLAGVARIABLE(LuauTableCloneClonesType4) |
36 | 35 | LUAU_FASTFLAGVARIABLE(LuauCloneForIntersectionsUnions) |
37 | | -LUAU_FASTFLAG(LuauStorePolarityInline) |
38 | 36 | LUAU_FASTFLAGVARIABLE(LuauTableFreezeCheckIsSubtype) |
39 | 37 | LUAU_FASTFLAG(LuauAnalysisUsesSolverMode) |
| 38 | +LUAU_FASTFLAGVARIABLE(LuauSilenceDynamicFormatStringErrors) |
40 | 39 |
|
41 | 40 | namespace Luau |
42 | 41 | { |
@@ -297,8 +296,6 @@ void addGlobalBinding(GlobalTypes& globals, const ScopePtr& scope, const std::st |
297 | 296 |
|
298 | 297 | void addGlobalBinding(GlobalTypes& globals, const ScopePtr& scope, const std::string& name, Binding binding) |
299 | 298 | { |
300 | | - if (!FFlag::LuauStorePolarityInline) |
301 | | - inferGenericPolarities_DEPRECATED(NotNull{&globals.globalTypes}, NotNull{scope.get()}, binding.typeId); |
302 | 299 | scope->bindings[globals.globalNames.names->getOrAdd(name.c_str())] = binding; |
303 | 300 | } |
304 | 301 |
|
@@ -372,10 +369,8 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC |
372 | 369 | ); |
373 | 370 | LUAU_ASSERT(loadResult.success); |
374 | 371 |
|
375 | | - TypeId genericK = |
376 | | - FFlag::LuauStorePolarityInline ? arena.addType(GenericType{globalScope, "K", Polarity::Mixed}) : arena.addType(GenericType{globalScope, "K"}); |
377 | | - TypeId genericV = |
378 | | - FFlag::LuauStorePolarityInline ? arena.addType(GenericType{globalScope, "V", Polarity::Mixed}) : arena.addType(GenericType{globalScope, "V"}); |
| 372 | + TypeId genericK = arena.addType(GenericType{globalScope, "K", Polarity::Mixed}); |
| 373 | + TypeId genericV = arena.addType(GenericType{globalScope, "V", Polarity::Mixed}); |
379 | 374 | TypeId mapOfKtoV = arena.addType(TableType{{}, TableIndexer(genericK, genericV), globals.globalScope->level, TableState::Generic}); |
380 | 375 |
|
381 | 376 | std::optional<TypeId> stringMetatableTy = getMetatable(builtinTypes->stringType, builtinTypes); |
@@ -424,16 +419,14 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC |
424 | 419 | // pairs<K, V>(t: Table<K, V>) -> ((Table<K, V>, K?) -> (K, V), Table<K, V>, nil) |
425 | 420 | addGlobalBinding(globals, "pairs", arena.addType(FunctionType{{genericK, genericV}, {}, pairsArgsTypePack, pairsReturnTypePack}), "@luau"); |
426 | 421 |
|
427 | | - TypeId genericMT = FFlag::LuauStorePolarityInline ? arena.addType(GenericType{globalScope, "MT", Polarity::Mixed}) |
428 | | - : arena.addType(GenericType{globalScope, "MT"}); |
| 422 | + TypeId genericMT = arena.addType(GenericType{globalScope, "MT", Polarity::Mixed}); |
429 | 423 |
|
430 | 424 | TableType tab{TableState::Generic, globals.globalScope->level}; |
431 | 425 | TypeId tabTy = arena.addType(std::move(tab)); |
432 | 426 |
|
433 | 427 | TypeId tableMetaMT = arena.addType(MetatableType{tabTy, genericMT}); |
434 | 428 |
|
435 | | - TypeId genericT = |
436 | | - FFlag::LuauStorePolarityInline ? arena.addType(GenericType{globalScope, "T", Polarity::Mixed}) : arena.addType(GenericType{globalScope, "T"}); |
| 429 | + TypeId genericT = arena.addType(GenericType{globalScope, "T", Polarity::Mixed}); |
437 | 430 |
|
438 | 431 | if (frontend.getLuauSolverMode() == SolverMode::New) |
439 | 432 | { |
@@ -479,8 +472,7 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC |
479 | 472 | if (frontend.getLuauSolverMode() == SolverMode::New) |
480 | 473 | { |
481 | 474 | // declare function assert<T>(value: T, errorMessage: string?): intersect<T, ~(false?)> |
482 | | - TypeId genericT = FFlag::LuauStorePolarityInline ? arena.addType(GenericType{globalScope, "T", Polarity::Mixed}) |
483 | | - : arena.addType(GenericType{globalScope, "T"}); |
| 475 | + TypeId genericT = arena.addType(GenericType{globalScope, "T", Polarity::Mixed}); |
484 | 476 |
|
485 | 477 | TypeId refinedTy = arena.addType( |
486 | 478 | TypeFunctionInstanceType{ |
@@ -508,20 +500,13 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC |
508 | 500 | // the top table type. We do the best we can by modelling these |
509 | 501 | // functions using unconstrained generics. It's not quite right, |
510 | 502 | // but it'll be ok for now. |
511 | | - TypeId genericTy = FFlag::LuauStorePolarityInline ? arena.addType(GenericType{globalScope, "T", Polarity::Mixed}) |
512 | | - : arena.addType(GenericType{globalScope, "T"}); |
| 503 | + TypeId genericTy = arena.addType(GenericType{globalScope, "T", Polarity::Mixed}); |
513 | 504 | TypePackId thePack = arena.addTypePack({genericTy}); |
514 | 505 | TypeId idTyWithMagic = arena.addType(FunctionType{{genericTy}, {}, thePack, thePack}); |
515 | 506 | ttv->props["freeze"] = makeProperty(idTyWithMagic, "@luau/global/table.freeze"); |
516 | 507 |
|
517 | | - if (!FFlag::LuauStorePolarityInline) |
518 | | - inferGenericPolarities_DEPRECATED(NotNull{&globals.globalTypes}, NotNull{globalScope}, idTyWithMagic); |
519 | | - |
520 | 508 | TypeId idTy = arena.addType(FunctionType{{genericTy}, {}, thePack, thePack}); |
521 | 509 |
|
522 | | - if (!FFlag::LuauStorePolarityInline) |
523 | | - inferGenericPolarities_DEPRECATED(NotNull{&globals.globalTypes}, NotNull{globalScope}, idTy); |
524 | | - |
525 | 510 | ttv->props["clone"] = makeProperty(idTy, "@luau/global/table.clone"); |
526 | 511 | } |
527 | 512 | else |
@@ -773,10 +758,18 @@ bool MagicFormat::typeCheck(const MagicFunctionTypeCheckContext& context) |
773 | 758 | formatString = {stringSingleton->value}; |
774 | 759 | } |
775 | 760 |
|
776 | | - if (!formatString) |
| 761 | + if (FFlag::LuauSilenceDynamicFormatStringErrors) |
777 | 762 | { |
778 | | - context.typechecker->reportError(CannotCheckDynamicStringFormatCalls{}, context.callSite->location); |
779 | | - return true; |
| 763 | + if (!formatString) |
| 764 | + return true; |
| 765 | + } |
| 766 | + else |
| 767 | + { |
| 768 | + if (!formatString) |
| 769 | + { |
| 770 | + context.typechecker->reportError(CannotCheckDynamicStringFormatCalls{}, context.callSite->location); |
| 771 | + return true; |
| 772 | + } |
780 | 773 | } |
781 | 774 |
|
782 | 775 | // CLI-150726: The block below effectively constructs a type pack and then type checks it by going parameter-by-parameter. |
|
0 commit comments