diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-06 17:49:39 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-08 13:33:52 +0200 |
commit | 1206a813e8550cb49ebc3fbcc1de51c6daa3eadd (patch) | |
tree | 83c1efde0a95f0d70982cde3683aa4215d69be55 /src/dotty/tools/dotc/transform/PatternMatcher.scala | |
parent | ebe3290f487b12cf4778c5affeeb42324cd5fbc6 (diff) | |
download | dotty-1206a813e8550cb49ebc3fbcc1de51c6daa3eadd.tar.gz dotty-1206a813e8550cb49ebc3fbcc1de51c6daa3eadd.tar.bz2 dotty-1206a813e8550cb49ebc3fbcc1de51c6daa3eadd.zip |
PatternMatcher: fix bug with undefined variable inside huge patterns.
Diffstat (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index 0a019e1c5..b1140a144 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -464,7 +464,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // all potentially stored subpat binders val potentiallyStoredBinders = stored.unzip._1.toSet // compute intersection of all symbols in the tree `in` and all potentially stored subpat binders - new DeepFolder[Unit]((x: Unit, t:Tree) => if (potentiallyStoredBinders(t.symbol)) usedBinders += t.symbol).apply((), in) + new DeepFolder[Unit]((x: Unit, t:Tree) => + if (potentiallyStoredBinders(t.symbol)) usedBinders += t.symbol).apply((), in) if (usedBinders.isEmpty) in else { @@ -1440,9 +1441,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // require (nbSubPats > 0 && (!lastIsStar || isSeq)) protected def subPatRefs(binder: Symbol): List[Tree] = { val refs = if (totalArity > 0 && isSeq) subPatRefsSeq(binder) - else if (defn.isProductSubType(binder.info)) productElemsToN(binder, totalArity) + else if (totalArity > 1 && !isSeq) productElemsToN(binder, totalArity) else ref(binder):: Nil - val refsSymbols = refs.map(_.symbol) // just for debugging refs } |