Skip to content

[analyzer] Report a compile-time error for external initializing formals #54485

Closed
@eernstg

Description

@eernstg

Consider the following program:

class A {
  final int i;
  external A(this.i);
}

void main() {}

The CFE reports a compile-time error on this library. The analyzer accepts it with no errors.

It was previously only mentioned in commentary that it is a compile-time error for an external generative constructor to have an initializing formal parameter, but in dart-lang/language#3517 the specification was clarified such that it is now clearly specified to be a compile-time error.

This issue is the implementation issue for that implementation effort. It is 'area-analyzer' rather than 'area-meta', with sub-issues, because there is nothing to implement in any other tool than the analyzer.

It is not a breaking change, because every external constructor declaration that has an initializing formal is reported as a compile-time error by the CFE already today.

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestdart-model-analyzer-specIssues with the analyzer's implementation of the language specimplementationTrack the implementation of a specific feature (use on area-meta issue, not issues for each tool)legacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions