nitg: fixes iterators crashes for test in 62cdb9a9633767baafb04f66fdad79a46d2e9a69
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 7 Nov 2013 18:48:43 +0000 (13:48 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 7 Nov 2013 18:48:43 +0000 (13:48 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/typing.nit

index abf1597..57e4b6d 100644 (file)
@@ -894,6 +894,10 @@ redef class AForExpr
                        v.error(self, "Type Error: Expected method 'iterator' to return an Iterator of MapIterator type")
                        return
                end
+
+               # anchor formal and virtual types
+               if mtype.need_anchor then mtype = v.anchor_to(mtype)
+
                self.coltype = mtype.as(MClassType)
 
                # get methods is_ok, next, item