You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that some import is missing to compile with the showExpr call.
Even after successful compilation without that call I cannot use the assert macro:
andriy@notebook:~/Downloads/dotty-0.10.0/bin$ ./dotr
Starting dotty REPL...
scala> import scala.quoted._
|
| inline def assert(expr: => Boolean): Unit =
| ~ assertImpl('(expr))
|
| def assertImpl(expr: Expr[Boolean]) =
| '{ if !(~expr) then throw new AssertionError("failed assertion")}
def assert(expr: => Boolean): Unit
def assertImpl(expr: quoted.Expr[Boolean]): quoted.Expr[Unit]
scala> assert(0 == 0)
1 |assert(0 == 0)
|^^^^^^^^^^^^^^
|Could not find macro class rs$line$1$ in classpath. The most common reason for that is that you apply macros in the compilation run that defines them
The text was updated successfully, but these errors were encountered:
showExpr is actually defined below in the document. Though its definition is also wrong (outdated) (improves with Improve showExpr example #5562).
As far as I can see it should be possible to define macros in the REPL. Most likely the macro classloader gets confused by the special classloader that the REPL uses.
Uh oh!
There was an error while loading. Please reload this page.
I have tried to run an example from the Principled Meta Programming doc page.
showExpr
call.assert
macro:The text was updated successfully, but these errors were encountered: