Open
Description
Compiler version
3.7.0 with no scala options
Minimized code
class Something
transparent inline def test(inline oNio: Something | Null = null, inline offset: Int = 0): Int = {
inline val index = inline oNio match {
case null => offset
case nio: Something => -1
}
index
}
@main def check(): Unit = {
test(Something(), 0) // compiles
test(Something()) // compiles
test(null, 0) // compiles
test(null) // complains with: inline value must have a literal constant type
}
Output
[error] 19 | test(null) // complains with: inline value must have a literal constant type
[error] | ^^^^^^^^^^
[error] | inline value must have a literal constant type
[error] |----------------------------------------------------------------------------
[error] |Inline stack trace
[error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error] |This location contains code that was inlined from Borrame.scala:9
[error] 9 | case null => offset
[error] | ^^^^^^
[error] ----------------------------------------------------------------------------
Expectation
The call to test(null)
should compile.