summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-01-27 14:17:23 +1000
committerAdriaan Moors <adriaan@lightbend.com>2017-01-09 16:07:28 -0800
commit9165886936133d62a9f190a1a7587fbb889ecf9a (patch)
tree2535e3d082600b6c1ef8b5cbbb5e9b080d39ea16 /src
parent4f5c30e10a16697edbe7bb6b4719ff09f5c3900b (diff)
downloadscala-9165886936133d62a9f190a1a7587fbb889ecf9a.tar.gz
scala-9165886936133d62a9f190a1a7587fbb889ecf9a.tar.bz2
scala-9165886936133d62a9f190a1a7587fbb889ecf9a.zip
SI-9114 Fix crasher in pattern matcher with type aliases
When determining whether or not a pattern match requires an equality check of the outer instance of a type in addition to a type test, `needsOuterTest` determines if the intersection of the selector and the pattern types could be populated. Both type arrive at `isPopulated` dealised. However, `isPopulated` recurs when it encounters an existential, and, as seen in thest case, a failure to dealias the quantified type can lead to an assertion failure as we try to relate a typeref to an alias and a typeref to a class. See also SI-7214, which added deliasing of the pattern type before calling `isPopulated`.
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 92df4ba3af..28b16eeb1a 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -3891,7 +3891,7 @@ trait Types
* any corresponding non-variant type arguments of bt1 and bt2 are the same
*/
def isPopulated(tp1: Type, tp2: Type): Boolean = {
- def isConsistent(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match {
+ def isConsistent(tp1: Type, tp2: Type): Boolean = (tp1.dealias, tp2.dealias) match {
case (TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
assert(sym1 == sym2, (sym1, sym2))
( pre1 =:= pre2