diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala | 8 | ||||
-rw-r--r-- | test/files/run/t8395.scala | 9 |
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") + } +} |