File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed
library/src/scala/tasty/reflect Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -1228,7 +1228,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
1228
1228
1229
1229
def printAnnotation (annot : Term )(given elideThis : Option [Symbol ]): Buffer = {
1230
1230
val Annotation (ref, args) = annot
1231
- if (annot.symbol.owner.fullName == " scala.internal.quoted.showName" ) this
1231
+ if (annot.symbol.exists && annot.symbol. owner.fullName == " scala.internal.quoted.showName" ) this
1232
1232
else {
1233
1233
this += " @"
1234
1234
printTypeTree(ref)
Original file line number Diff line number Diff line change
1
+ scala.List.apply[scala.PartialFunction[scala.Int, scala.Predef.String]]((((x$1: scala.Int) => (x$1: @scala.unchecked) match {
2
+ case 1 =>
3
+ "x"
4
+ }): scala.<repeated>[scala.PartialFunction[scala.Int, scala.Predef.String]]))
Original file line number Diff line number Diff line change
1
+ import quoted ._
2
+ object Main {
3
+
4
+ def myMacroImpl (body : Expr [_])(given qctx : QuoteContext ): Expr [_] = {
5
+ import qctx .tasty .{_ , given }
6
+ val bodyTerm = body.underlyingArgument.unseal
7
+ val showed = bodyTerm.show
8
+ ' {
9
+ println($ {Expr (showed)})
10
+ $ {bodyTerm.seal}
11
+ }
12
+ }
13
+
14
+ inline def myMacro (body : => Any ) <: Any = $ {
15
+ myMacroImpl(' body )
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]) = {
3
+ val _ = Main .myMacro(List [PartialFunction [Int , String ]] {
4
+ case 1 => " x"
5
+ })
6
+ }
7
+ }
You can’t perform that action at this time.
0 commit comments