We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.7.0 with no scala options
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 }
[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] ----------------------------------------------------------------------------
The call to test(null) should compile.
test(null)
The text was updated successfully, but these errors were encountered:
null does not matter. (Switch the RHS of the cases. It fails on the branch exercising the default.)
null
Deleting index works, so that the RHS is just the match.
index
Changing index to def complains about nested inline def.
def
It doesn't help to define the default as zero where inline def zero: 0 = 0.
zero
inline def zero: 0 = 0
Defining the default as inline offset: 0 = 0 does work, so it must be widened somewhere. Maybe defaults are always def.
inline offset: 0 = 0
{ inline val index: (test$default$2 : => Int) = i23177$package.test$default$2 index:Int }
Sorry, something went wrong.
No branches or pull requests
Compiler version
3.7.0 with no scala options
Minimized code
Output
Expectation
The call to
test(null)
should compile.The text was updated successfully, but these errors were encountered: