Skip to content

Commit 877d633

Browse files
committed
Fix example code with adding required QuoteContext's
1 parent f022c14 commit 877d633

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/docs/reference/metaprogramming/macros.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ reference to a type `T` in subsequent phases to a type-splice, by rewriting `T`
199199
For instance, the user-level definition of `to`:
200200

201201
```scala
202-
def to[T: Type, R: Type](f: Expr[T] => Expr[R]): Expr[T => R] =
202+
def to[T: Type, R: Type](f: Expr[T] => Expr[R])(using QuoteContext): Expr[T => R] =
203203
'{ (x: T) => ${ f('x) } }
204204
```
205205
would be rewritten to
206206
```scala
207-
def to[T: Type, R: Type](f: Expr[T] => Expr[R]): Expr[T => R] =
207+
def to[T: Type, R: Type](f: Expr[T] => Expr[R])(using QuoteContext): Expr[T => R] =
208208
'{ (x: ${ summon[Type[T]] }) => ${ f('x) } }
209209
```
210210
The `summon` query succeeds because there is a given instance of

0 commit comments

Comments
 (0)