[FIR] Implement checks for contract not allowed
^KT-55423 Fixed
This commit is contained in:
committed by
Space Team
parent
b2fbf8bed5
commit
f946ddeb40
+2
-2
@@ -12,8 +12,8 @@ fun Any?.isNotNull(): Boolean {
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
val Any?.isNotNull: Boolean
|
||||
get() {
|
||||
contract {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> {
|
||||
returns(true) implies (this@isNotNull != null)
|
||||
}
|
||||
return this@isNotNull != null
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,13 +7,13 @@ interface A {
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
var Any?.isNotNull: Boolean
|
||||
get() {
|
||||
contract {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> {
|
||||
returns(true) implies (this@isNotNull != null)
|
||||
}
|
||||
return this != null
|
||||
}
|
||||
set(value) {
|
||||
<!WRONG_IMPLIES_CONDITION!>contract {
|
||||
<!WRONG_IMPLIES_CONDITION!><!CONTRACT_NOT_ALLOWED!>contract<!> {
|
||||
returns() implies (this@isNotNull != null)
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>require(<!SENSELESS_COMPARISON!>this != null<!>)<!>
|
||||
}<!>
|
||||
|
||||
Reference in New Issue
Block a user