From 65b2a98cf123bf4c49a7939241ee3c5fc9c90cb0 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 27 May 2015 19:25:15 -0400 Subject: [PATCH] typing: advice if a receiver is nullable Signed-off-by: Jean Privat --- src/semantize/typing.nit | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index ada6160..10edaf1 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -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 -- 1.7.9.5