[FIR] Fix incorrect updating of callable reference type in delegated property
... if the delegate happens to be a function call whose second argument is a callable reference but not actually a provideDelegate call. The fix is to ensure that the call is _actually_ a desugared provideDelegate call. This fixes a CCE in a case where the delegate expression is a regular function call and the second argument is a callable reference. #KT-65165 Fixed
This commit is contained in:
committed by
Space Team
parent
fced126c9f
commit
853ad54699
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-65165
|
||||
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
private class TransformedConfigPropertyString(
|
||||
defaultValue: String,
|
||||
private val transform: (String) -> Regex
|
||||
) : ReadOnlyProperty<SampleClass, Regex> {
|
||||
override fun getValue(thisRef: SampleClass, property: KProperty<*>): Regex {
|
||||
return transform("string")
|
||||
}
|
||||
}
|
||||
|
||||
class SampleClass {
|
||||
val ignoreStringsRegex: Regex by TransformedConfigPropertyString("$^", String::toRegex)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
SampleClass().ignoreStringsRegex
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user