From 4637614570cff6194b5e7df49a31a9296286ec60 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 19 Nov 2020 16:11:28 +0100 Subject: [PATCH] Fix examples in derivation-macro.md --- docs/docs/reference/contextual/derivation-macro.md | 6 +++--- tests/run-macros/i8007/Macro_3.scala | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/reference/contextual/derivation-macro.md b/docs/docs/reference/contextual/derivation-macro.md index e204fd5a52d6..a4df3f4e7711 100644 --- a/docs/docs/reference/contextual/derivation-macro.md +++ b/docs/docs/reference/contextual/derivation-macro.md @@ -91,7 +91,7 @@ The implementation of `summonAll` as a macro can be show below assuming that we have the given instances for our primitive types: ```scala - def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = t match { + def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = Type.of[T] match { case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes] case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes] case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes] @@ -169,7 +169,7 @@ object Eq { def eqv(x: T, y: T): Boolean = body(x, y) } - def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = t match { + def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = Type.of[T] match { case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes] case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes] case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes] @@ -217,7 +217,7 @@ object Eq { } object Macro3 { - extension [T](inline x: T) + extension [T](inline x: T) inline def === (inline y: T)(using eq: Eq[T]): Boolean = eq.eqv(x, y) implicit inline def eqGen[T]: Eq[T] = ${ Eq.derived[T] } diff --git a/tests/run-macros/i8007/Macro_3.scala b/tests/run-macros/i8007/Macro_3.scala index 2350abc54928..2cfde64538ec 100644 --- a/tests/run-macros/i8007/Macro_3.scala +++ b/tests/run-macros/i8007/Macro_3.scala @@ -25,7 +25,7 @@ object Eq { def eqv(x: T, y: T): Boolean = body(x, y) } - def summonAll[T](using t: Type[T])(using qctx: QuoteContext): List[Expr[Eq[_]]] = t match { + def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = Type.of[T] match { case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes] case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes] case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes]