summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-11-30 17:57:15 +0000
committerPaul Phillips <paulp@improving.org>2010-11-30 17:57:15 +0000
commit51e4a6a351a64a1bff995e1b5fefb88c7e2430eb (patch)
tree4253b1cd295417b235de10df0484861397c4eaec /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parent81f38907b838caa64d26b4ea49efe938a3d0673f (diff)
downloadscala-51e4a6a351a64a1bff995e1b5fefb88c7e2430eb.tar.gz
scala-51e4a6a351a64a1bff995e1b5fefb88c7e2430eb.tar.bz2
scala-51e4a6a351a64a1bff995e1b5fefb88c7e2430eb.zip
Parser relaxation so that one can name the type...
Parser relaxation so that one can name the type variables in a constructor pattern match: this is a prerequisite to realizing the full potential of gadts. (Nothing new works here however.) No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 09f1db7249..1ae9a9d8c0 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1633,19 +1633,14 @@ self =>
}
case _ =>
}
- /* not yet
- if (in.token == LBRACKET)
- atPos(in.offset) {
- val ts = typeArgs(true, false)
- accept(LPAREN)
- val ps = if (in.token == RPAREN) List() else patterns(true, false)
- accept(RPAREN)
- Apply(TypeApply(convertToTypeId(t), ts), ps)
- }
- else */
- if (in.token == LPAREN)
- atPos(start, in.offset) { Apply(t, argumentPatterns()) }
- else t
+ val typeAppliedTree = in.token match {
+ case LBRACKET => atPos(start, in.offset)(TypeApply(convertToTypeId(t), typeArgs(true, false)))
+ case _ => t
+ }
+ in.token match {
+ case LPAREN => atPos(start, in.offset)(Apply(typeAppliedTree, argumentPatterns()))
+ case _ => typeAppliedTree
+ }
case USCORE =>
in.nextToken()
atPos(start, start) { Ident(nme.WILDCARD) }