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

Generate NSM forwarders for implicit getters & setters of a field #32722

Closed
alexmarkov opened this issue Mar 30, 2018 · 3 comments
Closed

Generate NSM forwarders for implicit getters & setters of a field #32722

alexmarkov opened this issue Mar 30, 2018 · 3 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. customer-vm P2 A bug or feature request we're likely to work on
Milestone

Comments

@alexmarkov
Copy link
Contributor

Consider the following example:

abstract class I {
  int foo;
//  int get foo;
//  set foo(int i);
}

class A implements I {
  dynamic noSuchMethod(Invocation inv) {
    print('noSuchMethod (${inv.memberName})');
    return 'hi';
  }
}

main() {
  A aa = new A();
  print(aa.foo);
  (aa as dynamic).foo = 'hello';
}

It runs without errors, returning String from I.foo getter and accepting String in I.foo setter.
If field foo is replaced with explicit getter and setter (commented code), type errors are correctly reported.

/cc @stefantsov @sjindel-google

@dgrove dgrove added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Mar 30, 2018
@sjindel-google
Copy link
Contributor

I think this should be done in the FE, with abstract methods for the getter and setter created with the no-such-method-forwarder flag.

@sjindel-google sjindel-google added P2 A bug or feature request we're likely to work on customer-vm labels Mar 31, 2018
@sjindel-google sjindel-google added this to the Dart2 Beta 3 milestone Mar 31, 2018
@chloestefantsova chloestefantsova self-assigned this Apr 4, 2018
@dgrove dgrove modified the milestones: Dart2 Beta 3, Dart2 Beta 4 Apr 12, 2018
@kmillikin kmillikin added this to Incoming Untriaged in Dart Front End Apr 23, 2018
@JekCharlsonYu JekCharlsonYu modified the milestones: Dart2Beta4, Dart2Stable May 17, 2018
@dgrove
Copy link
Contributor

dgrove commented Jun 14, 2018

Is this actually needed for Dart2Stable? @kmillikin

@chloestefantsova
Copy link
Contributor

I believe I have a fix in CL 62151.

@kmillikin kmillikin moved this from Incoming Untriaged to Done in Dart Front End Aug 1, 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. customer-vm P2 A bug or feature request we're likely to work on
Projects
Development

No branches or pull requests

6 participants