-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dart 2 frontend uses the wrong scope for type annotations #32752
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
The behavior that you've seen in Dart 2 is correct, and the behavior that you've seen elsewhere is a bug. Dart does not have a notion of putting declared names into different namespaces according to the nature of their declaration (with one exception: labels). So Taking that into account, wouldn't it be possible to generate code which doesn't have that name clash? |
For what it's worth, this is a duplicate of #32200 |
Also note #32248 which requests the relevant bug fix in the analyzer. |
@eernstg Despite possibly being a bug, this is long-standing behavior of the VM and apparently also the analyzer, so I think we should consider the new behavior to be a breaking change. Maybe we should have a Dart 2 breaking change announcement from the language team for this. /cc @leafpetersen @a-siva @rmacnak-google Do you think that mangling the generated library prefixes with a leading '$' would be sufficient? Can library prefixes have a leading '$'? /cc @abarth. |
Funny, the analyzer isn't even quite sure whether it's looking up import 'dart:math' as math;
class Foo {
List<math.Point> math;
}
main() => print(new Foo()); produces
I understand that even a bug fix can be a breaking change, organizationally. I hope it's manageable! On the other hand, I think we should maintain the property that "Dart has one name space" as far as possible (and nobody knows about labels, anyway ;-). |
Posting an announcement about this seems like a reasonable idea, I can do. |
Is this still a P0? |
Dropping the P0 as it appears @rmacnak-google unblocked Fuchsia. Please bump if I misunderstood. Is the only open here to communicate the change? |
I've announced that this is de facto changing. We have a bug (#32248) for the analyzer to fix this, everything else gets this from the CFE. Closing this, but re-open if there are any remaining issues that I've missed. |
This is a simplification of an issue encountered with generated FIDL2 bindings in Fuchsia. It blocks enabling Dart 2 in Fuchsia.
works in Dart, but in Dart 2 yields
@peter-ahe-google @a-siva @zanderso
The text was updated successfully, but these errors were encountered: