[FIR] Prohibit referencing type parameters in contracts ...
...if they are not reified or not belong to owner declaration of the contract KT-57911
This commit is contained in:
committed by
Space Team
parent
5a92eb2c67
commit
f8dc8057f0
+2
-2
@@ -5,12 +5,12 @@ import kotlin.contracts.*
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun <T : Number?> T.case_1() {
|
||||
contract { returns() implies (<!USELESS_IS_CHECK!>this@case_1 is T<!>) }
|
||||
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (<!USELESS_IS_CHECK!>this@case_1 is T<!>)<!> }
|
||||
if (!(<!USELESS_IS_CHECK!>this@case_1 is T<!>)) throw Exception()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun <T : Number, K : <!FINAL_UPPER_BOUND!>String<!>> T?.case_2(value_1: K?) {
|
||||
contract { returns() implies (this@case_2 is T && value_1 is K) }
|
||||
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this@case_2 is T && value_1 is K)<!> }
|
||||
if (!(this@case_2 is T && value_1 is K)) throw Exception()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user