# Load compile time known super-types of a type
# supertypes are all known super classes at compile time and unresolved generic classes
fun load_supertypes(child: MClassType): Array[T] do
- var parents = interpreter.mainmodule.flatten_mclass_hierarchy[child.mclass].greaters
+ var parents = child.mclass.in_hierarchy(interpreter.mainmodule).greaters
var plist = new Array[T]
# load each parent
else if p.mtype.mclass == sup.mtype.mclass then
# found the same class (ie. p.mclass = B[B#0] = sup.mclass)
# compare formal types arguments
- for i in [0..p.mtype.as(MGenericType).arguments.length[ do
+ for i in [0..p.mtype.arguments.length[ do
# erase nullable annotation of p arg
- var sarg = p.mtype.as(MGenericType).arguments[i]
+ var sarg = p.mtype.arguments[i]
if sarg isa MNullableType then sarg = sarg.mtype
var sft = typing.load_type(sarg.as(MClassType))
# erase nullable annotation of super arg
- var suparg = sup.mtype.as(MGenericType).arguments[i]
+ var suparg = sup.mtype.arguments[i]
if suparg isa MNullableType then suparg = suparg.mtype
var pft = typing.load_type(suparg.as(MClassType))
if not sft.is_subtype_fallback(pft) then
for st in loaded_types.values do
if t.is_subtype_fallback(st) then
lin.add(st)
- t.nb_parents = interpreter.mainmodule.flatten_mclass_hierarchy[t.mtype.mclass].direct_greaters.length
+ t.nb_parents = t.mtype.mclass.in_hierarchy(interpreter.mainmodule).direct_greaters.length
if t != st then st.sub_types.add(t)
end
end