File tree Expand file tree Collapse file tree 4 files changed +26
-5
lines changed
compiler/src/scala/quoted/runtime/impl/printers Expand file tree Collapse file tree 4 files changed +26
-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 @@ -5,4 +5,14 @@ object TypeToolbox {
5
5
private def showImpl (using Quotes )(v : Expr [Any ]): Expr [String ] =
6
6
import quotes .reflect .*
7
7
Expr (v.show)
8
+
9
+ /*
10
+ inline def show(inline className: String): String = ${ showImpl('className) }
11
+ private def showImpl(className: Expr[String])(using Quotes) : Expr[String] =
12
+ import quotes.reflect.*
13
+ val Expr(name) = className: @unchecked
14
+ val res = Symbol.requiredClass(name).tree.show
15
+ println(res)
16
+ Expr(res)
17
+ */
8
18
}
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
+
1
8
object Test {
2
9
import TypeToolbox .*
3
10
def main (args : Array [String ]): Unit = {
@@ -25,5 +32,7 @@ object Test {
25
32
| }
26
33
| ()
27
34
|}""" .stripMargin)
35
+
36
+ println(show(" A" ))
28
37
}
29
38
}
You can’t perform that action at this time.
0 commit comments