X-Git-Url: http://nitlanguage.org diff --git a/src/modelize/modelize_property.nit b/src/modelize/modelize_property.nit index c3c1ca0..c224b29 100644 --- a/src/modelize/modelize_property.nit +++ b/src/modelize/modelize_property.nit @@ -86,7 +86,8 @@ redef class ModelBuilder # Force building recursively if nclassdef.build_properties_is_done then return nclassdef.build_properties_is_done = true - var mclassdef = nclassdef.mclassdef.as(not null) + var mclassdef = nclassdef.mclassdef + if mclassdef == null then return # skip error if mclassdef.in_hierarchy == null then return # Skip error for superclassdef in mclassdef.in_hierarchy.direct_greaters do if not mclassdef2nclassdef.has_key(superclassdef) then continue @@ -314,6 +315,7 @@ redef class ModelBuilder for p in spd.initializers do if p != longest.initializers[i] then self.error(nclassdef, "Error: conflict for inherited inits {spd}({spd.initializers.join(", ")}) and {longest}({longest.initializers.join(", ")})") + # TODO: invalidate the initializer to avoid more errors return end i += 1 @@ -368,7 +370,7 @@ redef class ModelBuilder # It is a case-by case var vis_type: nullable MVisibility = null # The own visibility of the type var mmodule_type: nullable MModule = null # The original module of the type - mtype = mtype.as_notnullable + mtype = mtype.undecorate if mtype isa MClassType then vis_type = mtype.mclass.visibility mmodule_type = mtype.mclass.intro.mmodule @@ -984,6 +986,7 @@ redef class AMethPropdef var ret_type = mysignature.return_mtype if ret_type != null and precursor_ret_type == null then modelbuilder.error(nsig.n_type.as(not null), "Redef Error: {mpropdef.mproperty} is a procedure, not a function.") + self.mpropdef.msignature = null return end @@ -995,6 +998,7 @@ redef class AMethPropdef var node = nsig.n_params[i] if not modelbuilder.check_sametype(node, mmodule, mclassdef.bound_mtype, myt, prt) then modelbuilder.error(node, "Redef Error: Wrong type for parameter `{mysignature.mparameters[i].name}'. found {myt}, expected {prt} as in {mpropdef.mproperty.intro}.") + self.mpropdef.msignature = null end end end @@ -1007,6 +1011,7 @@ redef class AMethPropdef ret_type = precursor_ret_type else if not modelbuilder.check_subtype(node, mmodule, mclassdef.bound_mtype, ret_type, precursor_ret_type) then modelbuilder.error(node, "Redef Error: Wrong return type. found {ret_type}, expected {precursor_ret_type} as in {mpropdef.mproperty.intro}.") + self.mpropdef.msignature = null end end end @@ -1122,6 +1127,7 @@ redef class AAttrPropdef else if atautoinit != null then modelbuilder.error(atautoinit, "Error: a autoinit attribute needs a value") end + has_value = true return end is_lazy = true