Closed
Description
Snippet:
main.dart
:
import 'import.dart' as thing;
class Foo {
List<thing.Type> field;
thing() {}
}
import.dart
:
class Type {}
Passes in the analyzer but errors in the CFE with:
main.dart:4:8: Error: 'thing.Type' can't be used as a type because 'thing' doesn't refer to an import prefix.
List<thing.Type> field;
^^^^^^^^^^
What's our convention here? Following the analyzer's convention and using 'this' to refer to the local name would be the least breaking.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
eernstg commentedon Sep 13, 2019
We do not have separate namespaces for separate kinds of declarations (labels are special, everything else goes into the same namespace). The declaration of
field
is an instance member, so it's in the instance scope, and hencething
inthing.Type
resolves to the other instance member calledthing
.So the CFE is right.
This issue is already reported for the analyzer in #32248, so I'll close this one as a duplicate. I've added a comment about this issue on #32248.
@Markzipan, about
dev-compiler-kernel-blocker
: I think the right way ahead would be to mark #32248 as a blocker.