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

Lint if a field overrides a superclass field #57733

Closed
stereotype441 opened this issue Jun 29, 2018 · 5 comments
Closed

Lint if a field overrides a superclass field #57733

stereotype441 opened this issue Jun 29, 2018 · 5 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-lint-request type-enhancement A request for a change that isn't a bug

Comments

@stereotype441
Copy link
Member

E.g.

class C {
  var f;
}
class D extends C {
  var f; // LINT
}
class E implements C {
  var f; // OK
}

A lint warning me that I was overriding a superclass field would have saved me about two hours of debugging today :)

@stereotype441 stereotype441 added type-enhancement A request for a change that isn't a bug linter-lint-request labels Jun 29, 2018
@a14n
Copy link
Contributor

a14n commented Jul 10, 2018

I just tested and this is catched by overridden_fields rule.

@pq
Copy link
Member

pq commented Jul 11, 2018

@stereotype441 : was this in the analyzer code base?

Incidentally, I take the fact that there is a rule that would catch this to be another case in point for the "we should really have a set of lint rules defined so that projects can easily derive from them" conversation (#288).

@stereotype441
Copy link
Member Author

@pq it was in pkg/front_end in the SDK repo.

@pq
Copy link
Member

pq commented Jul 13, 2018

/cc @davidmorgan as this is a good Google ruleset consideration.

A topic for another issue elsewhere, but @stereotype441, @bwilkerson, it might be interesting to consider updating options for front_end, kernel, analyzer and server to at least derive from the evolving google ruleset.

But anyway, lets close this in favor of picking that up elsewhere if there's interest.

Thanks!

@pq pq closed this as completed Jul 13, 2018
@davidmorgan
Copy link
Contributor

Noted. Thanks!

@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-lint-request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants