Closed
Description
minimized code
inline def assert(expr: => Boolean): Unit =
${assertImpl('expr)}
inline def assertImpl(expr: Expr[Boolean]): Expr[Unit] = '{println("Hello World")}
expectation
Expected to work the same way as (note the second method doesn't have inline
):
inline def assert(expr: => Boolean): Unit =
${assertImpl('expr)}
def assertImpl(expr: Expr[Boolean]): Expr[Unit] = '{println("Hello World")}
Or, if not possible, produce a human-readable error message. Instead, on compilation, the following error is produced:
[error] 10 | ${assertImpl('expr)}
[error] | ^^^^^^^^^^^^^^^^^
[error] |Unexpected tree could not be interpreted: Inlined(Apply(Ident(assertImpl),List(Apply(TypeApply(Ident(exprQuote),List(TypeTree[TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),Boolean)])),List(Inlined(EmptyTree,List(),Literal(Constant(true))))))),List(ValDef(expr,TypeTree[AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),module quoted),Expr),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),Boolean)))],Apply(TypeApply(Ident(exprQuote),List(TypeTree[TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),Boolean)])),List(Inlined(EmptyTree,List(),Literal(Constant(true))))))),Typed(Apply(TypeApply(Ident(exprQuote),List(TypeTree[TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),Unit)])),List(Apply(Ident(println),List(Literal(Constant(Hello World)))))),AppliedTypeTree(Ident(Expr),List(Ident(Unit)))))