diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2017-03-30 21:54:11 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2017-03-30 21:54:11 +0200 |
commit | e9013104a367910ca4970fdde741528e84ced829 (patch) | |
tree | 0b3fe85794db1ae760d6c4dee29e58a85127336e /compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala | |
parent | c5031a7c27d7b714a7ff917ba539a077e4ec215d (diff) | |
download | dotty-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
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala | 7 |
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 } |