Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNotnullClassIncrement.kt
T
2017-11-29 02:54:26 +03:00

13 lines
321 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
class MyClass
operator fun MyClass.inc(): MyClass { <!OI;UNREACHABLE_CODE!>return<!> null!! }
public fun box() {
var i : MyClass?
i = MyClass()
// Type of j should be inferred as MyClass?
var j = ++<!DEBUG_INFO_SMARTCAST!>i<!>
// j is null so call is unsafe
j.hashCode()
}