summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-10-31 12:52:53 +0000
committerMartin Odersky <odersky@gmail.com>2006-10-31 12:52:53 +0000
commit1ccd9b6ceddd2b234256eb6a549b7cb056cc5147 (patch)
tree1239f730ea23049db5c02c79e9196fca4cba1943 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parent37b3648e30cbce8ac9f2b9b48b63cdf15d6a2d34 (diff)
downloadscala-1ccd9b6ceddd2b234256eb6a549b7cb056cc5147.tar.gz
scala-1ccd9b6ceddd2b234256eb6a549b7cb056cc5147.tar.bz2
scala-1ccd9b6ceddd2b234256eb6a549b7cb056cc5147.zip
fixed bug756
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 0f9d334862..c7e59925d5 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -535,6 +535,7 @@ trait Parsers requires SyntaxAnalyzer {
accept(RPAREN)
atPos(accept(ARROW)) { makeByNameFunctionTypeTree(t0, typ()) }
} else {
+ val pos = in.currentPos
val t0 = typ()
if (in.token == COMMA) {
in.nextToken()
@@ -542,7 +543,8 @@ trait Parsers requires SyntaxAnalyzer {
accept(RPAREN)
atPos (accept(ARROW)) { makeFunctionTypeTree(ts.toList, typ()) }
} else {
- accept(RPAREN); t0
+ accept(RPAREN)
+ type1rest(pos, t0, false)
}
}
} else {
@@ -556,9 +558,11 @@ trait Parsers requires SyntaxAnalyzer {
/** Type1 ::= SimpleType {with SimpleType} [Refinement]
* TypePattern1 ::= SimpleTypePattern [TypePatternArgs]
*/
- def type1(isPattern: boolean): Tree = {
- val pos = in.currentPos
- var ts = new ListBuffer[Tree] + simpleType(isPattern)
+ def type1(isPattern: boolean): Tree =
+ type1rest(in.currentPos, simpleType(isPattern), isPattern)
+
+ def type1rest(pos: int, t: Tree, isPattern: boolean): Tree = {
+ var ts = new ListBuffer[Tree] + t
while (in.token == WITH && !isPattern) {
in.nextToken(); ts += simpleType(isPattern)
}