compile error for a typedef that uses a class that indirectly uses the typedef #19459
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Milestone
This issue was originally filed by bslesinsk...@gmail.com
Sample code:
import 'dart:collection';
abstract class Template {
expand(TemplateMap others);
}
abstract class TemplateMap extends UnmodifiableMapBase<dynamic, CreateTemplate> {
}
typedef Template CreateTemplate();
The error is:
"Type alias cannot reference itself directly or recursively via another typedef."
It seems like this should be allowed due to the indirection through a class? Dart doesn't use structural typing for classes, so it seems like the type checker shouldn't need to look at the methods within Template when checking the return value of the typedef.
Or if this is disallowed, it seems like the error could be better. It should mention that the recursion has to do with the parameter of the "expand" method.
Dart Editor version 1.5.0.dev_04_11 (DEV)
Dart SDK version 1.5.0-dev.4.11
The text was updated successfully, but these errors were encountered: