[NI] Complete calls during one inference session only once
The problem is that delegated properties resolve two calls together: `getValue`/`setValue` with a common receiver, which can contain callable references. For each completion new anonymous descriptor was created and caused "rewrite at slice" exceptions later. Now there is a little hack to check that during one inference session we don't complete one call more than one time. More correct fix would be to explicitly specify common receiver for inference session but it requires quite big refactoring, which will be done later with a whole refactoring of the common solver #KT-30250 Fixed
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Inv2<T, K>
|
||||
|
||||
fun <T, K> create(g: (T) -> K): Inv2<T, K> = TODO()
|
||||
|
||||
operator fun <S1, V1> Inv2<S1, V1>.getValue(o: Sample, desc: KProperty<*>): V1 = TODO()
|
||||
operator fun <S2, V2> Inv2<S2, V2>.setValue(o: Sample, desc: KProperty<*>, value: V2) {}
|
||||
|
||||
class Version(val version: Int)
|
||||
|
||||
class Sample {
|
||||
var version: Version by create(::Version)
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T, /*1*/ K> create(/*0*/ g: (T) -> K): Inv2<T, K>
|
||||
public operator fun </*0*/ S1, /*1*/ V1> Inv2<S1, V1>.getValue(/*0*/ o: Sample, /*1*/ desc: kotlin.reflect.KProperty<*>): V1
|
||||
public operator fun </*0*/ S2, /*1*/ V2> Inv2<S2, V2>.setValue(/*0*/ o: Sample, /*1*/ desc: kotlin.reflect.KProperty<*>, /*2*/ value: V2): kotlin.Unit
|
||||
|
||||
public final class Inv2</*0*/ T, /*1*/ K> {
|
||||
public constructor Inv2</*0*/ T, /*1*/ K>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Sample {
|
||||
public constructor Sample()
|
||||
public final var version: Version
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Version {
|
||||
public constructor Version(/*0*/ version: kotlin.Int)
|
||||
public final val version: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user