Well, I would not do that, but you can; just type Pathinside FileSystem:
trait AnyPath[S <: FileSystem] { self: S#P =>
val fileSystem: S
}
trait FileSystem { thisFileSystem =>
type P <: Path
trait Path extends AnyPath[thisFileSystem.type]{ self: thisFileSystem.P =>
lazy val fileSystem = thisFileSystem
}
}
case object SomeFileSystem extends FileSystem {
type P = ReallyConcretePath
case class ReallyConcretePath() extends Path
}
source
share