diff options
author | Martin Odersky <odersky@gmail.com> | 2007-04-25 13:13:15 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-04-25 13:13:15 +0000 |
commit | e9bd1a35e7a70c96f8ee6a4535182ade766e6fa8 (patch) | |
tree | 3bad27c53f6afd618350ec15808ef8301987c1e9 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | |
parent | 26f25f8d8859afa8c3c54efdd1e17e7634cee790 (diff) | |
download | scala-e9bd1a35e7a70c96f8ee6a4535182ade766e6fa8.tar.gz scala-e9bd1a35e7a70c96f8ee6a4535182ade766e6fa8.tar.bz2 scala-e9bd1a35e7a70c96f8ee6a4535182ade766e6fa8.zip |
fixed test case.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index bc8f39908c..c061b0c9fd 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -864,6 +864,12 @@ trait Parsers { /** XXX: Hook for IDE */ def expr(location: int): Tree = { + def isWildcard(t: Tree): boolean = t match { + case Ident(name1) if !implicitParams.isEmpty && name1 == implicitParams.head.name => true + case Typed(t1, _) => isWildcard(t1) + case Annotated(t1, _) => isWildcard(t1) + case _ => false + } var savedImplicitParams = implicitParams implicitParams = List() var res = in.token match { @@ -969,6 +975,11 @@ trait Parsers { } else if (annots.isEmpty || isTypeIntro) { t = atPos(pos) { val tpt = if (location != Local) compoundType(false) else typ() + if (isWildcard(t)) + (implicitParams: @unchecked) match { + case (vd @ ValDef(mods, name, _, _)) :: rest => + implicitParams = copy.ValDef(vd, mods, name, tpt.duplicate, EmptyTree) :: rest + } // this does not correspond to syntax, but is necessary to // accept closures. We might restrict closures to be between {...} only! Typed(t, (tpt /: annots) (makeAnnotated)) @@ -991,12 +1002,6 @@ trait Parsers { } stripParens(t) } - def isWildcard(t: Tree): boolean = t match { - case Ident(name1) if name1 == implicitParams.head.name => true - case Typed(t1, _) => isWildcard(t1) - case Annotated(t1, _) => isWildcard(t1) - case _ => false - } if (!implicitParams.isEmpty) if (isWildcard(res)) savedImplicitParams = savedImplicitParams ::: implicitParams else res = Function(implicitParams.reverse, res) @@ -1155,7 +1160,7 @@ trait Parsers { */ def blockExpr(): Tree = { val res = atPos(accept(LBRACE)) { - if (in.token == CASE) makeVisitor(caseClauses(), true) + if (in.token == CASE) Match(EmptyTree, caseClauses()) else block() } accept(RBRACE) |