summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-03 05:02:37 +0000
committerPaul Phillips <paulp@improving.org>2010-12-03 05:02:37 +0000
commit715d95479e77b06dd65303886d2e0e70ddcf461f (patch)
tree991f4e4be398f9b32ef6c4df49fbd927ae8dd6d6 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent31533385b7ac4e1643ad8664141f3d197dc637f1 (diff)
downloadscala-715d95479e77b06dd65303886d2e0e70ddcf461f.tar.gz
scala-715d95479e77b06dd65303886d2e0e70ddcf461f.tar.bz2
scala-715d95479e77b06dd65303886d2e0e70ddcf461f.zip
Generalizes catch blocks to include any Partial...
Generalizes catch blocks to include any PartialFunction[Throwable, T]. Existing catch blocks will compile exactly as before. Anything else (which mean: the token after CATCH is not a left brace, or it is a left brace not immediately followed by CASE) is desugared as follows: try body catch expr // becomes try body catch { case x => val catchFn = expr if (catchFn isDefinedAt x) catchFn(x) else throw x } Review by odersky.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index e1a8daf6c8..072bda9097 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1195,8 +1195,8 @@ trait Namers { self: Analyzer =>
}
def isValidSelector(from: Name)(fun : => Unit) {
- if (base.nonLocalMember(from) == NoSymbol &&
- base.nonLocalMember(from.toTypeName) == NoSymbol) fun
+ if (from.bothNames forall (x => (base nonLocalMember x) == NoSymbol))
+ fun
}
def checkSelectors(selectors: List[ImportSelector]): Unit = selectors match {