Skip to content

Clarify the semantics of tearing off an inherited abstract method #33951

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

Closed
bwilkerson opened this issue Jul 23, 2018 · 5 comments
Closed

Clarify the semantics of tearing off an inherited abstract method #33951

bwilkerson opened this issue Jul 23, 2018 · 5 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).

Comments

@bwilkerson
Copy link
Member

I have the following code:

abstract class A {
  void test();
}
class B extends A {
  void test() {
    super.test; // code in question
  }
}

Dart analyzer does not produce any static errors, but the CFE is currently issuing an error indicating that the class A does not define a getter named test. I couldn't find any place in the spec that would indicate that this should be an error. In particular, section 16.19.2 "Super Getter Access and Method Closurization" appears to indicate that this should be valid.

Should this code produce an error?

If so, then I'll open an analyzer issue. If not, then I'll open a CFE issue.

@bwilkerson bwilkerson added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Jul 23, 2018
@chloestefantsova
Copy link
Contributor

Note that CFE only produces error if class B is not abstract and enableSuperMixins is false; it compiles the program successfully otherwise.

@chloestefantsova
Copy link
Contributor

/cc @leafpetersen @eernstg

@leafpetersen
Copy link
Member

Yes, this should be an error. See also #33662 .

@leafpetersen
Copy link
Member

Filed a spec bug to make sure the text reflects this: #33963 .

@lrhn lrhn closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2025
@eernstg
Copy link
Member

eernstg commented Apr 10, 2025

Fixed in #33963.

@eernstg eernstg reopened this Apr 10, 2025
@eernstg eernstg closed this as completed Apr 10, 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).
Projects
None yet
Development

No branches or pull requests

5 participants