From a64d208136b2bdb22a4624b57a707c10ef8d617c Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 19 Jun 2012 16:52:49 -0400 Subject: [PATCH] nitg: autoadapt can combine nullable Signed-off-by: Jean Privat --- src/global_compiler.nit | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/global_compiler.nit b/src/global_compiler.nit index 84afd10..c0c640a 100644 --- a/src/global_compiler.nit +++ b/src/global_compiler.nit @@ -667,6 +667,12 @@ private class GlobalCompilerVisitor mtype = self.anchor(mtype) if value.mtype.is_subtype(self.compiler.mainmodule, null, mtype) then return value + end + + var valmtype = value.mtype + if valmtype isa MNullableType and valmtype.mtype.is_subtype(self.compiler.mainmodule, null, mtype) then + var res = new RuntimeVariable(value.name, value.mtype, valmtype.mtype) + return res else var res = new RuntimeVariable(value.name, value.mtype, mtype) return res -- 1.7.9.5