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
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.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
In the section "Transparent Inline Methods" of Scala 3 Macro Tutorial / Inline.md, there is a code example:
I run
default("Int")
in console (Scala 3.0.0-M2), and I see this error message:I also tried to implement it with
inline match
, and it works:It seems this difference between
inline if
andinline match
is not reasonable, but I'm not sure.The text was updated successfully, but these errors were encountered: