Skip to content

Commit 7f9208b

Browse files
committed
erased is per parameter instead of for the entire parameter list
1 parent 49408ed commit 7f9208b

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ object SourceCode {
812812
inParens {
813813
if (argFlags.is(Flags.Implicit) && !argFlags.is(Flags.Given)) this += "implicit "
814814
if (argFlags.is(Flags.Given)) this += "using "
815-
if (argFlags.is(Flags.Erased)) this += "erased "
816815

817816
def printSeparated(list: List[ValDef]): Unit = list match {
818817
case Nil =>
@@ -843,6 +842,9 @@ object SourceCode {
843842
private def printParamDef(arg: ValDef)(using elideThis: Option[Symbol]): Unit = {
844843
val name = splicedName(arg.symbol).getOrElse(arg.symbol.name)
845844
val sym = arg.symbol.owner
845+
846+
if (arg.symbol.flags.is(Flags.Erased)) this += "erased "
847+
846848
if sym.isDefDef && sym.name == "<init>" then
847849
val ClassDef(_, _, _, _, body) = sym.owner.tree: @unchecked
848850
body.collectFirst {

tests/run-macros/term-show.check

+4
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
def imp(x: scala.Int)(implicit str: scala.Predef.String): scala.Int
33
def use(`x₂`: scala.Int)(using `str₂`: scala.Predef.String): scala.Int
44
def era(`x₃`: scala.Int)(erased `str₃`: scala.Predef.String): scala.Int
5+
def f1(x1: scala.Int, erased x2: scala.Int): scala.Int
6+
def f2(erased `x1₂`: scala.Int, erased `x2₂`: scala.Int): scala.Int
7+
def f3(using `x1₃`: scala.Int, erased `x2₃`: scala.Int): scala.Int
8+
def f4(using erased `x1₄`: scala.Int, erased `x2₄`: scala.Int): scala.Int
59
}

tests/run-macros/term-show/Test_2.scala

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ trait A:
55
def use(x: Int)(using str: String): Int
66
def era(x: Int)(erased str: String): Int
77

8+
def f1(x1: Int, erased x2: Int): Int
9+
def f2(erased x1: Int, erased x2: Int): Int
10+
def f3(using x1: Int, erased x2: Int): Int
11+
def f4(using erased x1: Int, erased x2: Int): Int
12+
813
object Test {
914
import TypeToolbox.*
1015
def main(args: Array[String]): Unit = {

0 commit comments

Comments
 (0)