Merge: Fix reading from Sockets
[nit.git] / src / semantize / typing.nit
index ada6160..44ed320 100644 (file)
@@ -329,6 +329,8 @@ private class TypeVisitor
                if recvtype isa MNullType and not mproperty.is_null_safe then
                        self.error(node, "Error: method `{name}` called on `null`.")
                        return null
+               else if unsafe_type isa MNullableType and not mproperty.is_null_safe then
+                       modelbuilder.advice(node, "call-on-nullable", "Warning: method call on a nullable receiver `{recvtype}`.")
                end
 
                if is_toplevel_context and recv_is_self and not mproperty.is_toplevel then
@@ -1342,6 +1344,15 @@ redef class AIntExpr
        end
 end
 
+redef class AByteExpr
+       redef fun accept_typing(v)
+       do
+               var mclass = v.get_mclass(self, "Byte")
+               if mclass == null then return # Forward error
+               self.mtype = mclass.mclass_type
+       end
+end
+
 redef class AFloatExpr
        redef fun accept_typing(v)
        do