[FE] Preserve legacy contract description calls in bodies

^KT-55231 Fixed
^KTIJ-21012 Fixed
This commit is contained in:
Yan Zhulanow
2022-12-02 17:44:31 +09:00
committed by Space Team
parent f067f64255
commit d652dc620c
103 changed files with 4258 additions and 3201 deletions
@@ -5,7 +5,7 @@ import kotlin.contracts.*
// TESTCASE NUMBER: 1
fun <T : Number?> T.case_1() {
contract { returns() implies (this@case_1 is T) }
contract { returns() implies (<!USELESS_IS_CHECK!>this@case_1 is T<!>) }
if (!(<!USELESS_IS_CHECK!>this@case_1 is T<!>)) throw Exception()
}
@@ -65,7 +65,7 @@ fun case_11(value_1: Any?): Boolean? {
// TESTCASE NUMBER: 12
fun Char.case_12() {
contract { returns() implies (this@case_12 == null) }
contract { returns() implies (<!SENSELESS_COMPARISON!>this@case_12 == null<!>) }
if (<!SENSELESS_COMPARISON!>this@case_12 != null<!>) throw Exception()
}
@@ -43,7 +43,7 @@ class case_4 : ClassLevel3() {
fun <T>T.case_4_3_wrap() {
fun case_4_3_contract() {
contract { returns() implies (<!USELESS_IS_CHECK!>this@case_4_3_wrap is ClassLevel1<!>) }
contract { returns() implies (this@case_4_3_wrap is ClassLevel1) }
if (this@case_4_3_wrap !is ClassLevel1) throw Exception()
}
case_4_3_contract()