Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/projectionsScope/unsafeVarianceWithRecursiveGenerics.kt
T
Mikhail Zarechenskiy 4ffcbc0c2f [NI] Properly support UnsafeVariance annotation
#KT-38134 Fixed
 #KT-34433 Fixed
 #KT-31823 Fixed
2020-04-16 13:55:47 +03:00

12 lines
393 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 -> <!DEBUG_INFO_SMARTCAST!>this<!>.canUpdateFrom(other as UpdatableRendering<*>)
}
}