Skip to content

Commit 426a3d1

Browse files
committed
Fix derivation macro example
Issue found in #13926 (comment) Tested in tests/run-macros/i8007/Macro_3.scala (already up to date).
1 parent 4e41a4c commit 426a3d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/_docs/reference/contextual/derivation-macro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ given derived[T: Type](using Quotes): Expr[Eq[T]] =
4949
ev match
5050
case '{ $m: Mirror.ProductOf[T] { type MirroredElemTypes = elementTypes }} =>
5151
val elemInstances = summonAll[elementTypes]
52-
val eqProductBody: (Expr[T], Expr[T]) => Expr[Boolean] = (x, y) =>
52+
def eqProductBody(Expr[T], Expr[T])(using Quotes): Expr[Boolean] = (x, y) =>
5353
elemInstances.zipWithIndex.foldLeft(Expr(true: Boolean)) {
5454
case (acc, (elem, index)) =>
5555
val e1 = '{$x.asInstanceOf[Product].productElement(${Expr(index)})}

0 commit comments

Comments
 (0)