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,15 +264,18 @@ std::optional<TypeId> getMetatable(TypeId type, NotNull<BuiltinTypes> builtinTyp
{ {
type = follow(type); type = follow(type);
if (const IntersectionType* itv = get<IntersectionType>(type)) if (FFlag::LuauIntersectedBinopOverloadFix)
{ {
for (TypeId part : itv->parts) if (const IntersectionType* itv = get<IntersectionType>(type))
{ {
auto partMT = getMetatable(part, builtinTypes); for (TypeId part : itv->parts)
if (partMT != std::nullopt) {
return partMT; auto partMT = getMetatable(part, builtinTypes);
if (partMT != std::nullopt)
return partMT;
}
return std::nullopt;
} }
return std::nullopt;
} }
if (const MetatableType* mtType = get<MetatableType>(type)) if (const MetatableType* mtType = get<MetatableType>(type))