just found this in a pull request: ``` val someth...
# language-proposals
g
just found this in a pull request:
Copy code
val something = when(business) {
  //...
  someCase -> {
    POKOType.forName(name) ?: Log.warning("angry"); POKOType()
  }
If i had some kind of
@Pure
ref-transparent enforcement I could at least get this code tagged as suspicious, if not generate a compiler failure out right. whats the most aggressive thing I can do in my build system to catch this?
i
What rule could catch it? The result of
forName
is used in elvis operator.
It's equivalent to the following code:
Copy code
if (POKOType.forName(name) == null) {
    Log.warning("...")
}
return POKOType()
n
Its a bit odd that the elvis operator is only used to perform a side effect, and the result of the expression is discarded.
e
Tell me this is definitely a logical bug…