You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add scala.quoted.Expr.unapply as dual of Expr.apply
`Expr.unapply` replaces `Unlifted.unapply` using the same signature that uses an `Unliftable` to perform the unlifting. The overload the works on sequences of expression is moved to `Exprs.unapply` (similar to `Consts.unapply`).
Copy file name to clipboardExpand all lines: docs/docs/reference/metaprogramming/macros.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -632,16 +632,16 @@ It is possible to deconstruct or extract values out of `Expr` using pattern matc
632
632
633
633
`scala.quoted` contains objects that can help extracting values from `Expr`.
634
634
635
-
*`scala.quoted.Unlifted`: matches an expression of a value (or list of values) and returns the value (or list of values).
636
-
*`scala.quoted.Const`/`scala.quoted.Consts`: Same as `Unlifted` but only works on primitive values.
637
-
*`scala.quoted.Varargs`: matches an explicit sequence of expressions and returns them. These sequences are useful to get individual `Expr[T]` out of a varargs expression of type `Expr[Seq[T]]`.
635
+
*`scala.quoted.Expr`/`scala.quoted.Exprs`: matches an expression of a value (or list of values) and returns the value (or list of values).
636
+
*`scala.quoted.Const`/`scala.quoted.Consts`: Same as `Expr`/`Exprs` but only works on primitive values.
637
+
*`scala.quoted.Varargs`: matches an explicit sequence of expresions and returns them. These sequences are useful to get individual `Expr[T]` out of a varargs expression of type `Expr[Seq[T]]`.
638
638
639
639
640
640
These could be used in the following way to optimize any call to `sum` that has statically known values.
0 commit comments