Skip to content

Commit

Permalink
SI-8281 check for unbound placeholder parameters in quasiquote parser
Browse files Browse the repository at this point in the history
  • Loading branch information
densh committed Feb 28, 2014
1 parent 13e7b81 commit c05153d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala
Expand Up @@ -22,7 +22,8 @@ trait Parsers { self: Quasiquotes =>
def parse(code: String): Tree = {
try {
val file = new BatchSourceFile(nme.QUASIQUOTE_FILE, code)
new QuasiquoteParser(file).parseRule(entryPoint)
val parser = new QuasiquoteParser(file)
parser.checkNoEscapingPlaceholders { parser.parseRule(entryPoint) }
} catch {
case mi: MalformedInput => c.abort(correspondingPosition(mi.offset), mi.msg)
}
Expand Down
12 changes: 12 additions & 0 deletions test/files/scalacheck/quasiquotes/ErrorProps.scala
Expand Up @@ -160,6 +160,18 @@ object ErrorProps extends QuasiquoteProperties("errors") {
q"$n"
""")

property("SI-8211: check unbound placeholder paremeters") = fails(
"unbound placeholder parameter",
"""
q"_"
""")

property("SI-8211: check unbound wildcard types") = fails(
"unbound wildcard type",
"""
tq"_"
""")

// // Make sure a nice error is reported in this case
// { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" }
}

0 comments on commit c05153d

Please sign in to comment.