File tree Expand file tree Collapse file tree 2 files changed +2
-24
lines changed
docs/docs/reference/metaprogramming Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -656,7 +656,7 @@ private def sumExpr(argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[Int] = a
656656
657657#### Quoted patterns
658658
659- Quoted pattens allow to deconstruct complex code that contains a precise structure, types or methods.
659+ Quoted pattens allow deconstructing complex code that contains a precise structure, types or methods.
660660Patterns ` '{ ... } ` can be placed in any location where Scala expects a pattern.
661661
662662For example
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ the scope where it is used.
2626``` scala
2727import scala .quoted ._
2828
29- inline def natConst (x : => Int ): Int = $ {natConstImpl(' {x})}
29+ inline def natConst (inline x : Int ): Int = $ {natConstImpl(' {x})}
3030
3131def natConstImpl (x : Expr [Int ])(using qctx : QuoteContext ): Expr [Int ] = {
3232 import qctx .reflect ._
@@ -66,28 +66,6 @@ The method `qctx.reflect.Term.seal` provides a way to go back to a
6666must be set explicitly with a checked ` cast ` call. If the type does not conform
6767to it an exception will be thrown at runtime.
6868
69- ### Obtaining the underlying argument
70-
71- A macro can access the tree of the actual argument passed on the call-site. The
72- ` underlyingArgument ` method on a ` Term ` object will give access to the tree
73- defining the expression passed. For example the code below matches a selection
74- operation expression passed while calling the ` macro ` below.
75-
76- ``` scala
77- inline def macro (param : => Boolean ): Unit = $ { macroImpl(' param ) }
78-
79- def macroImpl (param : Expr [Boolean ])(using qctx : QuoteContext ): Expr [Unit ] = {
80- import qctx .reflect ._
81- import util ._
82-
83- param.unseal.underlyingArgument match {
84- case t @ Apply (Select (lhs, op), rhs :: Nil ) => ..
85- }
86- }
87-
88- // example
89- macro(this .checkCondition())
90- ```
9169
9270### Positions
9371
You can’t perform that action at this time.
0 commit comments