Skip to content

A reflect newMethodOverride #15035

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
nicolasstucki opened this issue Apr 26, 2022 · 1 comment
Open

A reflect newMethodOverride #15035

nicolasstucki opened this issue Apr 26, 2022 · 1 comment
Assignees
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API itype:enhancement

Comments

@nicolasstucki
Copy link
Contributor

  • For the purpose of overriding we should provide some convenience method (Symbol.newMethodOverride ?) which given a method symbol in a parent takes care of generating a new symbol with the correct info and flags to override it.

Originally posted by @smarter in #15024 (review)

@smarter
Copy link
Member

smarter commented Apr 26, 2022

We might need to pass a list of method symbols to override instead of just one to be able to override methods from multiple parents, e.g.:

trait One:
  def foo: (Any, Int) // oneFooSym
  def foo(x: Int) = 1 // overload (so we can't just rely on the method name)
trait Two:
  def foo: (Int, Any) // twoFooSym
// Generated by newClass:
class Impl extends One with Two:
  // Generated by newMethodOverride(implSym, List(oneFooSym, twoFooSym)):
  override def foo: (Int, Int) = ???

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 26, 2022
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 16, 2022
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 23, 2022
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 23, 2022
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 23, 2022
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API itype:enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants