diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-02-25 17:58:11 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-02-25 17:58:11 +0100 |
commit | 696dcdfcdb40ee3dbd2ba63f8281b87cde787a00 (patch) | |
tree | 6d350aa9c74482f6f3c02c3584c49be02670f286 | |
parent | 9a2455aee4cfb09030ff2c2c0e6861326487e474 (diff) | |
download | scala-696dcdfcdb40ee3dbd2ba63f8281b87cde787a00.tar.gz scala-696dcdfcdb40ee3dbd2ba63f8281b87cde787a00.tar.bz2 scala-696dcdfcdb40ee3dbd2ba63f8281b87cde787a00.zip |
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.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 9 | ||||
-rw-r--r-- | test/files/pos/t7126.scala | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index cff3f4f0fa..4fb68fc2a9 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/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 } diff --git a/test/files/pos/t7126.scala b/test/files/pos/t7126.scala new file mode 100644 index 0000000000..6720511e08 --- /dev/null +++ b/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 +}
\ No newline at end of file |