Files
kotlin-fork/compiler/testData/codegen/box/delegatedProperty/provideDelegate/kt39588.kt
T
Mikhail Zarechenskiy d8f701ee61 Add test for obsolete issue
#KT-39588 Obsolete
2020-07-05 18:17:44 +03:00

22 lines
950 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
import kotlin.reflect.KProperty
class OptionDescriptor<T>
interface ArgumentValueDelegate<T> {
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = "OK" as T
}
abstract class CLIEntity<TResult> constructor(val delegate: ArgumentValueDelegate<TResult>) {
operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ArgumentValueDelegate<TResult> = delegate
}
abstract class AbstractSingleOption<T : Any, TResult> constructor(delegate: ArgumentValueDelegate<TResult>) : CLIEntity<TResult>(delegate)
class ArgumentSingleNullableValue<T : Any>(descriptor: OptionDescriptor<T>): ArgumentValueDelegate<T?>
class SingleNullableOption<T : Any> constructor(descriptor: OptionDescriptor<T>) : AbstractSingleOption<T, T?>(ArgumentSingleNullableValue(descriptor))
fun box(): String {
val x: List<Any>? by SingleNullableOption(OptionDescriptor())
return x.toString()
}