diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-12-18 10:07:23 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-12-18 10:07:23 -0800 |
commit | ecc63690f11c0c72bff62c79277761b0a04f259c (patch) | |
tree | 72abc8e4d759eb812dea0bbd8068cfea33e042fe /src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala | |
parent | 640c95500e73f811fb86c4267afc504ff3be1e7b (diff) | |
parent | 5b8327b807c40cab867065cf695191a36c9210ee (diff) | |
download | scala-ecc63690f11c0c72bff62c79277761b0a04f259c.tar.gz scala-ecc63690f11c0c72bff62c79277761b0a04f259c.tar.bz2 scala-ecc63690f11c0c72bff62c79277761b0a04f259c.zip |
Merge pull request #4122 from retronym/ticket/7459-2
SI-7459 Handle pattern binders used as prefixes in TypeTrees.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala index 647719bf3e..971a019e4e 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala @@ -167,8 +167,17 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging { val usedBinders = new mutable.HashSet[Symbol]() // all potentially stored subpat binders val potentiallyStoredBinders = stored.unzip._1.toSet + def ref(sym: Symbol) = + if (potentiallyStoredBinders(sym)) usedBinders += sym // compute intersection of all symbols in the tree `in` and all potentially stored subpat binders - in.foreach(t => if (potentiallyStoredBinders(t.symbol)) usedBinders += t.symbol) + in.foreach { + case tt: TypeTree => + tt.tpe foreach { // SI-7459 e.g. case Prod(t) => new t.u.Foo + case SingleType(_, sym) => ref(sym) + case _ => + } + case t => ref(t.symbol) + } if (usedBinders.isEmpty) in else { |