-
-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override and default types #11410
Comments
Ping @Simn for comment |
This requires splitting up
However, we have to keep |
I think we will need to have a late check for types anyway because of potential typing recursions. |
Yes, although this already happens very late anyway, so I don't think we'll run into any typing pass issues here. I realized that this reminds me of #10569. Another case is implementing an interface method: class C implements I {
public function new() {}
public function test(s) {
$type(s); // Unknown<0>, should be String
}
}
function main() {
var c = new C();
$type(c.test); // (s : Unknown<0>) -> Void
} That first I'll look into cleaning this behavior up and make it consistent for all these cases where the typing of a field depends on the type of another field. |
Look at the following sample:
In this case, we somewhat innocently changed the type of B.foo to be more general that what it should be.
Sadly, in HashLink and some other static platforms, this will create an allocation for each call of foo because we're casting an "A" to "{ x:Int}".
I think the override argument types should be inherited by default from the super class definition if they have no explicit type. That would both improve the completion and avoid this kind of hidden error.
The text was updated successfully, but these errors were encountered: