nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3bff56e
)
typing: new warning useless-null-test that detect == and != between non-nullables...
author
Jean Privat
<jean@pryen.org>
Sat, 11 Oct 2014 16:31:00 +0000
(12:31 -0400)
committer
Jean Privat
<jean@pryen.org>
Sat, 11 Oct 2014 17:23:01 +0000
(13:23 -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
f254292
..
c581f47
100644
(file)
--- a/
src/semantize/typing.nit
+++ b/
src/semantize/typing.nit
@@
-206,7
+206,11
@@
private class TypeVisitor
if not mtype2 isa MNullType then return
+ # Check of useless null
if not mtype isa MNullableType then
+ if not anchor_to(mtype) isa MNullableType then
+ modelbuilder.warning(anode, "useless-null-test", "Warning: expression is not null, since it is a `{mtype}`.")
+ end
return
end