File tree 4 files changed +31
-5
lines changed
compiler/src/scala/quoted/runtime/impl/printers
4 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -809,13 +809,10 @@ object SourceCode {
809
809
case Nil => Flags .EmptyFlags
810
810
case arg :: _ => arg.symbol.flags
811
811
}
812
- if (argFlags.is(Flags .Erased | Flags .Given )) {
813
- if (argFlags.is(Flags .Given )) this += " given"
814
- if (argFlags.is(Flags .Erased )) this += " erased"
815
- this += " "
816
- }
817
812
inParens {
818
813
if (argFlags.is(Flags .Implicit ) && ! argFlags.is(Flags .Given )) this += " implicit "
814
+ if (argFlags.is(Flags .Given )) this += " using "
815
+ if (argFlags.is(Flags .Erased )) this += " erased "
819
816
820
817
def printSeparated (list : List [ValDef ]): Unit = list match {
821
818
case Nil =>
Original file line number Diff line number Diff line change
1
+ @scala.annotation.internal.SourceFile("tests/run-macros/term-show/Test_2.scala") trait A() extends java.lang.Object {
2
+ def imp(x: scala.Int)(implicit str: scala.Predef.String): scala.Int
3
+ def use(`x₂`: scala.Int)(using `str₂`: scala.Predef.String): scala.Int
4
+ def era(`x₃`: scala.Int)(erased `str₃`: scala.Predef.String): scala.Int
5
+ }
Original file line number Diff line number Diff line change
1
+ import scala .quoted .*
2
+
3
+ object TypeToolbox {
4
+ inline def show (inline className : String ): String = $ { showImpl(' className ) }
5
+ private def showImpl (className : Expr [String ])(using Quotes ) : Expr [String ] =
6
+ import quotes .reflect .*
7
+ val Expr (name) = className : @ unchecked
8
+ val res = Symbol .requiredClass(name).tree.show
9
+ println(res)
10
+ Expr (res)
11
+ }
Original file line number Diff line number Diff line change
1
+ import scala .language .experimental .erasedDefinitions
2
+
3
+ trait A :
4
+ def imp (x : Int )(implicit str : String ): Int
5
+ def use (x : Int )(using str : String ): Int
6
+ def era (x : Int )(erased str : String ): Int
7
+
8
+ object Test {
9
+ import TypeToolbox .*
10
+ def main (args : Array [String ]): Unit = {
11
+ println(show(" A" ))
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments