Skip to content

Surface whether or not a getter can be overridden #1103

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

Open
nex3 opened this issue Feb 24, 2016 · 1 comment
Open

Surface whether or not a getter can be overridden #1103

nex3 opened this issue Feb 24, 2016 · 1 comment
Labels
P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@nex3
Copy link
Member

nex3 commented Feb 24, 2016

In strong mode, a getter may not be overridden if it's defined as a field. For example,

class Super {
  final foo;
  get bar;
}

class Sub extends Super {
  get foo => 12;
  get bar => 13
}

Sub.foo is invalid, whereas Sub.bar is valid. This affects the public API of a class, so it should be mentioned in the documentation. For forwards-compatibility with future explicit member- or class-level control of virtual-ness, it would probably be good to document this as "this getter cannot be overidden in subclasses" or something like that.

cc @munificent @vsmenon

@nex3 nex3 added the type-enhancement A request for a change that isn't a bug label Feb 24, 2016
@jcollins-g jcollins-g added the P2 A bug or feature request we're likely to work on label May 15, 2017
@sigurdm
Copy link
Contributor

sigurdm commented May 22, 2025

We could replace the "getter/setter pair" box with one that says "field"

Image

@sigurdm sigurdm added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants