Skip to content

Analyzer should not accept a typedef that refers to itself via bound #43790

@stereotype441

Description

@stereotype441

The following program is accepted by the analyzer but rejected by the CFE:

typedef F<T extends F<Null>> = T Function();

main() {}

The CFE's error message is: Error: The typedef 'F' has a reference to itself.

I believe the analyzer should reject this program, because of the following spec text (from the "Type Aliases" section):

Any self reference in a type alias, either directly or recursively via another type declaration, is a compile-time error.

We will probably want to fix this issue either before or during our work on analyzer support for non-function type aliases.

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestdart-model-analyzer-specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions