aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/PatternMatcher.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-10-24 21:00:51 +0200
committerMartin Odersky <odersky@gmail.com>2014-10-26 16:24:02 +0100
commitf459bf085d743c801fe724089438c0082014121f (patch)
treeb9b1fba1112c36387d3a7b862d8f611e9cca2e1d /src/dotty/tools/dotc/transform/PatternMatcher.scala
parenta5878de9409c4d511c482a296ec6a3e85e868b93 (diff)
downloaddotty-f459bf085d743c801fe724089438c0082014121f.tar.gz
dotty-f459bf085d743c801fe724089438c0082014121f.tar.bz2
dotty-f459bf085d743c801fe724089438c0082014121f.zip
Fix PreserveSubPatBinders not storing subparts that are used only for type tests.
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 4a1a66fbc..8af1b4a21 100644
--- a/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -428,6 +428,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
private lazy val (stored, substed) = (subPatBinders, subPatRefs).zipped.partition{ case (sym, _) => storedBinders(sym) }
+ // dd: this didn't yet trigger error. But I believe it would. if this causes double denition of symbol error this can be replaced with NoRebindings
protected lazy val introducedRebindings: Rebindings = if (!emitVars) Rebindings(subPatBinders, subPatRefs)
else {
val (subPatBindersSubstituted, subPatRefsSubstituted) = substed.unzip
@@ -948,7 +949,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
case Bind(nme.WILDCARD, _) => true // don't skip when binding an interesting symbol!
case Ident(nme.WILDCARD) => true
case Alternative(ps) => ps forall unapply
- case Typed(PatternBoundToUnderscore(), _) => true
+ case Typed(PatternBoundToUnderscore(), _) => false // true // Dmitry: change in dotty. Type test will be performed and the field must be stored
case _ => false
}
}