From 47f81aa448ddaf608e0d121c2bb08ad6b8cbbc46 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Sun, 12 Apr 2015 00:09:04 +0700 Subject: [PATCH] typing: handle `a == null` when `a` is null Signed-off-by: Jean Privat --- src/semantize/typing.nit | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index ee93c2e..6727d02 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -239,12 +239,16 @@ private class TypeVisitor if not mtype2 isa MNullType then return - if mtype isa MNullType then return - # Check of useless null if not check_can_be_null(anode.n_expr, mtype) then return - mtype = mtype.as_notnull + if mtype isa MNullType then + # Because of type adaptation, we cannot just stop here + # so return use `null` as a bottom type that will be merged easily (cf) `merge_types` + mtype = null + else + mtype = mtype.as_notnull + end # Check for type adaptation var variable = anode.n_expr.its_variable -- 1.7.9.5