[FIR] Forbid generic type checks inside contracts in K2 as it is done in K1.

#KT-59922
This commit is contained in:
Evgeniy.Zhelenskiy
2023-11-21 15:33:51 +01:00
committed by Space Team
parent a35191706f
commit 5096fd266e
4 changed files with 11 additions and 11 deletions
@@ -12,13 +12,13 @@ abstract class Base<T> {
@OptIn(ExperimentalContracts::class)
fun checkIsT(s: Any?): Boolean {
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true) implies (s is T)<!> }
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true) implies (s is <!CANNOT_CHECK_FOR_ERASED!>T<!>)<!> }
return false
}
@OptIn(ExperimentalContracts::class)
fun <R> checkIsOwnerR(s: Any?): Boolean {
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true) implies (s is R)<!> }
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true) implies (s is <!CANNOT_CHECK_FOR_ERASED!>R<!>)<!> }
return false
}