Skip to content

Commit fc2f6ae

Browse files
committed
Fix the Symbol.newClass example
1 parent c435372 commit fc2f6ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

blog/_posts/2022-06-15-scala-3.1.3-released.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import scala.quoted.*
7272

7373
class Base
7474

75-
transparent inline def classNamed(inline name: String) = new Base
75+
transparent inline def classNamed(inline name: String) = ${ classNamedExpr('name) }
7676
def classNamedExpr(nameExpr: Expr[String])(using Quotes): Expr[Any] =
7777
import quotes.reflect.*
7878

@@ -92,7 +92,7 @@ def classNamedExpr(nameExpr: Expr[String])(using Quotes): Expr[Any] =
9292
Then you can invoke the macro with
9393

9494
```scala
95-
val impl: Base = scope.classNamed("Foo")
95+
val impl: Base = classNamed("Foo")
9696
```
9797

9898
creating the new instance of your custom subclass of `Base`. That can be useful for the compile-time generation of proxies for remote procedure call systems and many other advanced use-cases.

0 commit comments

Comments
 (0)