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

AbstractMethodError with tracked parameters #21213

Open
bishabosha opened this issue Jul 17, 2024 · 0 comments
Open

AbstractMethodError with tracked parameters #21213

bishabosha opened this issue Jul 17, 2024 · 0 comments
Assignees
Labels
area:experimental:modularity Issues related to the modularity extension. itype:bug

Comments

@bishabosha
Copy link
Member

Compiler version

3.5.0-RC4

Minimized code

//> using options  -source:future -language:experimental.modularity

enum Foo(tracked val discriminator: String):
  case Bar() extends Foo("bar")
  case Baz() extends Foo("baz")

val bar: Foo = Foo.Bar()
@main def test = println(bar.discriminator)

Output

running main method test:

java.lang.AbstractMethodError: Receiver class rs$line$1$Foo$Bar does not define or inherit an implementation of the resolved method 'java.lang.String discriminator()' of abstract class rs$line$1$Foo. Selected method is 'abstract java.lang.String rs$line$1$Foo$Bar.discriminator()'.
  at rs$line$1$.test(rs$line$1:6)
  ... 32 elided

Expectation

I expected to run the method, and have it return a widened type, not a crash

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:experimental:modularity Issues related to the modularity extension. and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 17, 2024
@odersky odersky assigned KacperFKorban and unassigned odersky Sep 12, 2024
KacperFKorban added a commit that referenced this issue Oct 18, 2024
Refinements are copied over from parents, because they might be needed
for tracked members that should have more specific types in the child.
These members are generated without an implementation and should not be
used in runtime.

possible fix for #21213

---------

Co-authored-by: Dale Wijnand <dale.wijnand@gmail.com>
Co-authored-by: Matt Bovel <matthieu@bovel.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:modularity Issues related to the modularity extension. itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants