typing: ensure monotony on literal arrays
authorJean Privat <jean@pryen.org>
Sat, 11 Apr 2015 17:06:45 +0000 (00:06 +0700)
committerJean Privat <jean@pryen.org>
Sat, 11 Apr 2015 17:06:45 +0000 (00:06 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/semantize/typing.nit

index 212f43e..ba08e4d 100644 (file)
@@ -1334,6 +1334,8 @@ redef class AArrayExpr
                        end
                end
                if mtype == null then
+                       # Ensure monotony for type adaptation on loops
+                       if self.element_mtype != null then mtypes.add self.element_mtype
                        mtype = v.merge_types(self, mtypes)
                end
                if mtype == null or mtype isa MNullType then