Example
var x: nullable T
var y = x.as(T) # Bad form
var y = x.as(not null) # Good form
if x isa T then ... # Bad form
if x != null then ... # Good form
Signed-off-by: Jean Privat <jean@pryen.org>
v.warning(self, "Warning: Expression is already a {ttype}.")
else if etype < ttype then
v.warning(self, "Warning: Expression is already a {ttype} since it is a {etype}.")
+ else if etype.is_nullable and etype.as_notnull == ttype then
+ if self isa AIsaExpr then
+ v.warning(self, "Warning: Prefer '!= null'.")
+ else
+ v.warning(self, "Warning: Prefer '.as(not null)'.")
+ end
end
end
end