Skip to content

Cannot resolve overloaded method with default parameters + implicit constraints #15546

Closed
@armanbilge

Description

@armanbilge

Compiler version

3.2.1-RC1-bin-20220627-4be1482-NIGHTLY

Minimized code

//> using scala "3.2.1-RC1-bin-20220627-4be1482-NIGHTLY"

trait Foo[F[_]]

object Bug {
  def apply[F[_]: Foo](
    await: Boolean,
    whatever: Int = 0
  ): Nothing = ???

  def apply[F[_]: Foo]: Nothing =
    apply[F](false)
}

Output

[error] ./bug.scala:12:5: None of the overloaded alternatives of method apply in object Bug with types
[error]  [F[_$3]](implicit evidence$2: Foo[F]): Nothing
[error]  [F[_$2]](await: Boolean, whatever: Int)(implicit evidence$1: Foo[F]): Nothing
[error] match type arguments [F] and arguments ((false : Boolean))
[error]     apply[F](false)
[error]     ^^^^^

Expectation

It compiles in 2.12 and 2.13.

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