Skip to content

Commit c05153d

Browse files
committed
SI-8281 check for unbound placeholder parameters in quasiquote parser
1 parent 13e7b81 commit c05153d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ trait Parsers { self: Quasiquotes =>
2222
def parse(code: String): Tree = {
2323
try {
2424
val file = new BatchSourceFile(nme.QUASIQUOTE_FILE, code)
25-
new QuasiquoteParser(file).parseRule(entryPoint)
25+
val parser = new QuasiquoteParser(file)
26+
parser.checkNoEscapingPlaceholders { parser.parseRule(entryPoint) }
2627
} catch {
2728
case mi: MalformedInput => c.abort(correspondingPosition(mi.offset), mi.msg)
2829
}

test/files/scalacheck/quasiquotes/ErrorProps.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,18 @@ object ErrorProps extends QuasiquoteProperties("errors") {
160160
q"$n"
161161
""")
162162

163+
property("SI-8211: check unbound placeholder paremeters") = fails(
164+
"unbound placeholder parameter",
165+
"""
166+
q"_"
167+
""")
168+
169+
property("SI-8211: check unbound wildcard types") = fails(
170+
"unbound wildcard type",
171+
"""
172+
tq"_"
173+
""")
174+
163175
// // Make sure a nice error is reported in this case
164176
// { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" }
165177
}

0 commit comments

Comments
 (0)