Merge: subset: Add grammar and kind
[nit.git] / src / modelize / modelize_class.nit
index 03e5899..853d8ff 100644 (file)
@@ -291,7 +291,7 @@ redef class ModelBuilder
                                                ntype, false)
                                if mtype == null then continue # Skip because of error
                                if not mtype isa MClassType then
-                                       error(ntype, "Error: supertypes cannot be a formal type.")
+                                       error(ntype, "Error: a supertype cannot be a formal type.")
                                        continue
                                end
                                var superclass = mtype.mclass
@@ -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
@@ -535,6 +538,9 @@ end
 redef class AExternClasskind
        redef fun mkind do return extern_kind
 end
+redef class ASubsetClasskind
+       redef fun mkind do return subset_kind
+end
 
 redef class AFormaldef
        # The associated parameter type