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
220220language to quoted Scala code of type ` Expr[Int] ` .
221221The compiler takes an environment that maps variable names to Scala ` Expr ` s.
222222``` scala
223- import given scala .quoted ._
223+ import scala .quoted .{ given , _ }
224224
225225def compile (e : Exp , env : Map [String , Expr [Int ]]): Expr [Int ] = e match {
226226 case Num (n) =>
@@ -308,10 +308,10 @@ def showExpr[T](expr: Expr[T]): Expr[String] = {
308308}
309309```
310310That 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 ` .
312312
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
315315declutter slightly the code at the cost of readable _ phase distinction_ between
316316stages.
317317
You can’t perform that action at this time.
0 commit comments