FIR: don't create incorrect constraints in CallableReferenceResolution

#KT-50994 Fixed
Related to KT-49477
This commit is contained in:
Mikhail Glukhikh
2022-04-18 14:07:08 +03:00
committed by Space
parent bdf229bc5c
commit 0ecba0ad0b
12 changed files with 178 additions and 388 deletions
@@ -0,0 +1,40 @@
// WITH_REFLECT
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty1
class ProcessorWithParent : Entity {
var processor by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>parent<!>(ProcessorWithChildren::processors)
}
class ProcessorWithChildren : Entity {
var processors by <!INAPPLICABLE_CANDIDATE!>children<!>(ProcessorWithParent::class.java, ProcessorWithParent::<!UNRESOLVED_REFERENCE!>processor<!>)
}
class Processor2WithParent : Entity {
var processor: Processor2WithChildren? by parent(Processor2WithChildren::processors)
}
class Processor2WithChildren : Entity {
var processors by children(Processor2WithParent::class.java, Processor2WithParent::processor)
}
class Processor3WithParent : Entity {
var processor by parent(Processor3WithChildren::processors)
}
class Processor3WithChildren : Entity {
var processors: MutableCollection<Processor3WithParent> by children(Processor3WithParent::class.java, Processor3WithParent::processor)
}
inline fun <reified SP : Entity, reified TP : Entity> SP.parent(
property: KProperty1<TP, MutableCollection<SP>>
): Delegate<SP, TP?> = null!!
fun <SC : Entity, TC : Entity> SC.children(
clazz: Class<TC>, property: KProperty1<TC, SC?>, name: String = property.name
): Delegate<SC, MutableCollection<TC>> = null!!
interface Delegate<R : Entity, T> : ReadWriteProperty<R, T>
interface Entity
@@ -0,0 +1,40 @@
// WITH_REFLECT
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty1
class ProcessorWithParent : Entity {
var processor by parent(ProcessorWithChildren::processors)
}
class ProcessorWithChildren : Entity {
var processors by <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>children(ProcessorWithParent::class.java, ProcessorWithParent::processor)<!>
}
class Processor2WithParent : Entity {
var processor: Processor2WithChildren? by parent(Processor2WithChildren::processors)
}
class Processor2WithChildren : Entity {
var processors by children(Processor2WithParent::class.java, Processor2WithParent::processor)
}
class Processor3WithParent : Entity {
var processor by parent(Processor3WithChildren::processors)
}
class Processor3WithChildren : Entity {
var processors: MutableCollection<Processor3WithParent> by children(Processor3WithParent::class.java, Processor3WithParent::processor)
}
inline fun <reified SP : Entity, reified TP : Entity> SP.parent(
property: KProperty1<TP, MutableCollection<SP>>
): Delegate<SP, TP?> = null!!
fun <SC : Entity, TC : Entity> SC.children(
clazz: Class<TC>, property: KProperty1<TC, SC?>, name: String = property.name
): Delegate<SC, MutableCollection<TC>> = null!!
interface Delegate<R : Entity, T> : ReadWriteProperty<R, T>
interface Entity
@@ -0,0 +1,66 @@
package
public fun </*0*/ SC : Entity, /*1*/ TC : Entity> SC.children(/*0*/ clazz: java.lang.Class<TC>, /*1*/ property: kotlin.reflect.KProperty1<TC, SC?>, /*2*/ name: kotlin.String = ...): Delegate<SC, kotlin.collections.MutableCollection<TC>>
public inline fun </*0*/ reified SP : Entity, /*1*/ reified TP : Entity> SP.parent(/*0*/ property: kotlin.reflect.KProperty1<TP, kotlin.collections.MutableCollection<SP>>): Delegate<SP, TP?>
public interface Delegate</*0*/ R : Entity, /*1*/ T> : kotlin.properties.ReadWriteProperty<R, T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract override /*1*/ /*fake_override*/ fun getValue(/*0*/ thisRef: R, /*1*/ property: kotlin.reflect.KProperty<*>): T
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract override /*1*/ /*fake_override*/ fun setValue(/*0*/ thisRef: R, /*1*/ property: kotlin.reflect.KProperty<*>, /*2*/ value: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Entity {
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 Processor2WithChildren : Entity {
public constructor Processor2WithChildren()
public final var processors: kotlin.collections.MutableCollection<Processor2WithParent>
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 Processor2WithParent : Entity {
public constructor Processor2WithParent()
public final var processor: Processor2WithChildren?
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 Processor3WithChildren : Entity {
public constructor Processor3WithChildren()
public final var processors: kotlin.collections.MutableCollection<Processor3WithParent>
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 Processor3WithParent : Entity {
public constructor Processor3WithParent()
public final var processor: Processor3WithChildren?
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 ProcessorWithChildren : Entity {
public constructor ProcessorWithChildren()
public final var processors: kotlin.collections.MutableCollection<ProcessorWithParent>
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 ProcessorWithParent : Entity {
public constructor ProcessorWithParent()
public final var processor: ProcessorWithChildren?
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
}