modelize_class: Don’t crash on a formal supertype
authorJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Tue, 13 Jun 2017 00:28:18 +0000 (20:28 -0400)
committerJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Tue, 13 Jun 2017 00:28:18 +0000 (20:28 -0400)
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

src/modelize/modelize_class.nit

index 03e5899..fc3b254 100644 (file)
@@ -470,8 +470,11 @@ redef class ModelBuilder
                        for nsc in nclassdef.n_superclasses do
                                var ntype = nsc.n_type
                                var mtype = ntype.mtype
-                               if mtype == null then continue
-                               assert mtype isa MClassType
+
+                               # If the supertype is `null` or don’t refer to a class, we
+                               # already raised an error.
+                               if not mtype isa MClassType then continue
+
                                var sc = mtype.mclass
                                if not parents.has(sc) or sc == objectclass then
                                        # Skip the warning on generated code