[FIR] KT-56877: Allow referencing implicit receivers in class contracts
This commit is contained in:
committed by
Space Team
parent
409249267c
commit
c7a71fec17
Vendored
+3
-3
@@ -10,13 +10,13 @@ class Foo {
|
||||
inner class Bar {
|
||||
fun good() {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this<!UNRESOLVED_LABEL!>@Bar<!> != null)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this@Bar != null)<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun badOuter() {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this<!UNRESOLVED_LABEL!>@Foo<!> != null)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this@Foo != null)<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Foo {
|
||||
|
||||
fun A?.badWithReceiver() {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this<!UNRESOLVED_LABEL!>@Bar<!> != null)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns() implies (this@Bar != null)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlin.contracts.*
|
||||
class Foo(val x: Int?) {
|
||||
fun isXNull(): Boolean {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns(false) implies (<!UNRESOLVED_REFERENCE!>x<!> != null)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns(false) implies (x != null)<!>
|
||||
}
|
||||
return x != null
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -7,8 +7,8 @@ import kotlin.contracts.*
|
||||
class Foo(val x: Int?) {
|
||||
fun isXNull(): Boolean {
|
||||
contract {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns(false) implies (<!UNRESOLVED_REFERENCE!>x<!> != null)<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>returns(false) implies (x != null)<!>
|
||||
}
|
||||
return x != null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user