File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1717 |Inline stack trace
1818 |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1919 |This location contains code that was inlined from Test.scala:5
20- 5 | implicit inline def implicitMakeSerializer [T]: Serializer[T] = ${ Macros.makeSerializer[T] }
21- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+ 5 | inline given [T] => Serializer[T] = ${ Macros.makeSerializer[T] }
21+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2222 ---------------------------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import scala.annotation.{experimental, targetName}
44import scala .quoted .*
55import scala .util .Try
66
7- object Macros {
8- def makeSerializer [T : Type ](using Quotes ): Expr [Serializer [T ]] = {
7+ object Macros :
8+ def makeSerializer [T : Type ](using Quotes ): Expr [Serializer [T ]] =
99 import quotes .reflect .*
1010
1111 val tpe : TypeRepr = TypeRepr .of[T ]
@@ -14,7 +14,7 @@ object Macros {
1414 val modSym : Symbol = Symbol .newModule(
1515 Symbol .spliceOwner,
1616 name,
17- Flags .Implicit ,
17+ Flags .Given ,
1818 Flags .EmptyFlags ,
1919 _ => List (TypeRepr .of[Object ], TypeRepr .of[Serializer [T ]]),
2020 _ => Nil ,
@@ -25,5 +25,3 @@ object Macros {
2525 ClassDef .module(modSym, List (TypeTree .of[Serializer [T ]]), Nil )
2626
2727 Block (List (modValDef, modClassDef), Ref (modSym)).asExprOf[Serializer [T ]]
28- }
29- }
Original file line number Diff line number Diff line change 22trait Serializer [@ specialized T ]
33
44object Serializer :
5- implicit inline def implicitMakeSerializer [T ]: Serializer [T ] = $ { Macros .makeSerializer[T ] }
5+ inline given [T ] => Serializer [T ] = $ { Macros .makeSerializer[T ] }
66
77case class ValidationCls (string : String )
88
9- @ main def Test = summon[Serializer [ValidationCls ]] // error
9+ @ main def Test = summon[Serializer [ValidationCls ]] // error
You can’t perform that action at this time.
0 commit comments