Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/projectionsScope/unsafeVarianceWithRecursiveGenerics.fir.kt
T
2020-09-14 18:08:31 +03:00

12 lines
366 B
Kotlin
Vendored

interface UpdatableRendering<out T : UpdatableRendering<T>> {
fun canUpdateFrom(another: @UnsafeVariance T): Boolean
}
internal fun Any.matchesRendering(other: Any): Boolean {
return when {
this::class != other::class -> false
this !is UpdatableRendering<*> -> true
else -> this.canUpdateFrom(other as UpdatableRendering<*>)
}
}