typing: `or else` on null is no more an error
authorJean Privat <jean@pryen.org>
Thu, 18 Jun 2015 01:14:51 +0000 (21:14 -0400)
committerJean Privat <jean@pryen.org>
Thu, 18 Jun 2015 01:14:51 +0000 (21:14 -0400)
A warning at most

Signed-off-by: Jean Privat <jean@pryen.org>

src/semantize/typing.nit

index b37e4a4..9724537 100644 (file)
@@ -1304,7 +1304,8 @@ redef class AOrElseExpr
                end
 
                if t1 isa MNullType then
-                       v.error(n_expr, "Type Error: `or else` on `null`.")
+                       self.mtype = t2
+                       return
                else if v.check_can_be_null(n_expr, t1) then
                        t1 = t1.as_notnull
                end