X-Git-Url: http://nitlanguage.org diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index e283b43..8fb3852 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -267,7 +267,7 @@ private class TypeVisitor #debug("recv: {recvtype} (aka {unsafe_type})") if recvtype isa MNullType then # `null` only accepts some methods of object. - if name == "==" or name == "!=" then + if name == "==" or name == "!=" or name == "is_same_instance" then unsafe_type = mmodule.object_type.as_nullable else self.error(node, "Error: Method '{name}' call on 'null'.") @@ -975,7 +975,7 @@ redef class AForExpr is_col = true end - if mapit_cla != null and v.is_subtype(ittype, mapit_cla.get_mtype([objcla.mclass_type, objcla.mclass_type.as_nullable])) then + if mapit_cla != null and v.is_subtype(ittype, mapit_cla.get_mtype([objcla.mclass_type.as_nullable, objcla.mclass_type.as_nullable])) then # Map Iterator var coltype = ittype.supertype_to(v.mmodule, v.anchor, mapit_cla) var variables = self.variables @@ -1243,7 +1243,7 @@ redef class AArrayExpr if mtype == null then mtype = v.merge_types(self, mtypes) end - if mtype == null then + if mtype == null or mtype isa MNullType then v.error(self, "Type Error: ambiguous array type {mtypes.join(" ")}") return end