Closed
Description
Minimized code
Say we make a simple macro that just returns the value true
.
object Proc {
inline def isTrue: Boolean = ${ isTrueImpl }
def isTrueImpl(using qctx: QuoteContext) = {
Expr(true) // even tried: Literal(Constant(true).seal.asExprOf[Boolean])
}
}
Now if we use that with an inline if statement:
inline def oneOf(): String = {
inline if (isTrue)
"foo"
else
"bar"
}
Then when I run that:
oneOf()
The following error happens...
Output
[error] | cannot reduce inline if
[error] | its condition miniquill.ListProc.isTrue
[error] | is not a constant value
Expectation
I think this should be more intelligent about looking at the AST and detecting if there is a constant value. I even tried making oneOf
return Literal(Constant(true))
but it still did not work.