diff --git a/Analysis/src/Type.cpp b/Analysis/src/Type.cpp index fb72bc12..89c0c428 100644 --- a/Analysis/src/Type.cpp +++ b/Analysis/src/Type.cpp @@ -263,6 +263,17 @@ std::optional getMetatable(TypeId type, NotNull builtinTyp { type = follow(type); + if (const IntersectionType* itv = get(type)) + { + for (TypeId part : itv->parts) + { + auto partMT = getMetatable(part, builtinTypes); + if (partMT != std::nullopt) + return partMT; + } + return std::nullopt; + } + if (const MetatableType* mtType = get(type)) return mtType->metatable; else if (const ClassType* classType = get(type))