In the section "Transparent Inline Methods" of _Scala 3 Macro Tutorial_ / _Inline.md_, there is a code example:
transparent inline def default(inline name: String): Any =
inline if name == "Int" then 0
else inline if name == "String" then ""
else ...
I run default("Int") in console (Scala 3.0.0-M2), and I see this error message:
default("Int")
1 |default("Int")
|^^^^^^^^^^^^^^
|Cannot reduce `inline if` because its condition is not a constant value: "Int".==("Int")
| This location contains code that was inlined from rs$line$1:2
I also tried to implement it with inline match, and it works:
transparent inline def default(inline name: String): Any =
inline name match
case "Int" => 0
case "String" => ""
case _ => ...
It seems this difference between inline if and inline match is not reasonable, but I'm not sure.
I update the description.
Is this a bug?
It is a bug
Most helpful comment
It is a bug