File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
docs/docs/reference/metaprogramming Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ Here’s a compiler that maps an expression given in the interpreted
220
220
language to quoted Scala code of type ` Expr[Int] ` .
221
221
The compiler takes an environment that maps variable names to Scala ` Expr ` s.
222
222
``` scala
223
- import given scala .quoted ._
223
+ import scala .quoted .{ given , _ }
224
224
225
225
def compile (e : Exp , env : Map [String , Expr [Int ]]): Expr [Int ] = e match {
226
226
case Num (n) =>
@@ -308,10 +308,10 @@ def showExpr[T](expr: Expr[T]): Expr[String] = {
308
308
}
309
309
```
310
310
That is, the ` showExpr ` method converts its ` Expr ` argument to a string (` code ` ), and lifts
311
- the result back to an ` Expr[String] ` using the ` toExpr ` method .
311
+ the result back to an ` Expr[String] ` using ` Expr.apply ` .
312
312
313
- ** Note** : the ` toExpr ` extension method can be ommited by importing an implicit
314
- conversion with ` import given scala.quoted.autolift._ ` . The programmer is able to
313
+ ** Note** : Lifting ` String ` to ` Expr[String] ` using ` Expr(code) ` can be ommited by importing an implicit
314
+ conversion with ` import scala.quoted.autolift.given ` . The programmer is able to
315
315
declutter slightly the code at the cost of readable _ phase distinction_ between
316
316
stages.
317
317
You can’t perform that action at this time.
0 commit comments