Open
Description
Consider the following line from a test.
In it Func
is a type literal referring to the declaration as follows:
According to a comment in a recent discussion (see dart-lang/sdk#52961 (comment)), that should be a compile time error, and I'm working on a CL that treats it that way (see https://dart-review.googlesource.com/c/sdk/+/315101?tab=checks).
Should the test in question expect a compile-time error in line 90? Alternatively, calls similar to T.toString()
where T
is a type literal can be rewritten as callToString(T)
, where callToString
is defined as follows:
String callToString(Object? receiver) => receiver.toString();
Here's a list of more of the similar invocations of Object
members on type literals as receivers.
- LanguageFeatures/Constructor-tear-offs/summary_A03_t01.dart, lines 90, 98, 105
- LanguageFeatures/Constructor-tear-offs/summary_A03_t02.dart, lines 95, 103, 110, 122
- LanguageFeatures/Constructor-tear-offs/summary_A03_t03.dart, lines 95, 103, 110
- LanguageFeatures/Patterns/patterns_lib.dart, line 43