modelize: do not crash if not object class to implicitly bound formal parameter
authorJean Privat <jean@pryen.org>
Fri, 28 Nov 2014 13:34:09 +0000 (08:34 -0500)
committerJean Privat <jean@pryen.org>
Fri, 28 Nov 2014 13:34:09 +0000 (08:34 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/modelize/modelize_class.nit

index 441a6c2..79cab6e 100644 (file)
@@ -168,6 +168,10 @@ redef class ModelBuilder
                                                warning(nfdt, "useless-bound", "Warning: Useless formal parameter type since `{bound}` cannnot have subclasses.")
                                        end
                                else if mclass.mclassdefs.is_empty then
+                                       if objectclass == null then
+                                               error(nfd, "Error: Formal parameter type `{pname}' unbounded but no Object class exist.")
+                                               return
+                                       end
                                        # No bound, then implicitely bound by nullable Object
                                        var bound = objectclass.mclass_type.as_nullable
                                        bounds.add(bound)