modelize_property: use bottom type to mark invalid VT bounds
authorJean Privat <jean@pryen.org>
Wed, 28 Oct 2015 16:01:35 +0000 (12:01 -0400)
committerJean Privat <jean@pryen.org>
Thu, 29 Oct 2015 12:36:27 +0000 (08:36 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/modelize/modelize_property.nit

index 0161ad0..b0c0f60 100644 (file)
@@ -111,7 +111,7 @@ redef class ModelBuilder
                                if not check_virtual_types_circularity(npropdef, mpropdef.mproperty, mclassdef.bound_mtype, mclassdef.mmodule) then
                                        # Invalidate the bound
                                        mpropdef.is_broken = true
-                                       mpropdef.bound = mclassdef.mmodule.model.null_type
+                                       mpropdef.bound = new MBottomType(mclassdef.mmodule.model)
                                end
                        end
                        for npropdef in nclassdef2.n_propdefs do
@@ -386,6 +386,8 @@ redef class ModelBuilder
                        # nothing, always visible
                else if mtype isa MNullType then
                        # nothing to do.
+               else if mtype isa MBottomType then
+                       # nothing to do.
                else
                        node.debug "Unexpected type {mtype}"
                        abort
@@ -1643,7 +1645,7 @@ redef class ATypePropdef
                # Check redefinitions
                for p in mpropdef.mproperty.lookup_super_definitions(mmodule, anchor) do
                        var supbound = p.bound
-                       if supbound == null then break # broken super bound, skip error
+                       if supbound == null or supbound isa MBottomType or p.is_broken then break # broken super bound, skip error
                        if p.is_fixed then
                                modelbuilder.error(self, "Redef Error: virtual type `{mpropdef.mproperty}` is fixed in super-class `{p.mclassdef.mclass}`.")
                                break