-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Forgive my bare understanding of the parsing rules, but I was surprised to see co19 language tests like named_constructor_A03_t02 which include code like:
var v3 = (C<dynamic>).constr;I had thought that C<dynamic> when not followed immediately by a . would be a Type, which does not have a getter called constr. In any case, assuming this is a valid test, I wonder then, given a class with constructors runtimeType or hashCode, are the following variables constructor tearoffs or field accesses on Type?
class C<T> {
C.runtimeType();
C.hashCode();
}
void main() {
(C).runtimeType; // In current Dart, this accesses `runtimeType` on the Type.
(C<int>).runtimeType; // Illegal in current Dart.
}In other words, do constructors shadow instance getters that exist on Type, or vice versa?
I think the question can extend to a constructor named toString. (C).toString normally represents the tearoff of the toString function on Type, but what if C has a constructor named toString?