Ways to reference Path Dependent Types

val foo = new {
  case class Bar(bar: String)
}
val baz = new {
  val reference = foo
  def unbox(bar: reference.Bar)
}

baz.unbox(baz.reference.Bar("test")  // compiles
baz.unbox(foo.Bar("test"))  // does not compile

Is there any way to do something like a PDT where the above compiles? Where the compiler only cares what the parent instance actually is when type-checking instances of Bar, not how it’s referenced?

It feels like there must be a way to tell the compiler that reference and the original foo are literally the same, and to simply reroute any invocation of reference straight back to foo.

Unfortunately just using baz.reference.Bar isn’t possible: in my use case, several different instances of several different traits would all want to refer to type members of the same instance and have the compiler understand that all those references are to the same type.

I can’t find any version of Scala that accepts this definition of bad?

Where’s the body of unbox?