Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should prefer_final_parameters fire on a super-parameter? #3211

Closed
Tracked by #3131
srawlins opened this issue Feb 2, 2022 · 3 comments · Fixed by #3222
Closed
Tracked by #3131

Should prefer_final_parameters fire on a super-parameter? #3211

srawlins opened this issue Feb 2, 2022 · 3 comments · Fixed by #3222

Comments

@srawlins
Copy link
Member

srawlins commented Feb 2, 2022

The prefer_final_parameters rule has tests indicating that it should report constructor parameters:

class C {
  C.badValue(String value): this.value = value; // LINT
}

but not for field formal parameters:

class C {
  C.goodValue(this.value); // OK
}

So, what about super-parameters? Whether it should or shouldn't, there should be a test.

@eernstg
Copy link
Member

eernstg commented Feb 2, 2022

A super parameter is final even without the final modifier, just like an initializing formal, so it seems superfluous to ask for the modifier.

@srawlins
Copy link
Member Author

srawlins commented Feb 2, 2022

I'm happy to submit the test case.

@pq
Copy link
Member

pq commented Feb 7, 2022

Thanks @srawlins!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants