model: remove `new_msignature` and special call as the new signature is the method...
[nit.git] / src / rapid_type_analysis.nit
index 9a6b117..9624932 100644 (file)
@@ -245,7 +245,6 @@ class RapidTypeAnalysis
                                v.add_monomorphic_send(vararg, self.modelbuilder.force_get_primitive_method(node, "with_native", vararg.mclass, self.mainmodule))
                        end
 
-                       # TODO? new_msignature
                        var sig = msignature
                        var osig = mmeth.intro.msignature.as(not null)
                        for i in [0..sig.arity[ do
@@ -258,11 +257,19 @@ class RapidTypeAnalysis
                        var npropdef = modelbuilder.mpropdef2node(mmethoddef)
 
                        if npropdef isa AClassdef then
-                               # It is an init for a class
-                               assert mmethoddef == npropdef.mfree_init
-
-                               if mmethoddef.mproperty.is_root_init and not mmethoddef.is_intro then
-                                       self.add_super_send(v.receiver, mmethoddef)
+                               if mmethoddef.mproperty.is_root_init then
+                                       # Final init call
+                                       if not mmethoddef.is_intro then
+                                               self.add_super_send(v.receiver, mmethoddef)
+                                       end
+                               else if mmethoddef.mclassdef.auto_init == mmethoddef then
+                                       # autoinit call
+                                       for i in mmethoddef.initializers do
+                                               if i isa MMethod then self.add_send(v.receiver, i)
+                                       end
+                               else
+                                       npropdef.debug "cannot RTA {mmethoddef}"
+                                       abort
                                end
                                continue
                        else if mmethoddef.constant_value != null then