Closed
Description
Compiler version
3.3.1 (same with 3.4.0-RC1)
Minimized code
//Test class
package test
type Bool = [R] => (R, R) => R
val True: Bool = [R] => (t: R, _: R) => t
val False: Bool = [R] => (_: R, f: R) => f
inline def not(b: Bool): Bool = ${notMacro('b)}
inline def show(b: Bool): String = ${showMacro('b)}
//inline def not(b: Bool): Bool = ${foldMacro('b, 'False, 'True)}
//inline def show(b: Bool): String = ${foldMacro('b, '{"TRUE"}, '{"FALSE"})}
@main def testing =
println(show(not(True)))
// Macro class
package test
import scala.quoted.*
def notMacro(bool: Expr[Bool])(using Quotes): Expr[Bool] =
'{$bool(False, True)}
def showMacro(bool: Expr[Bool])(using Quotes): Expr[String] =
'{$bool("TRUE", "FALSE")}
def foldMacro[T: Type](bool: Expr[Bool], t: Expr[T], f: Expr[T])(using Quotes): Expr[T] =
'{$bool($t, $f)}
If you swap the not/show wilth the fold versions then it doesn't crash.
I guess its some issue with inferring the [R] ?