summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-03-12 10:56:34 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-03-12 10:56:34 -0700
commit9c38e86a5526887f93a3f031b19a0e4fa31745d3 (patch)
tree1425f583bb3d084566f7acc40d64d5e30402f5fb
parent3e6c87ef26148fec25a054c27d8f55f191c69113 (diff)
parent5ef842ec09b58208ab30ffb2b6773b95099b07e7 (diff)
downloadscala-9c38e86a5526887f93a3f031b19a0e4fa31745d3.tar.gz
scala-9c38e86a5526887f93a3f031b19a0e4fa31745d3.tar.bz2
scala-9c38e86a5526887f93a3f031b19a0e4fa31745d3.zip
Merge pull request #3622 from retronym/ticket/8395
SI-8395 Regression in pattern matching with nested binds
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala8
-rw-r--r--test/files/run/t8395.scala9
2 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
index 699e98f963..4cf8980689 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
@@ -81,14 +81,14 @@ trait MatchTranslation {
object SymbolAndTypeBound {
def unapply(tree: Tree): Option[(Symbol, Type)] = tree match {
- case SymbolBound(sym, SymbolAndTypeBound(_, tpe)) => Some(sym -> tpe)
- case TypeBound(tpe) => Some(binder -> tpe)
- case _ => None
+ case SymbolBound(sym, TypeBound(tpe)) => Some(sym -> tpe)
+ case TypeBound(tpe) => Some(binder -> tpe)
+ case _ => None
}
}
object TypeBound {
- def unapply(tree: Tree): Option[Type] = unbind(tree) match {
+ def unapply(tree: Tree): Option[Type] = tree match {
case Typed(Ident(_), _) if tree.tpe != null => Some(tree.tpe)
case _ => None
}
diff --git a/test/files/run/t8395.scala b/test/files/run/t8395.scala
new file mode 100644
index 0000000000..2570550619
--- /dev/null
+++ b/test/files/run/t8395.scala
@@ -0,0 +1,9 @@
+ object Test {
+ def baz(x: Object) = {
+ val s @ (_s: String) = x
+ x
+ }
+ def main(args: Array[String]) {
+ assert(baz("1") == "1")
+ }
+}