nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ebc8067
)
typing: warn about useless null when the target is always `null`
author
Jean Privat
<jean@pryen.org>
Thu, 18 Jun 2015 01:51:44 +0000
(21:51 -0400)
committer
Jean Privat
<jean@pryen.org>
Thu, 18 Jun 2015 03:09:10 +0000
(23:09 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>
src/semantize/typing.nit
patch
|
blob
|
history
diff --git
a/src/semantize/typing.nit
b/src/semantize/typing.nit
index
f231d4b
..
86e5bcb
100644
(file)
--- 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