File tree 3 files changed +7
-9
lines changed
3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 17
17
|Inline stack trace
18
18
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19
19
|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
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
22
---------------------------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import scala.annotation.{experimental, targetName}
4
4
import scala .quoted .*
5
5
import scala .util .Try
6
6
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 ]] =
9
9
import quotes .reflect .*
10
10
11
11
val tpe : TypeRepr = TypeRepr .of[T ]
@@ -14,7 +14,7 @@ object Macros {
14
14
val modSym : Symbol = Symbol .newModule(
15
15
Symbol .spliceOwner,
16
16
name,
17
- Flags .Implicit ,
17
+ Flags .Given ,
18
18
Flags .EmptyFlags ,
19
19
_ => List (TypeRepr .of[Object ], TypeRepr .of[Serializer [T ]]),
20
20
_ => Nil ,
@@ -25,5 +25,3 @@ object Macros {
25
25
ClassDef .module(modSym, List (TypeTree .of[Serializer [T ]]), Nil )
26
26
27
27
Block (List (modValDef, modClassDef), Ref (modSym)).asExprOf[Serializer [T ]]
28
- }
29
- }
Original file line number Diff line number Diff line change 2
2
trait Serializer [@ specialized T ]
3
3
4
4
object Serializer :
5
- implicit inline def implicitMakeSerializer [T ]: Serializer [T ] = $ { Macros .makeSerializer[T ] }
5
+ inline given [T ] => Serializer [T ] = $ { Macros .makeSerializer[T ] }
6
6
7
7
case class ValidationCls (string : String )
8
8
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