Skip to content

Commit 674451f

Browse files
committed
Fixes to macros.md
1 parent 7b43e60 commit 674451f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/docs/reference/metaprogramming/macros.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ prints it again in an error message if it evaluates to `false`.
3434
import scala.quoted._
3535

3636
inline def assert(expr: => Boolean): Unit =
37-
${ assertImpl('{ expr }) }
37+
${ assertImpl('expr) }
3838

3939
def assertImpl(expr: Expr[Boolean]) = '{
40-
if !(${ expr }) then
40+
if !($expr) then
4141
throw new AssertionError(s"failed assertion: ${${ showExpr(expr) }}")
4242
}
4343

4444
def showExpr(expr: Expr[Boolean]): Expr[String] =
4545
'{ "<some source code>" } // Better implementation later in this document
4646
```
4747

48-
If `e` is an expression, then `'{e}` represent the typed
48+
If `e` is an expression, then `'{e}` represents the typed
4949
abstract syntax tree representing `e`. If `T` is a type, then `'[T]`
5050
represents the type structure representing `T`. The precise
5151
definitions of "typed abstract syntax tree" or "type-structure" do not
@@ -88,7 +88,7 @@ The two types can be defined in package `scala.quoted` as follows:
8888
```scala
8989
package scala.quoted
9090

91-
sealed abstract class Expr[T]
91+
sealed abstract class Expr[+T]
9292
sealed abstract class Type[T]
9393
```
9494
Both `Expr` and `Type` are abstract and sealed, so all constructors for

0 commit comments

Comments
 (0)