Skip to content
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

CFE fails to report error for import prefix hidden by class member (when used to name a type) #34498

Closed
stereotype441 opened this issue Sep 17, 2018 · 3 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone

Comments

@stereotype441
Copy link
Member

Consider the following code:

import 'dart:core';
import 'dart:core' as core;

class A {
  core.List get core => null; // (1)
}

Based on my reading of the spec, there should be a compile-time error at (1), because the declaration of the getter core inside of class A hides the import prefix declared at top level. So the type core.List should be invalid.

But the front end accepts this code without complaint, and considers the return type of the getter to be the type List from dart:core.

Note that the analyzer's handling of this case isn't correct either; it also accepts the code without complaint, but it consideres the return type of the getter to be dynamic.

@stereotype441 stereotype441 added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels Sep 17, 2018
@lrhn
Copy link
Member

lrhn commented Sep 18, 2018

This should be a compile-time error. The lexical scope for the declarations of A is the class scope of A.

@kmillikin kmillikin added the P2 A bug or feature request we're likely to work on label Sep 18, 2018
@kmillikin kmillikin added this to the Dart2.1 milestone Sep 18, 2018
@stereotype441
Copy link
Member Author

dart-bot pushed a commit that referenced this issue Sep 19, 2018
Also modify async_backwards_compatibility_1_test so that fixing these
bugs won't cause it to start failing.

Change-Id: I7bb3b9587a0aeea8662df1923034bcb409a29522
Reviewed-on: https://dart-review.googlesource.com/75280
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
@peter-ahe-google
Copy link
Contributor

Work in progress: https://dart-review.googlesource.com/c/sdk/+/79047

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants