FE: Add test for KT-53656

This commit is contained in:
Mikhail Glukhikh
2022-09-06 12:04:41 +02:00
committed by Space
parent c1b0405c4e
commit d8522a8967
7 changed files with 100 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
interface One<T>
fun <E, R> foo(): E where E : Number, E : One<R>, R : One<E> = null!!
interface Entity<T>
abstract class SecuredEntity<out E>(val entity: E) where E : Entity<Int>, E : SecurityCodeAware<*,*>
interface SecurityCodeAware<out E, R : SecuredEntity<E>> where E : Entity<Int>, E : SecurityCodeAware<E, R>
fun <E, R : SecuredEntity<E>> SecurityCodeAware<E, R>.secured() : R where E : Entity<Int>, E : SecurityCodeAware<E, R> = when(this) {
is <!INCOMPATIBLE_TYPES!>Order<!> -> <!TYPE_MISMATCH!>SecuredOrder(<!DEBUG_INFO_SMARTCAST!>this<!>)<!>
else -> null!!
}
class Order : Entity<Int>
class SecuredOrder(order: Order) : SecuredEntity<<!UPPER_BOUND_VIOLATED!>Order<!>>(order)
fun main() {
val securedOrder = Order().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>secured<!>()
}