Skip to content

Overload resolution should dealias types #12265

@japgolly

Description

@japgolly

Compiler version

3.0.0-RC3

Minimized code

object OK {
  def apply(n: Int ): Unit = ()
  def apply(n: Long): Unit = ()
  apply(3)  // ok
  apply(3L) // ok
}

object KO {
  type Key = Int
  def apply(n: Key ): Unit = ()
  def apply(n: Long): Unit = ()
  apply(3)  // error
  apply(3L) // ok
}

Output

[error] 12 |  apply(3)  // error
[error]    |  ^^^^^
[error]    |Ambiguous overload. The overloaded alternatives of method apply in object KO with types
[error]    | (n: Long): Unit
[error]    | (n: KO.Key): Unit
[error]    |both match arguments ((3 : Int))
[error] one error found

Expectation

Success. This works with Scala 2.x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions