Skip to content

Polymorphic overloads are sometimes hidden #4840

Closed
@smarter

Description

@smarter

This is a follow-up to #4819:

trait One[X]  {
  def concat(suffix: Int): X = ???
}

trait Two[Y <: Foo] {
  def concat[Dummy](suffix: Int): Y = ???
}

class Foo extends One[Foo] with Two[Foo] {
  concat(0) // OK

  // TODO: This does not typecheck because the polymorphic overload is masked
  // (we merge the denotations for both overloads into one and always prefer
  // MethodType to PolyType, instead we should return a MultiDenotation). See #4819.
  concat[Int](0) // error (that should actually not be an error)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions