30
30
31
31
LUAU_FASTFLAG (LuauSolverV2)
32
32
LUAU_FASTFLAGVARIABLE(LuauStringFormatErrorSuppression)
33
- LUAU_FASTFLAG(AutocompleteRequirePathSuggestions2)
34
33
LUAU_FASTFLAGVARIABLE(LuauTableCloneClonesType3)
35
34
LUAU_FASTFLAG(LuauTrackInteriorFreeTypesOnScope)
36
35
LUAU_FASTFLAGVARIABLE(LuauFreezeIgnorePersistent)
@@ -41,68 +40,79 @@ namespace Luau
41
40
42
41
struct MagicSelect final : MagicFunction
43
42
{
44
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
43
+ std::optional<WithPredicate<TypePackId>>
44
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
45
45
bool infer (const MagicFunctionCallContext& ctx) override ;
46
46
};
47
47
48
48
struct MagicSetMetatable final : MagicFunction
49
49
{
50
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
50
+ std::optional<WithPredicate<TypePackId>>
51
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
51
52
bool infer (const MagicFunctionCallContext& ctx) override ;
52
53
};
53
54
54
55
struct MagicAssert final : MagicFunction
55
56
{
56
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
57
+ std::optional<WithPredicate<TypePackId>>
58
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
57
59
bool infer (const MagicFunctionCallContext& ctx) override ;
58
60
};
59
61
60
62
struct MagicPack final : MagicFunction
61
63
{
62
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
64
+ std::optional<WithPredicate<TypePackId>>
65
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
63
66
bool infer (const MagicFunctionCallContext& ctx) override ;
64
67
};
65
68
66
69
struct MagicRequire final : MagicFunction
67
70
{
68
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
71
+ std::optional<WithPredicate<TypePackId>>
72
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
69
73
bool infer (const MagicFunctionCallContext& ctx) override ;
70
74
};
71
75
72
76
struct MagicClone final : MagicFunction
73
77
{
74
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
78
+ std::optional<WithPredicate<TypePackId>>
79
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
75
80
bool infer (const MagicFunctionCallContext& ctx) override ;
76
81
};
77
82
78
83
struct MagicFreeze final : MagicFunction
79
84
{
80
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
85
+ std::optional<WithPredicate<TypePackId>>
86
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
81
87
bool infer (const MagicFunctionCallContext& ctx) override ;
82
88
};
83
89
84
90
struct MagicFormat final : MagicFunction
85
91
{
86
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
92
+ std::optional<WithPredicate<TypePackId>>
93
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
87
94
bool infer (const MagicFunctionCallContext& ctx) override ;
88
95
bool typeCheck (const MagicFunctionTypeCheckContext& ctx) override ;
89
96
};
90
97
91
98
struct MagicMatch final : MagicFunction
92
99
{
93
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
100
+ std::optional<WithPredicate<TypePackId>>
101
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
94
102
bool infer (const MagicFunctionCallContext& ctx) override ;
95
103
};
96
104
97
105
struct MagicGmatch final : MagicFunction
98
106
{
99
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
107
+ std::optional<WithPredicate<TypePackId>>
108
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
100
109
bool infer (const MagicFunctionCallContext& ctx) override ;
101
110
};
102
111
103
112
struct MagicFind final : MagicFunction
104
113
{
105
- std::optional<WithPredicate<TypePackId>> handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
114
+ std::optional<WithPredicate<TypePackId>>
115
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>) override ;
106
116
bool infer (const MagicFunctionCallContext& ctx) override ;
107
117
};
108
118
@@ -454,16 +464,9 @@ void registerBuiltinGlobals(Frontend& frontend, GlobalTypes& globals, bool typeC
454
464
attachMagicFunction (ttv->props [" freeze" ].type (), std::make_shared<MagicFreeze>());
455
465
}
456
466
457
- if (FFlag::AutocompleteRequirePathSuggestions2)
458
- {
459
- TypeId requireTy = getGlobalBinding (globals, " require" );
460
- attachTag (requireTy, kRequireTagName );
461
- attachMagicFunction (requireTy, std::make_shared<MagicRequire>());
462
- }
463
- else
464
- {
465
- attachMagicFunction (getGlobalBinding (globals, " require" ), std::make_shared<MagicRequire>());
466
- }
467
+ TypeId requireTy = getGlobalBinding (globals, " require" );
468
+ attachTag (requireTy, kRequireTagName );
469
+ attachMagicFunction (requireTy, std::make_shared<MagicRequire>());
467
470
}
468
471
469
472
static std::vector<TypeId> parseFormatString (NotNull<BuiltinTypes> builtinTypes, const char * data, size_t size)
@@ -637,15 +640,15 @@ bool MagicFormat::typeCheck(const MagicFunctionTypeCheckContext& context)
637
640
{
638
641
switch (shouldSuppressErrors (NotNull{&context.typechecker ->normalizer }, actualTy))
639
642
{
640
- case ErrorSuppression::Suppress:
641
- break ;
642
- case ErrorSuppression::NormalizationFailed:
643
- break ;
644
- case ErrorSuppression::DoNotSuppress:
645
- Reasonings reasonings = context.typechecker ->explainReasonings (actualTy, expectedTy, location, result);
646
-
647
- if (!reasonings.suppressed )
648
- context.typechecker ->reportError (TypeMismatch{expectedTy, actualTy, reasonings.toString ()}, location);
643
+ case ErrorSuppression::Suppress:
644
+ break ;
645
+ case ErrorSuppression::NormalizationFailed:
646
+ break ;
647
+ case ErrorSuppression::DoNotSuppress:
648
+ Reasonings reasonings = context.typechecker ->explainReasonings (actualTy, expectedTy, location, result);
649
+
650
+ if (!reasonings.suppressed )
651
+ context.typechecker ->reportError (TypeMismatch{expectedTy, actualTy, reasonings.toString ()}, location);
649
652
}
650
653
}
651
654
else
@@ -1503,7 +1506,8 @@ static std::optional<TypeId> freezeTable(TypeId inputType, const MagicFunctionCa
1503
1506
return std::nullopt;
1504
1507
}
1505
1508
1506
- std::optional<WithPredicate<TypePackId>> MagicFreeze::handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope > &, const class AstExprCall &, WithPredicate<TypePackId>)
1509
+ std::optional<WithPredicate<TypePackId>> MagicFreeze::
1510
+ handleOldSolver (struct TypeChecker &, const std::shared_ptr<struct Scope >&, const class AstExprCall &, WithPredicate<TypePackId>)
1507
1511
{
1508
1512
return std::nullopt;
1509
1513
}
0 commit comments