Skip to content

Package Private Implicit Syntax Class Is Not In Implicit Scope #9051

Closed
@adamgfraser

Description

@adamgfraser

Minimized code

In ZRef.scala

package zio

trait ZRef

object ZRef {

  private[zio] implicit class ZRefSyntax(private val self: ZRef) extends AnyVal {
    def unsafeUpdate: Boolean = true
  }
}

In Main.scala:

package zio

object Main extends App {
  val ref = new ZRef {}
  println(ref.unsafeUpdate)
}

Output

[error] -- [E008] Not Found Error: /Users/adamfraser/dotty/src/main/scala/zio/Main.scala:5:14 
[error] 5 |  println(ref.unsafeUpdate)
[error]   |          ^^^^^^^^^^^^^^^^
[error]   |value unsafeUpdate is not a member of zio.ZRef, but could be made available as an extension method.
[error]   |
[error]   |The following import might fix the problem:
[error]   |
[error]   |  import zio.ZRef.ZRefSyntax
[error]   |    

Expectation

I would have expected that the implicit syntax would be available within the package. Note that this works if I remove the private[zio] access modifier on the implicit syntax class and it also works as written on Scala 2.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions