aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2017-03-30 21:54:11 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2017-03-30 21:54:11 +0200
commite9013104a367910ca4970fdde741528e84ced829 (patch)
tree0b3fe85794db1ae760d6c4dee29e58a85127336e
parentc5031a7c27d7b714a7ff917ba539a077e4ec215d (diff)
downloaddotty-e9013104a367910ca4970fdde741528e84ced829.tar.gz
dotty-e9013104a367910ca4970fdde741528e84ced829.tar.bz2
dotty-e9013104a367910ca4970fdde741528e84ced829.zip
PatMat, Outerchecks: Check outers for selections from singleton type.
Otherwise checks are done also on type projections. Same pitfall as https://issues.scala-lang.org/browse/SI-7214
-rw-r--r--compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 8d25175f2..b0ae36612 100644
--- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -852,9 +852,10 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {
// See the test for SI-7214 for motivation for dealias. Later `treeCondStrategy#outerTest`
// generates an outer test based on `patType.prefix` with automatically dealises.
expectedTp.dealias match {
- case tref @ TypeRef(pre, name) =>
- (pre ne NoPrefix) && tref.symbol.isClass &&
- ExplicitOuter.needsOuterIfReferenced(tref.symbol.asClass)
+ case tref @ TypeRef(pre: SingletonType, name) =>
+ val s = tref
+ s.symbol.isClass &&
+ ExplicitOuter.needsOuterIfReferenced(s.symbol.asClass)
case _ =>
false
}