-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
dealiascompiler isn't dealiasing when it should, or vice versacompiler isn't dealiasing when it should, or vice versadependent typesfixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Milestone
Description
(Original post: https://stackoverflow.com/questions/62478001/in-scala-how-to-instruct-the-compiler-to-realise-the-equivalence-of-two-abstrac)
reproduction steps
using Scala (2.12.11, 2.13.2),
trait Super1[S] {
final type Out = this.type
final val out: Out = this
}
trait Super2[S] extends Super1[S] {
final type SS = S
}
case class A[S](k: S) extends Super2[S] {}
val a = A("abc")
implicitly[a.type =:= a.out.type]
// success
implicitly[a.Out =:= a.out.Out]
// success
implicitly[a.SS =:= a.out.SS]
implicitly[a.SS <:< a.out.SS]
implicitly[a.out.SS <:< a.SS]
// oopsproblem
if I move:
final type Out = this.type
final val out: Out = this
to be under Super2 it will compile successfully.
the path-dependent type resolver behave inconsistently just for this case. My questions are:
-
How to visualise the type representation of abstract types? (e.g. printing a tree of all supertypes, constraints & type parameters etc.)
-
What is the root cause that cause this problem, can it be identified by the used visualisation?
DmytroMitin
Metadata
Metadata
Assignees
Labels
dealiascompiler isn't dealiasing when it should, or vice versacompiler isn't dealiasing when it should, or vice versadependent typesfixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)