Skip to content

Bridge generation error for AnyVal classes #14009

Closed
@Atry

Description

@Atry

Compiler version

3.1.0

Minimized code

class Nullable[A](val value: A | Null) extends AnyVal

def f[A] = {
  new (Nullable[A] => A | Null) {
    def apply(nullable: Nullable[A]) = nullable.value
  }
}

Output

bridge generated for member method apply(nullable: Playground.Nullable[A]): A | Null in anonymous class Object with Function1 {...}
which overrides method apply(v1: T1): R in trait Function1
clashes with definition of the member itself; both have erased type (nullable: Object): Object."

Expectation

It should compile

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions