summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-04-24 08:57:26 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-04-24 12:06:30 +0200
commit30099160320b649b1e8e5f69c8ad1b02478fbfe2 (patch)
tree9ab2e396c7a59379208e89fcc7324a5c4f21b65b /src/compiler
parent4dcb33e6f527f5e2bf978c9e1ca778c40bf29d54 (diff)
downloadscala-30099160320b649b1e8e5f69c8ad1b02478fbfe2.tar.gz
scala-30099160320b649b1e8e5f69c8ad1b02478fbfe2.tar.bz2
scala-30099160320b649b1e8e5f69c8ad1b02478fbfe2.zip
SI-6771 Alias awareness for checkableType in match analysis.
Failure to dealias the type of the scrutinee led the pattern matcher to incorrectly reason about the type test in: type Id[X] = X; (null: Id[Option[Int]]) match { case Some(_) => } Before, `checkableType` returned `Id[?]`, now it returns `Some[?]`.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
index d9f93f27b6..9558542533 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
@@ -99,7 +99,9 @@ trait TreeAndTypeAnalysis extends Debugging {
// TODO: when type tags are available, we will check -- when this is implemented, can we take that into account here?
// similar to typer.infer.approximateAbstracts
object typeArgsToWildcardsExceptArray extends TypeMap {
- def apply(tp: Type): Type = tp match {
+ // SI-6771 dealias would be enough today, but future proofing with the dealiasWiden.
+ // See neg/t6771b.scala for elaboration
+ def apply(tp: Type): Type = tp.dealiasWiden match {
case TypeRef(pre, sym, args) if args.nonEmpty && (sym ne ArrayClass) =>
TypeRef(pre, sym, args map (_ => WildcardType))
case _ =>