Skip to content

Bad interaction between overloading and implicit search #3168

Closed
@allanrenucci

Description

@allanrenucci

The following code snippet fails to compile with Dotty

object Test {
  class C {
    def foo(x: Int) = 1
    def foo(x: Double) = 2
  }

  implicit class COps(val x: C) {
    def foo(x: String) = 3
  }
  
  def test: Unit = {
    (new C).foo("Hello")
  }
}

The compiler is not able to find the method foo added via implicit conversion. If one of the overloaded version of foo is commented out, the code snippet compiles

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