[FIR-TEST] Update testdata of old FE contracts tests
This commit is contained in:
Vendored
+2
-2
@@ -58,11 +58,11 @@ val topLevelAnonymousFunction = fun (x: Boolean) {
|
||||
|
||||
var topLevelPropertyAccessors: Int? = 42
|
||||
get() {
|
||||
contract { returns() implies (field != null) }
|
||||
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||
return 42
|
||||
}
|
||||
set(value) {
|
||||
contract { returns() implies (field != null) }
|
||||
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -73,11 +73,11 @@ val topLevelAnonymousFunction = fun (x: Boolean) {
|
||||
|
||||
var topLevelPropertyAccessors: Int? = 42
|
||||
get() {
|
||||
contract { returns() implies (field != null) }
|
||||
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||
return 42
|
||||
}
|
||||
set(value) {
|
||||
contract { returns() implies (field != null) }
|
||||
contract { returns() implies (<!UNRESOLVED_REFERENCE!>field<!> != null) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -25,9 +25,9 @@ fun whenInContract(x: Any?, boolean: Boolean) {
|
||||
|
||||
fun forInContract(x: Any?) {
|
||||
contract {
|
||||
for (i in 0..1) {
|
||||
<!UNRESOLVED_REFERENCE!>for (i in 0..1) {
|
||||
returns() implies (x is String)
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !LANGUAGE: +UseReturnsEffect
|
||||
// Issue: KT-26386
|
||||
|
||||
fun myRun(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
fun contract(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
fun case_1(): Boolean? {
|
||||
contract { case_1() }
|
||||
return null
|
||||
}
|
||||
|
||||
fun case_2(): Boolean? {
|
||||
contract { case_3() }
|
||||
return null
|
||||
}
|
||||
|
||||
fun case_3(): Boolean? {
|
||||
contract { case_2() }
|
||||
return null
|
||||
}
|
||||
|
||||
fun case4() {
|
||||
contract {
|
||||
myRun {
|
||||
val s: String
|
||||
run {
|
||||
<!UNRESOLVED_REFERENCE!>s<!> = "hello"
|
||||
}
|
||||
<!UNRESOLVED_REFERENCE!>s<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !LANGUAGE: +UseReturnsEffect
|
||||
// Issue: KT-26386
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlin.contracts.*
|
||||
class Foo(val x: Int?) {
|
||||
fun isXNull(): Boolean {
|
||||
contract {
|
||||
returns(false) implies (x != null)
|
||||
returns(false) implies (<!UNRESOLVED_REFERENCE!>x<!> != null)
|
||||
}
|
||||
return x != null
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ import kotlin.contracts.*
|
||||
class Foo(val x: Int?) {
|
||||
fun isXNull(): Boolean {
|
||||
contract {
|
||||
returns(false) implies (x != null)
|
||||
returns(false) implies (<!UNRESOLVED_REFERENCE!>x<!> != null)
|
||||
}
|
||||
return x != null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user