typing: `new`-fatories are like top-level methods
authorJean Privat <jean@pryen.org>
Thu, 23 Oct 2014 01:48:05 +0000 (21:48 -0400)
committerJean Privat <jean@pryen.org>
Thu, 23 Oct 2014 17:02:32 +0000 (13:02 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/semantize/typing.nit

index 83bebc2..13b36b6 100644 (file)
@@ -72,7 +72,7 @@ private class TypeVisitor
                        selfvariable.declared_type = mclass.mclass_type
 
                        var mprop = mpropdef.mproperty
-                       if mprop isa MMethod and mprop.is_toplevel then
+                       if mprop isa MMethod and (mprop.is_toplevel or mprop.is_new) then
                                is_toplevel_context = true
                        end
                end