Open Michael35699 opened 3 years ago
This also happens in other contexts:
typedef Json = Map<String, dynamic>;
extension JsonMethod on Json {
// ^^^^ here
Json dict(String propertyName) {
//^^^^ here
return this[propertyName] as Json;
// ^^^^ here
}
}
I am not able to reproduce on master
, but I am able to reproduce with Dart SDK version: 2.14.0-321.0.dev
Could it be that the linter
is somehow different from the one in the SDK, that discrepancy is also shown in https://github.com/dart-lang/linter/issues/2597
With master
, adding the far below at the end of always_specify_types.dart
test case gives successful result, although putting a wrong LINT
gives an error
EXPERIMENT_NOT_ENABLED: This requires the 'nonfunction-type-aliases' language feature to be enabled.
Test case:
typedef ZTable = HashMap<String, String>;
void m() {
ZTable table = ZTable(); // OK
}
typedef Json = Map<String, dynamic>;
extension JsonMethod on Json {
Json dict(String propertyName) {
return this[propertyName] as Json;
}
}
Which master? On the master branch of the SDK that feature is marked as being enabled by default, so you shouldn't see the EXPERIMENT_NOT_ENABLED
diagnostic.
I meant linter
master
, at the moment I didn't go into the SDK and see how to use a modified linter
, this would be the next step.
At the moment, I hope someone points to a reproducible issue in linter
master
, so it can be modified and tested there.
Describe the issue A clear and concise description of what the issue is.
I believe this is unexpected behavior, since the types are already declared.
To Reproduce
Given example above
Expected behavior
There would be no lint error.
Additional context
N/A