modelize_property: do not crash if mtype is null in check_visibility
[nit.git] / src / modelize_property.nit
index 5b306f9..159523b 100644 (file)
@@ -205,7 +205,11 @@ redef class ModelBuilder
 
                # No error, try to go deeper in generic types
                if node isa AType then
-                       for a in node.n_types do check_visibility(a, a.mtype.as(not null), mpropdef)
+                       for a in node.n_types do
+                               var t = a.mtype
+                               if t == null then continue # Error, thus skipped
+                               check_visibility(a, t, mpropdef)
+                       end
                else if mtype isa MGenericType then
                        for t in mtype.arguments do check_visibility(node, t, mpropdef)
                end
@@ -881,7 +885,7 @@ redef class AAttrPropdef
                                for i in [0..mysignature.arity[ do
                                        var myt = mysignature.mparameters[i].mtype
                                        var prt = msignature.mparameters[i].mtype
-                                       if not myt.is_subtype(mmodule, mclassdef.bound_mtype, prt) and
+                                       if not myt.is_subtype(mmodule, mclassdef.bound_mtype, prt) or
                                                        not prt.is_subtype(mmodule, mclassdef.bound_mtype, myt) then
                                                var node: ANode
                                                if nsig != null then node = nsig else node = self