Skip to content

Commit

Permalink
Merge pull request #3389 from kitbellew/3388
Browse files Browse the repository at this point in the history
PlaceholderChecks: don't access field if Quasi
  • Loading branch information
tgodzik committed Nov 10, 2023
2 parents 491b8b2 + b3396e5 commit aa66a8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Expand Up @@ -38,7 +38,8 @@ object PlaceholderChecks {
case t: Term.Select => queue += t.qual; iter
case t: Term.Tuple => t.args.exists(isPlaceholder) || queue.nonEmpty && iter
case t: Init =>
t.argClauses.exists(_.values.exists(isPlaceholder)) || queue.nonEmpty && iter
t.argClauses.exists(x => !x.isInstanceOf[Quasi] && x.values.exists(isPlaceholder)) ||
queue.nonEmpty && iter
case t: Term.Apply => queue += t.fun; queue += t.argClause; iter
case t: Term.ArgClause =>
isBlockPlaceholder(t.values) || (t.parent match {
Expand Down
Expand Up @@ -2988,4 +2988,16 @@ class SuccessSuite extends TreeSuiteBase {
}
}

test("#3388") {
val term = q"""new Foo(a = a, b = b)"""
val assignA = Term.Assign(Term.Name("a"), Term.Name("a"))
val assignB = Term.Assign(Term.Name("b"), Term.Name("b"))

val q"""new Foo(..$params2)""" = term
assertTrees(params2: _*)(assignA, assignB)

val q"""new Foo(...$params3)""" = term
assertTrees(params3: _*)(Term.ArgClause(List(assignA, assignB), None))
}

}

0 comments on commit aa66a8a

Please sign in to comment.