Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNotnullClassIncrement.kt
T
Mikhail Zarechenskiy 100a6f70ca Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-16 09:56:46 +03:00

13 lines
335 B
Kotlin
Vendored

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