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 @@ -34,18 +34,18 @@ prints it again in an error message if it evaluates to `false`.
34
34
import scala .quoted ._
35
35
36
36
inline def assert (expr : => Boolean ): Unit =
37
- $ { assertImpl(' { expr } ) }
37
+ $ { assertImpl(' expr ) }
38
38
39
39
def assertImpl (expr : Expr [Boolean ]) = ' {
40
- if ! ($ { expr } ) then
40
+ if ! ($expr) then
41
41
throw new AssertionError (s " failed assertion: ${$ { showExpr(expr) }}" )
42
42
}
43
43
44
44
def showExpr (expr : Expr [Boolean ]): Expr [String ] =
45
45
' { " <some source code>" } // Better implementation later in this document
46
46
```
47
47
48
- If ` e ` is an expression, then ` '{e} ` represent the typed
48
+ If ` e ` is an expression, then ` '{e} ` represents the typed
49
49
abstract syntax tree representing ` e ` . If ` T ` is a type, then ` '[T] `
50
50
represents the type structure representing ` T ` . The precise
51
51
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:
88
88
``` scala
89
89
package scala .quoted
90
90
91
- sealed abstract class Expr [T ]
91
+ sealed abstract class Expr [+ T ]
92
92
sealed abstract class Type [T ]
93
93
```
94
94
Both ` Expr ` and ` Type ` are abstract and sealed, so all constructors for
You can’t perform that action at this time.
0 commit comments