aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/PatternMatcher.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2016-01-13 14:09:42 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2016-01-24 13:51:46 +0100
commit842e966a233084539fbc755320c83f8c6fed7ef0 (patch)
treef51b7054b31edec53a1ed51137308ae5157a013b /src/dotty/tools/dotc/transform/PatternMatcher.scala
parente9105c96253ae62cecb63e39764583f826876159 (diff)
downloaddotty-842e966a233084539fbc755320c83f8c6fed7ef0.tar.gz
dotty-842e966a233084539fbc755320c83f8c6fed7ef0.tar.bz2
dotty-842e966a233084539fbc755320c83f8c6fed7ef0.zip
Fix i939: Patmat shouldn't compare selectors to module TypeTrees.
It would be great to augment Ycheck to ensure that some trees are not permitted, e.g. TypeTree cannot be a stat in a block or a receiver of a call. Currently this is `ensured` by backend by failing.
Diffstat (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r--src/dotty/tools/dotc/transform/PatternMatcher.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 5b4d42683..7c8d0a10f 100644
--- a/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -787,7 +787,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// - Scala's arrays are invariant (so we don't drop type tests unsoundly)
if (extractorArgTypeTest) mkDefault
else expectedTp match {
- case ThisType(tref) if tref.symbol.flags is Flags.Module => and(mkEqualsTest(ref(tref.symbol)), mkTypeTest) // must use == to support e.g. List() == Nil
+ case ThisType(tref) if tref.symbol.flags is Flags.Module =>
+ and(mkEqualsTest(ref(tref.symbol.companionModule)), mkTypeTest) // must use == to support e.g. List() == Nil
case ConstantType(Constant(null)) if isAnyRef => mkEqTest(expTp(Literal(Constant(null))))
case ConstantType(const) => mkEqualsTest(expTp(Literal(const)))
case t:SingletonType => mkEqTest(singleton(expectedTp)) // SI-4577, SI-4897