close
Skip to content

Uninformative error message for ambiguous implicit conversions #13177

@Alex1005a

Description

@Alex1005a

Reproduction steps

Scala version: 2.13.18

trait Ops {
  implicit class OpsSyntax[P](private val p: P) {
    def add[P1](p: P): P = ???
  }
}
object Foo extends Ops {
  final case class Bar()
  object Bar extends Ops {
    def x(): Bar = ???
  }
}

object TestErrMsg {
  def test(c: Foo.Bar) = {
    Foo.Bar.x().add(c)
  }
}

Problem

The compiler reports the error message: value add is not a member of testbaderrormessage.this.Foo.Bar. If the type parameter P1 is removed from add, a more informative error message is reported, describing which implicit conversions lead to ambiguity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions