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

call method invocation and noSuchMethod forwarder #59952

Open
sgrekhov opened this issue Jan 22, 2025 · 1 comment
Open

call method invocation and noSuchMethod forwarder #59952

sgrekhov opened this issue Jan 22, 2025 · 1 comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sgrekhov
Copy link
Contributor

sgrekhov commented Jan 22, 2025

This issue derieved from the test mentioned in #55803 (comment). I didn't find a separate github item for this issue. Feel free to close this one as a duplicate if there is such one.

class BNSMC {
  // Should be NSM-forwarder.
  int Function(int) get call;

  Object? noSuchMethod(Invocation i) {
    if (i.memberName == #call) {
      print("isMethod=${i.isMethod}"); // false
      print("isGetter=${i.isGetter}"); // true
      return (int x) => x;
    }
    return super.noSuchMethod(i);
  }
}

void main() {
  (BNSMC() as dynamic)(42);
}

Here we have an attempt to invoke a call method, not a getter, so isMethod and isGetter should have opposite values.
cc @lrhn @eernstg to confirm.

@dart-github-bot
Copy link
Collaborator

Summary: noSuchMethod incorrectly identifies a call method invocation as a getter, resulting in isMethod being false and isGetter being true. This contradicts expected behavior.

@dart-github-bot dart-github-bot added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants