Skip to content

Private implicit members of companion imported but not found by implicit search #10868

Open
@hgiddens

Description

@hgiddens

Private implicit members of an object, when imported from the top level, are visible in the companion class but aren't found by implicit search in that companion class.

class Other
import Test._
class Test {
//  import Test._ // <- if I import here instead everything works fine
  val present: Other = value // this works fine
  val butNotImplicitly: Other = implicitly[Other] // fails: could not find implicit value
}
object Test {
  private implicit def value: Other = null
}

I can reproduce this with 2.11.11, 2.12.6, 2.13.0-M3, and on scastie.scala-lang.org. Apologies if this is intentional behaviour, I had a bit of a read through the SLS but couldn't find covering this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions