Use new fflag in getMetatable helper

This commit is contained in:
AmberGraceSoftware 2023-08-11 21:18:44 -06:00
parent 3e727e3b1e
commit 639b16543e

View file

@ -27,6 +27,7 @@ LUAU_FASTINT(LuauTypeInferRecursionLimit)
LUAU_FASTFLAG(LuauInstantiateInSubtyping) LUAU_FASTFLAG(LuauInstantiateInSubtyping)
LUAU_FASTFLAG(LuauNormalizeBlockedTypes) LUAU_FASTFLAG(LuauNormalizeBlockedTypes)
LUAU_FASTFLAG(DebugLuauReadWriteProperties) LUAU_FASTFLAG(DebugLuauReadWriteProperties)
LUAU_FASTFLAG(LuauIntersectedBinopOverloadFix)
namespace Luau namespace Luau
{ {
@ -263,6 +264,8 @@ std::optional<TypeId> getMetatable(TypeId type, NotNull<BuiltinTypes> builtinTyp
{ {
type = follow(type); type = follow(type);
if (FFlag::LuauIntersectedBinopOverloadFix)
{
if (const IntersectionType* itv = get<IntersectionType>(type)) if (const IntersectionType* itv = get<IntersectionType>(type))
{ {
for (TypeId part : itv->parts) for (TypeId part : itv->parts)
@ -273,6 +276,7 @@ std::optional<TypeId> getMetatable(TypeId type, NotNull<BuiltinTypes> builtinTyp
} }
return std::nullopt; return std::nullopt;
} }
}
if (const MetatableType* mtType = get<MetatableType>(type)) if (const MetatableType* mtType = get<MetatableType>(type))
return mtType->metatable; return mtType->metatable;