File tree 3 files changed +13
-14
lines changed
3 files changed +13
-14
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,12 +6,10 @@ object TypeToolbox {
6
6
import quotes .reflect .*
7
7
Expr (v.show)
8
8
9
- /*
10
- inline def show(inline className: String): String = ${ showImpl('className) }
11
- private def showImpl(className: Expr[String])(using Quotes) : Expr[String] =
9
+ inline def showTree (inline className : String ): String = $ { showTreeImpl(' className ) }
10
+ private def showTreeImpl (className : Expr [String ])(using Quotes ) : Expr [String ] =
12
11
import quotes .reflect .*
13
12
val name = className.valueOrAbort
14
13
val res = Symbol .requiredClass(name).tree.show
15
14
Expr (res)
16
- */
17
15
}
Original file line number Diff line number Diff line change @@ -38,6 +38,16 @@ object Test {
38
38
| ()
39
39
|}""" .stripMargin)
40
40
41
- println(show(" A" ))
41
+ assert(showTree(" A" )
42
+ ==
43
+ """ @scala.annotation.internal.SourceFile("tests/run-macros/term-show/Test_2.scala") trait A() extends java.lang.Object {
44
+ | def imp(x: scala.Int)(implicit str: scala.Predef.String): scala.Int
45
+ | def use(`x₂`: scala.Int)(using `str₂`: scala.Predef.String): scala.Int
46
+ | def era(`x₃`: scala.Int)(erased `str₃`: scala.Predef.String): scala.Int
47
+ | def f1(x1: scala.Int, erased x2: scala.Int): scala.Int
48
+ | def f2(erased `x1₂`: scala.Int, erased `x2₂`: scala.Int): scala.Int
49
+ | def f3(using `x1₃`: scala.Int, erased `x2₃`: scala.Int): scala.Int
50
+ | def f4(using erased `x1₄`: scala.Int, erased `x2₄`: scala.Int): scala.Int
51
+ |}""" .stripMargin)
42
52
}
43
53
}
You can’t perform that action at this time.
0 commit comments