compiler: accept intern `new` constructors (factories)
authorJean Privat <jean@pryen.org>
Thu, 12 Jun 2014 13:01:38 +0000 (09:01 -0400)
committerJean Privat <jean@pryen.org>
Thu, 12 Jun 2014 13:01:38 +0000 (09:01 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/abstract_compiler.nit

index 92520bf..8faa8c5 100644 (file)
@@ -1700,6 +1700,8 @@ redef class AMethPropdef
                var ret = mpropdef.msignature.return_mtype
                if ret != null then
                        ret = v.resolve_for(ret, arguments.first)
+               else if mpropdef.mproperty.is_new then
+                       ret = arguments.first.mcasttype
                end
                if pname != "==" and pname != "!=" then
                        v.adapt_signature(mpropdef, arguments)