Skip to content
Browse files

SI-7126 Account for the alias types that don't dealias.

After this change:

    qbin/scalac -Ydebug test/files/pos/t7126.scala 2>&1 | grep warning
    warning: dropExistential did not progress dealiasing Test.this.T[Test.this.T], see SI-7126
    one warning found

T[T]? Really? The true bug lies somewhere else; the comments of
the ticket illuminate the general areas of concern.
  • Loading branch information...
1 parent 9a2455a commit 696dcdfcdb40ee3dbd2ba63f8281b87cde787a00 @retronym retronym committed
Showing with 18 additions and 2 deletions.
  1. +7 −2 src/compiler/scala/tools/nsc/typechecker/Typers.scala
  2. +11 −0 test/files/pos/t7126.scala
View
9 src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -222,8 +222,13 @@ trait Typers extends Modes with Adaptations with Tags {
new SubstWildcardMap(tparams).apply(tp)
case TypeRef(_, sym, _) if sym.isAliasType =>
val tp0 = tp.dealias
- val tp1 = dropExistential(tp0)
- if (tp1 eq tp0) tp else tp1
+ if (tp eq tp0) {
+ debugwarn(s"dropExistential did not progress dealiasing $tp, see SI-7126")
+ tp
+ } else {
+ val tp1 = dropExistential(tp0)
+ if (tp1 eq tp0) tp else tp1
+ }
case _ => tp
}
View
11 test/files/pos/t7126.scala
@@ -0,0 +1,11 @@
+import language._
+
+object Test {
+ type T = Any
+ boom(???): Option[T] // SOE
+ def boom[CC[U]](t : CC[T]): Option[CC[T]] = None
+
+ // okay
+ foo(???): Option[Any]
+ def foo[CC[U]](t : CC[Any]): Option[CC[Any]] = None
+}

0 comments on commit 696dcdf

Please sign in to comment.
Something went wrong with that request. Please try again.