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

dartk: Static setter/getter should be taken into account when resolving references #28417

Closed
mkustermann opened this issue Jan 17, 2017 · 2 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel

Comments

@mkustermann
Copy link
Member

mkustermann commented Jan 17, 2017

From tests/language/static_setter_get_test.dart:

class Class {
  static set o(_) {}
  m() => o; /// 01: static type warning
  noSuchMethod(_) => 42;
}

main() {
  Expect.throws(() => new Class().m()); /// 01:
}

/cc @kmillikin & #28263

@lrhn
Copy link
Member

lrhn commented Jan 17, 2017

This is actually an interesting case that I wasn't aware of :).

The spec says about the identifier expression id:

Let d be the innermost declaration in the enclosing lexical scope whose
name is id or id=. If no such declaration exists in the lexical scope, let d be
the declaration of the inherited member named id if it exists.

That's not really well-defined since there can be both an id and an id= declaration in the same scope, so which one is it? It matters, because it's only a warning if one is static and the other is dynamic, and the program should have a semantics in that case.
Implementations favor the getter over the setter (reasonably, I'd say, but not mandated).

(Another interesting thing is that this looking at declarations includes abstract getters and setters too).

@mraleph
Copy link
Member

mraleph commented Mar 27, 2017

Fixed in Fasta! Hooray.

@mraleph mraleph closed this as completed Mar 27, 2017
@kmillikin kmillikin added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel labels Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel
Projects
None yet
Development

No branches or pull requests

4 participants