Closed
Description
Compiler version
3.1.0 and 3.1.1-RC1
Minimized code
import LightTypeTagInheritance._
// import LightTypeTagInheritance.Ctx // this doesn't work either
trait LightTypeTagRef
object LightTypeTagInheritance {
private final case class Ctx(self: LightTypeTagInheritance) {
def next(): Ctx = Ctx(self)
}
private implicit final class CtxExt(private val ctx: Ctx) extends AnyVal {
def isChild(selfT0: LightTypeTagRef, thatT0: LightTypeTagRef): Boolean = ctx.self.isChild(ctx.next())(selfT0, thatT0)
}
}
class LightTypeTagInheritance {
def isChild(s: LightTypeTagRef, t: LightTypeTagRef): Boolean = {
isChild(new Ctx(this))(s, t)
}
private def isChild(ctx: Ctx)(s: LightTypeTagRef, t: LightTypeTagRef): Boolean = {
ctx.isChild(s, t)
}
}
object App extends App {
println(LightTypeTagInheritance)
}
Scastie: https://scastie.scala-lang.org/BfgPFl4wR9KewXSVPFCXFg
Output
value isChild is not a member of LightTypeTagInheritance.Ctx, but could be made available as an extension method.
The following import might fix the problem:
import LightTypeTagInheritance.CtxExt
Expectation
Expected to compile, as in Scala 2 (https://scastie.scala-lang.org/urqciNvJRPWdhYPH8SGrjQ)
Workaround: changing CtxExt
from private
to private[LightTypeTagInheritance]
fixes the issue