Merge: New constructors with the `new` keyword
`new` constructors where introduced with the FFI and generalized latter for intern methods.
This PR make them also legal with used-defined code in Nit.
~~~
abstract class Person
var age: Int
new(age: Int) do
if i < 18 then
return new Adult(age)
else
return new Child(age)
end
end
~~~
A `new` constructor is specified like a static method.
By default it returns the type of self, but this can be changed by the user.
This PR starts by generalizing the `new` constructors. Thus a lot of specific code in engine is removed.
Then additional rules are added to control the usage of user-defined `new` constructors.
The original code was great enough to accepts these new kind of method without heavy modification.
Pull-Request: #840
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>