Files
kotlin-fork/idea/testData/quickfix/nullables/unsafeInfixCall/unsafeComparisonInWhen.kt
T

13 lines
427 B
Kotlin
Vendored

// "Replace with safe (?.) call" "false"
// ACTION: Add non-null asserted (!!) call
// ACTION: Flip '<='
// ACTION: Replace overloaded operator with function call
// ERROR: Infix call corresponds to a dot-qualified call 'w?.x.compareTo(42)' which is not allowed on a nullable receiver 'w?.x'. Use '?.'-qualified call instead
class Wrapper(val x: Int)
fun test(w: Wrapper?) {
when {
w?.x <caret><= 42 -> {}
}
}