1ddcdcfc39
Basically we want to allow object interpretation only when we try to access some const val property. #KT-57810 Fixed
23 lines
618 B
Kotlin
Vendored
23 lines
618 B
Kotlin
Vendored
object ObjectWithExtension
|
|
|
|
fun ObjectWithExtension?.nullableExtensionFun(): String =
|
|
if(this == null)
|
|
"Null"
|
|
else
|
|
"Not null"
|
|
|
|
fun ObjectWithExtension.extensionFun(): String =
|
|
if(this == null)
|
|
"Null"
|
|
else
|
|
"Not null"
|
|
|
|
fun box(): String {
|
|
val nullObjectWithExtension: ObjectWithExtension? = null
|
|
if ("${nullObjectWithExtension.nullableExtensionFun()}" != "Null") return "Fail 1"
|
|
if ("${ObjectWithExtension.nullableExtensionFun()}" != "Not null") return "Fail 2"
|
|
|
|
if ("${ObjectWithExtension.extensionFun()}" != "Not null") return "Fail 3"
|
|
return "OK"
|
|
}
|