Skip to content

Commit

Permalink
SI-8171 make tq"" an alias for empty type tree
Browse files Browse the repository at this point in the history
  • Loading branch information
densh committed Jan 24, 2014
1 parent fdce4a0 commit 40f1ff2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala
Expand Up @@ -170,7 +170,12 @@ trait Parsers { self: Quasiquotes =>
}

object TypeParser extends Parser {
def entryPoint = _.typ()
def entryPoint = { parser =>
if (parser.in.token == EOF)
TypeTree()
else
parser.typ()
}
}

object CaseParser extends Parser {
Expand Down
Expand Up @@ -28,4 +28,10 @@ object TypeConstructionProps extends QuasiquoteProperties("type construction")
val restpe = tq"C"
assert(tq"..$argtpes => $restpe"tq"(A, B) => C")
}
}

property("empty tq") = test {
val tt: TypeTree = tq" "
assert(tt.tpe == null)
assert(tt.original == null)
}
}

0 comments on commit 40f1ff2

Please sign in to comment.