if sup == sub then
self.modelbuilder.warning(node, "Warning: Expression is already a {sup}.")
- else if self.is_subtype(sub, sup) and not sup.need_anchor then
+ else if self.is_subtype(sub, sup) then
self.modelbuilder.warning(node, "Warning: Expression is already a {sup} since it is a {sub}.")
end
return sup
assert mproperty isa MMethod
- if is_toplevel_context and recv_is_self and not mproperty.is_toplevel and name != "sys" and name != "exit" and name != "args" then
- # FIXME named methods are here as a workaround
+ if is_toplevel_context and recv_is_self and not mproperty.is_toplevel then
error(node, "Error: '{name}' is not a top-level method, thus need a receiver.")
end
if not recv_is_self and mproperty.is_toplevel then
var erasure_cast = false
var rettype = mpropdef.msignature.return_mtype
if not recv_is_self and rettype != null then
- if rettype isa MNullableType then rettype = rettype.mtype
+ rettype = rettype.as_notnullable
if rettype isa MParameterType then
var erased_rettype = msignature.return_mtype
assert erased_rettype != null
# anchor formal and virtual types
if mtype.need_anchor then mtype = v.anchor_to(mtype)
- if mtype isa MNullableType then mtype = mtype.mtype
+ mtype = mtype.as_notnullable
self.coltype = mtype.as(MClassType)
# get methods is_ok, next, item
return # Skip error
end
- if t1 isa MNullableType then
- t1 = t1.mtype
- end
+ t1 = t1.as_notnullable
var t = v.merge_types(self, [t1, t2])
if t == null then