Skip to content

AbstractMethodError with tracked parameters #21213

Open
@bishabosha

Description

@bishabosha

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions