model: register the implicitly injected Bool class in its hierarchy.
authorJean Privat <jean@pryen.org>
Wed, 10 Dec 2014 19:45:35 +0000 (14:45 -0500)
committerJean Privat <jean@pryen.org>
Fri, 12 Dec 2014 04:23:57 +0000 (23:23 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/model/model.nit

index 899f023..9c7a877 100644 (file)
@@ -251,9 +251,13 @@ redef class MModule
        do
                var cla = self.model.get_mclasses_by_name(name)
                if cla == null then
-                       if name == "Bool" then
+                       if name == "Bool" and self.model.get_mclasses_by_name("Object") != null then
+                               # Bool is injected because it is needed by engine to code the result
+                               # of the implicit casts.
                                var c = new MClass(self, name, null, enum_kind, public_visibility)
                                var cladef = new MClassDef(self, c.mclass_type, new Location(null, 0,0,0,0))
+                               cladef.set_supertypes([object_type])
+                               cladef.add_in_hierarchy
                                return c
                        end
                        print("Fatal Error: no primitive class {name}")