[FIR] Add FINAL_UPPER_BOUND checker
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
import kotlin.contracts.*
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun <T : Boolean>T.case_1(): Boolean? {
|
||||
fun <T : <!FINAL_UPPER_BOUND!>Boolean<!>>T.case_1(): Boolean? {
|
||||
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(null) implies (!this@case_1)<!> }
|
||||
return if (!this) null else true
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ fun Boolean?.case_1(): Boolean {
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun <T : Boolean>T?.case_2(): Boolean {
|
||||
fun <T : <!FINAL_UPPER_BOUND!>Boolean<!>>T?.case_2(): Boolean {
|
||||
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(true) implies (this@case_2 != null && this@case_2 !is Nothing && this@case_2)<!> }
|
||||
return this != null && this !is Nothing && this
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ fun <T : Number?> T.case_1() {
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun <T : Number, K : String> T?.case_2(value_1: K?) {
|
||||
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) }
|
||||
if (!(this@case_2 is T && value_1 is K)) throw Exception()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user