File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
docs/docs/reference/contextual Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ The implementation of `summonAll` as a macro can be show below assuming that we
9191have the given instances for our primitive types:
9292
9393``` scala
94- def summonAll [T : Type ](using qctx : QuoteContext ): List [Expr [Eq [_]]] = t match {
94+ def summonAll [T : Type ](using qctx : QuoteContext ): List [Expr [Eq [_]]] = Type .of[ T ] match {
9595 case ' [String *: tpes] => ' { summon[Eq [String ]] } :: summonAll[tpes]
9696 case ' [Int *: tpes] => ' { summon[Eq [Int ]] } :: summonAll[tpes]
9797 case ' [tpe *: tpes] => derived[tpe] :: summonAll[tpes]
@@ -169,7 +169,7 @@ object Eq {
169169 def eqv (x : T , y : T ): Boolean = body(x, y)
170170 }
171171
172- def summonAll [T : Type ](using qctx : QuoteContext ): List [Expr [Eq [_]]] = t match {
172+ def summonAll [T : Type ](using qctx : QuoteContext ): List [Expr [Eq [_]]] = Type .of[ T ] match {
173173 case ' [String *: tpes] => ' { summon[Eq [String ]] } :: summonAll[tpes]
174174 case ' [Int *: tpes] => ' { summon[Eq [Int ]] } :: summonAll[tpes]
175175 case ' [tpe *: tpes] => derived[tpe] :: summonAll[tpes]
@@ -217,7 +217,7 @@ object Eq {
217217}
218218
219219object Macro3 {
220- extension [T ](inline x : T )
220+ extension [T ](inline x : T )
221221 inline def === (inline y : T )(using eq : Eq [T ]): Boolean = eq.eqv(x, y)
222222
223223 implicit inline def eqGen [T ]: Eq [T ] = $ { Eq .derived[T ] }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ object Eq {
2525 def eqv (x : T , y : T ): Boolean = body(x, y)
2626 }
2727
28- def summonAll [T ]( using t : Type [ T ]) (using qctx : QuoteContext ): List [Expr [Eq [_]]] = t match {
28+ def summonAll [T : Type ] (using qctx : QuoteContext ): List [Expr [Eq [_]]] = Type .of[ T ] match {
2929 case ' [String *: tpes] => ' { summon[Eq [String ]] } :: summonAll[tpes]
3030 case ' [Int *: tpes] => ' { summon[Eq [Int ]] } :: summonAll[tpes]
3131 case ' [tpe *: tpes] => derived[tpe] :: summonAll[tpes]
You can’t perform that action at this time.
0 commit comments