From: Jean Privat Date: Thu, 18 Jun 2015 01:51:44 +0000 (-0400) Subject: typing: warn about useless null when the target is always `null` X-Git-Tag: v0.7.6~21^2~2 X-Git-Url: http://nitlanguage.org typing: warn about useless null when the target is always `null` Signed-off-by: Jean Privat --- diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index f231d4b..86e5bcb 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -217,6 +217,10 @@ private class TypeVisitor # Else return true. fun check_can_be_null(anode: ANode, mtype: MType): Bool do + if mtype isa MNullType then + modelbuilder.warning(anode, "useless-null-test", "Warning: expression is always `null`.") + return true + end if can_be_null(mtype) then return true if mtype isa MFormalType then