transform: do not lose autocast information
authorJean Privat <jean@pryen.org>
Thu, 16 Apr 2015 16:33:13 +0000 (23:33 +0700)
committerJean Privat <jean@pryen.org>
Thu, 16 Apr 2015 16:34:47 +0000 (23:34 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/transform.nit

index 118142a..4fa28c0 100644 (file)
@@ -20,6 +20,7 @@ import astbuilder
 import astvalidation
 import semantize
 intrude import semantize::scope
+intrude import semantize::typing
 
 redef class ToolContext
        var transform_phase: Phase = new TransformPhase(self, [typing_phase, auto_super_init_phase])
@@ -105,6 +106,14 @@ redef class AExpr
                end
                super
        end
+
+       redef fun replace_with(other)
+       do
+               super
+               if other isa AExpr then
+                       if other.implicit_cast_to == null then other.implicit_cast_to = implicit_cast_to
+               end
+       end
 end
 
 redef class AVardeclExpr