-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer doesn't detect duplicate named parameter in constructor #26296
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
Comments
Is it suppose to? According to the specification:
I think this is working as expected. |
Here's a more complete example:
It works in Dartpad (the parameter gets assigned to both fields), but the Dart VM doesn't allow it: $ dart ~/tmp/test.dart If it's not an analyzer bug, perhaps it's a VM bug? |
We need clarification on the specification. |
The feature described in #26655 (access to initializing formals) implies that initializing formals will be added to the formal parameter scope for resolution in the initializer list, and that feature has been scheduled for inclusion in the language. The conflict described in this issue will be in line with the spec after the spec has been updated. So it should be possible to resolve this issue as part of the same process where #26655 is implemented. |
I believe this issue is now obsolete (the original example does create a name clash which is a compile-time error, and the analyzer does detect it, just like the VM always did, even before the spec said so ;-). Closing. Please reopen if you think there is still an issue. |
Verified that analysis server detects it. There is still no error in Dartpad, though. I guess Dartpad is so out of date that we can't rely on it anymore. |
For example, in DartPad, no diagnostics appear for this case:
The text was updated successfully, but these errors were encountered: