Skip to content

Lack of bridges for classes extending traits with erased overloads prevent extension in java #11484

Closed
scala/scala
#8037
@martijnhoekstra

Description

@martijnhoekstra

given

class Foo[A]
sealed trait Trait[A] {
  def overloaded(that: List[Trait[A]]): Trait[A] = that.head
  def overloaded(that: List[Foo[A]]): Foo[A] = that.head
}
abstract class AbstractClass[A] extends Trait[A]

a java class

public class Failure extends AbstractClass<String>{
}

used to be possible, but is impossible in 2.13.0-RC1, and fails with

name clash: <A>overloaded(scala.collection.immutable.List<example.Foo<A>>) in example.Trait and <A>overloaded(scala.collection.immutable.List<example.Trait<A>>) in example.Trait have the same erasure, yet neither overrides the other

This regressed in scala/scala#7843

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions