# The result is returned exactly as declared in the "type" property (verbatim).
# So it could be another formal type.
#
- # In case of conflict, the method aborts.
+ # In case of conflicts or inconsistencies in the model, the method returns a `MBottomType`.
fun lookup_bound(mmodule: MModule, resolved_receiver: MType): MType do return self
# Resolve the formal type to its simplest equivalent form.
#
# By default, return self.
# See the redefinitions for specific behavior in each kind of type.
+ #
+ # In case of conflicts or inconsistencies in the model, the method returns a `MBottomType`.
fun lookup_fixed(mmodule: MModule, resolved_receiver: MType): MType do return self
# Can the type be resolved?
redef fun lookup_bound(mmodule: MModule, resolved_receiver: MType): MType
do
- return lookup_single_definition(mmodule, resolved_receiver).bound.as(not null)
+ return lookup_single_definition(mmodule, resolved_receiver).bound or else new MBottomType(model)
end
private fun lookup_single_definition(mmodule: MModule, resolved_receiver: MType): MVirtualTypeDef
assert resolved_receiver isa MClassType # It is the only remaining type
var prop = lookup_single_definition(mmodule, resolved_receiver)
- var res = prop.bound.as(not null)
+ var res = prop.bound
+ if res == null then return new MBottomType(model)
# Recursively lookup the fixed result
res = res.lookup_fixed(mmodule, resolved_receiver)