dart-lang / dart-lang/language

Report compile-time error for `var` in initializing formal parameter?

Open
#2,167 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

The analyzer and CFE currently accept the following program:

```dart
class A {
  final int foo;
  A(var this.foo);
}
```

It is specified to be a compile-time error. Do we need a breaking change process in order to report that error?

PS: A similar compile-time error is specified for a super parameter, and that error is being implemented.

@lrhn, @leafpetersen, WDYT?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the specified restriction on `var` in initializing formal parameters and compare it with the existing super-parameter restriction mentioned in the issue. Then inspect the analyzer and CFE entry points for these checks; done means the required compile-time error is reported and the need for a breaking change process is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.