-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[vm] Default values of noSuchMethod
forwarder are missed in case of mixin application
#53656
Comments
We do have an ongoing discussion about the semantics of this exact topic in dart-lang/language#3331, but I believe it's safe to say that this example is outside that discussion: There is no doubt that the noSuchMethod forwarders should be used, and they should use the default value from the declarations that introduced this member into the interface when said default value is well defined (that is, we have one value, not zero and not more than one). However, @johnniwinther, I would expect noSuchMethod forwarders/throwers to be generated by the CFE, and I thought that every backend would simply rely on using the default value which was specified explicitly in the generated forwarder. Is that not correct? |
It's likely that the difference comes from the mixin application not making a copy of the abstract method declarations of the mixin into the application class. And that's a point where the specification is misleading, when it says the signature of the interface |
We have specified that noSuchMethod forwarders are concrete member declarations, though implicitly induced (in the example: into the class Moreover, noSuchMethod forwarders should have 'the same default value for each optional parameter'. This particular phrase is ambiguous, as discussed in dart-lang/language#3331, but I don't think there is any reasonable interpretation of this phrase and the text around it which amounts to "just forget all about the default values". |
I'm working on this change which might address these missing default values as well: |
The incorrect behavior is caused by the missing forwarding stub in the mixin application class. Duplicate to #53677. |
According to Dart specification "10.2.2 The Method noSuchMethod"
But in case of mixin application on VM default values of optional parameters are missed. Proof
No this issue on DartPad. DartPad output is
So, I believe, this is VM issue
Tested on
Dart SDK version: 3.2.0-202.0.dev (dev) (Tue Sep 26 21:06:42 2023 -0700) on "windows_x64"
The text was updated successfully, but these errors were encountered: