modelize_classes: warn on parameter types bounded on final classes
authorJean Privat <jean@pryen.org>
Thu, 24 Jul 2014 18:07:46 +0000 (14:07 -0400)
committerJean Privat <jean@pryen.org>
Thu, 24 Jul 2014 18:37:23 +0000 (14:37 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/modelize_class.nit

index 09b7081..b00508b 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