Skip to content

Commit 0910940

Browse files
committed
Only print using when not a lambda
1 parent 7f9208b commit 0910940

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ object SourceCode {
460460

461461
case tree @ Lambda(params, body) => // must come before `Block`
462462
inParens {
463-
printArgsDefs(params)
463+
printArgsDefs(params, isLambda = true)
464464
this += (if tree.tpe.isContextFunctionType then " ?=> " else " => ")
465465
printTree(body)
466466
}
@@ -804,14 +804,14 @@ object SourceCode {
804804
}
805805
}
806806

807-
private def printArgsDefs(args: List[ValDef])(using elideThis: Option[Symbol]): Unit = {
807+
private def printArgsDefs(args: List[ValDef], isLambda: Boolean = false)(using elideThis: Option[Symbol]): Unit = {
808808
val argFlags = args match {
809809
case Nil => Flags.EmptyFlags
810810
case arg :: _ => arg.symbol.flags
811811
}
812812
inParens {
813813
if (argFlags.is(Flags.Implicit) && !argFlags.is(Flags.Given)) this += "implicit "
814-
if (argFlags.is(Flags.Given)) this += "using "
814+
if (argFlags.is(Flags.Given) && !isLambda) this += "using "
815815

816816
def printSeparated(list: List[ValDef]): Unit = list match {
817817
case Nil =>

0 commit comments

Comments
 (0)