Skip to content

Commit cf52bf3

Browse files
committed
Update macros.md
1 parent 5b006fb commit cf52bf3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/docs/reference/metaprogramming/macros.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ In `scala.quoted.matching` contains object that can help extract values from `Ex
626626

627627
These could be used in the following way to optimize any call to `sum` that has statically known values.
628628
```scala
629-
inline def sum(args: =>Int*): Int = ${ sumExpr('args) }
630-
private def sumExpr(argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[Int] = argsExpr.underlyingArgument match {
629+
inline def sum(inline args: Int*): Int = ${ sumExpr('args) }
630+
private def sumExpr(argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[Int] = argsExpr match {
631631
case ConstSeq(args) => // args is of type Seq[Int]
632632
Expr(args.sum) // precompute result of sum
633633
case ExprSeq(argExprs) => // argExprs is of type Seq[Expr[Int]]
@@ -705,7 +705,7 @@ This might be used to then perform an implicit search as in:
705705

706706

707707
```scala
708-
inline def (sc: StringContext).showMe(args: =>Any*): String = ${ showMeExpr('sc, 'args) }
708+
inline def (sc: StringContext).showMe(inline args: Any*): String = ${ showMeExpr('sc, 'args) }
709709

710710
private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = {
711711
argsExpr match {

0 commit comments

Comments
 (0)