File tree 1 file changed +3
-3
lines changed
docs/docs/reference/metaprogramming
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -626,8 +626,8 @@ In `scala.quoted.matching` contains object that can help extract values from `Ex
626
626
627
627
These could be used in the following way to optimize any call to ` sum ` that has statically known values.
628
628
``` 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 {
631
631
case ConstSeq (args) => // args is of type Seq[Int]
632
632
Expr (args.sum) // precompute result of sum
633
633
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:
705
705
706
706
707
707
``` 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 ) }
709
709
710
710
private def showMeExpr (sc : Expr [StringContext ], argsExpr : Expr [Seq [Any ]])(using qctx : QuoteContext ): Expr [String ] = {
711
711
argsExpr match {
You can’t perform that action at this time.
0 commit comments