src: introduce new constructors
[nit.git] / src / modelize_class.nit
index 09b7081..ff0295f 100644 (file)
@@ -154,6 +154,9 @@ redef class ModelBuilder
                                                bounds.add(bound)
                                                nfd.bound = bound
                                        end
+                                       if bound isa MClassType and bound.mclass.kind == enum_kind then
+                                               warning(nfdt, "Warning: Useless formal parameter type since `{bound}` cannnot have subclasses.")
+                                       end
                                else if mclass.mclassdefs.is_empty then
                                        # No bound, then implicitely bound by nullable Object
                                        var bound = objectclass.mclass_type.as_nullable
@@ -380,7 +383,10 @@ redef class ModelBuilder
                                assert mtype isa MClassType
                                var sc = mtype.mclass
                                if not parents.has(sc) or sc == objectclass then
-                                       warning(ntype, "Warning: superfluous super-class {mtype} in class {mclassdef.mclass}.")
+                                       # Skip the warning on generated code
+                                       if ntype.location.file != null and not ntype.location.file.filename.is_empty then
+                                               warning(ntype, "Warning: superfluous super-class {mtype} in class {mclassdef.mclass}.")
+                                       end
                                else if not seen_parents.has_key(sc) then
                                        seen_parents[sc] = ntype
                                else