Skip to content

2.12 issue: overloaded method value *** with alternatives: #12880

@He-Pin

Description

@He-Pin

Reproduction steps

2.12.18

it works in 2.13 & 3

```scala
import java.util.concurrent.Executor
import java.util.function.BiFunction

trait CompletionStage[T] {
  def handleAsync[U](f: BiFunction[_ >: T, Throwable, _ <: U]): CompletionStage[U]

  def handleAsync[U](f: BiFunction[_ >: T, Throwable, _ <: U],
                     executor: Executor): CompletionStage[U]

  def invoke(): Unit = {
    val executor: Executor = null
    handleAsync[T]((t: T, _: Throwable) => t, executor)
  }
}

## Problem


```scala

[error] C:\Users\hepin\IdeaProjects\overrideIssue\src\main\scala\CompletionStage.scala:12:16: overloaded method value handleAsync with alternatives:
[error]   (f: java.util.function.BiFunction[_ >: T, Throwable, _ <: T],executor: java.util.concurrent.Executor)CompletionStage[T] <and>
[error]   (f: java.util.function.BiFunction[_ >: T, Throwable, _ <: T])CompletionStage[T]
[error]  cannot be applied to ((T, Throwable) => T, java.util.concurrent.Executor)
[error]     handleAsync[T]((t: T, u: Throwable) => t, executor)
[error]                ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

Explain how the above behavior isn't what you expected.

It should compile

And it works if I don't use the SAM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions