-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Minimized code
3.0.0-M3
object Inline1:
inline def foo( i:Int): Int =
inline if i == 0 then -1
else Math.abs(i)
def bar(i:Int): Int = foo(i) // as expected, fails to compile
// ^^^^^^
// Cannot reduce `inline if` because its condition is not a constant value: i.==(0)
object Inline2:
inline def foo( i:Int): Int =
inline i match
case 0 => -1
case x:Int => Math.abs(x)
def bar(i:Int): Int = foo(i) // a compilation error was expected, but none is reported
Expectation
inline is a command in Scala 3.0.0, not an implementation hint:
=> def bar() should fail in conjunction with inline match, as it does with inline if.