Replace errors with warnings for type checker recursion on delegates
^KT-49477 Fixed
This commit is contained in:
committed by
teamcity
parent
a4a2f71fca
commit
72a78eb423
@@ -0,0 +1,36 @@
|
||||
// !LANGUAGE: +ForbidRecursiveDelegateExpressions
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
inline fun <reified Self : DatabaseEntity, reified Target : DatabaseEntity> Self.parent(
|
||||
property: KProperty1<Target, MutableCollection<Self>>): Delegate<Self, Target?> = TODO()
|
||||
|
||||
class GitLabBuildProcessor: DatabaseEntity {
|
||||
var processor by <!DEBUG_INFO_EXPRESSION_TYPE("Delegate<GitLabBuildProcessor, GitLabChangesProcessor?>")!>parent(GitLabChangesProcessor::buildProcessors)<!>
|
||||
}
|
||||
|
||||
interface DatabaseEntity: Entity
|
||||
interface Entity
|
||||
interface ResourceFactory<T, R>
|
||||
interface ValueFilter<K>
|
||||
|
||||
interface Delegate<R : Entity, T> : ReadWriteProperty<R, T>, ValueFilter<R> {
|
||||
infix fun name(desc: KProperty<*>): String
|
||||
infix fun by(name: String): Delegate<R, T>
|
||||
infix fun resource(factory: ResourceFactory<R, T>): Delegate<R, T>
|
||||
infix fun filter(filter: (R, Any?) -> Boolean): Delegate<R, T>
|
||||
}
|
||||
|
||||
class GitLabChangesProcessor: DatabaseEntity {
|
||||
var buildProcessors by <!DEBUG_INFO_EXPRESSION_TYPE("Delegate<GitLabChangesProcessor, kotlin.collections.MutableCollection<GitLabBuildProcessor>>"), TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>child_many(
|
||||
GitLabBuildProcessor::class.java,
|
||||
GitLabBuildProcessor::processor
|
||||
)<!>
|
||||
}
|
||||
|
||||
fun <Self : DatabaseEntity, Target : DatabaseEntity> Self.child_many(
|
||||
clazz: Class<Target>, property: KProperty1<Target, Self?>, name: String = property.name
|
||||
): Delegate<Self, MutableCollection<Target>> = TODO() // Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly
|
||||
Reference in New Issue
Block a user