npe() renamed to sure()
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
//KT-600 Problem with 'sure' extension function type inference
|
||||
// +JDK
|
||||
|
||||
fun <T : Any> T?.sure() : T { if (this != null) return this else throw NullPointerException() }
|
||||
fun <T : Any> T?._sure() : T { if (this != null) return this else throw NullPointerException() }
|
||||
|
||||
fun test() {
|
||||
val i : Int? = 10
|
||||
val <!UNUSED_VARIABLE!>i2<!> : Int = i.sure() // inferred type is Int? but Int was excepted
|
||||
val <!UNUSED_VARIABLE!>i2<!> : Int = i._sure() // inferred type is Int? but Int was excepted
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user