[LL FIR] add script tests for AbstractInBlockModificationTest
^KT-60728
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
class Builder {
|
||||
var version: String = ""
|
||||
|
||||
fun execute() {
|
||||
println(version)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(action: Builder.() -> Unit) = Builder().apply(action)
|
||||
|
||||
build {
|
||||
version = "123"
|
||||
class A {
|
||||
fun doo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
execute()
|
||||
}
|
||||
|
||||
val builder = build {
|
||||
version = "321"
|
||||
}
|
||||
|
||||
builder.execute()
|
||||
builder.version = <expr>""</expr>
|
||||
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
@@ -0,0 +1,9 @@
|
||||
import kotlin.contracts.InvocationKind
|
||||
|
||||
inline fun foo(block: () -> Unit) {
|
||||
kotlin.contracts.contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
|
||||
<expr>block()</expr>
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import kotlin.contracts.InvocationKind
|
||||
|
||||
inline fun foo(block: () -> Unit) {
|
||||
<expr>kotlin.contracts.contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}</expr>
|
||||
|
||||
block()
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtBlockExpression
|
||||
|
||||
fun doo() <expr>{}</expr>
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtBlockExpression
|
||||
|
||||
val i: Int
|
||||
get() <expr>{}</expr>
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtConstantExpression
|
||||
|
||||
val i: Int = <expr>42</expr>
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtBlockExpression
|
||||
|
||||
var i: Int = 4
|
||||
set(value) <expr>{}</expr>
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class MyProducer {
|
||||
fun produce(): Int = 4
|
||||
}
|
||||
|
||||
fun MyProducer.testFun(param1: Int = produce()) {
|
||||
<expr>42</expr>
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
fun testFun(param1: Int, param2: String = "str", param3: List<Int> = myList()) {
|
||||
<expr>42</expr>
|
||||
}
|
||||
|
||||
fun myList(): List<Int>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import kotlin.contracts.InvocationKind
|
||||
|
||||
inline fun foo(block: () -> Unit) {
|
||||
kotlin.contracts.contract {
|
||||
<expr>callsInPlace</expr>(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
|
||||
block()
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class MyProducer {
|
||||
fun produce(): Int = 4
|
||||
}
|
||||
|
||||
fun MyProducer.testFun(param1: Int = <expr>produce</expr>()) {
|
||||
42
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
@@ -0,0 +1,26 @@
|
||||
class Builder {
|
||||
var version: String = ""
|
||||
|
||||
fun execute() {
|
||||
println(version)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(action: Builder.() -> Unit) = Builder().apply(action)
|
||||
|
||||
build {
|
||||
<expr>version</expr> = "123"
|
||||
class A {
|
||||
fun doo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
execute()
|
||||
}
|
||||
|
||||
val builder = build {
|
||||
version = "321"
|
||||
}
|
||||
|
||||
builder.execute()
|
||||
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import kotlin.contracts.contract
|
||||
|
||||
class A {
|
||||
fun x() {
|
||||
contract {
|
||||
req
|
||||
}
|
||||
|
||||
val a = <expr>doSmth("str")</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
analysis/low-level-api-fir/testdata/inBlockModification/memberFunWithBodyWithErrorContractScript.kts
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import kotlin.contracts.*
|
||||
|
||||
class A {
|
||||
fun passLambdaValue(l: ContractBuilder.() -> Unit) {
|
||||
contract(l)
|
||||
<expr>42</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
analysis/low-level-api-fir/testdata/inBlockModification/memberFunWithBodyWithErrorContractScript.txt
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
fun x() {
|
||||
contract {
|
||||
req
|
||||
}
|
||||
|
||||
val <expr>a</expr> = doSmth("str")
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
fun x(): Int {
|
||||
return <expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
fun x() {
|
||||
val <expr>a</expr> = doSmth("str")
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
fun () {
|
||||
val <expr>a</expr> = doSmth("str")
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
fun x(): Int = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
fun (): Int = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
fun () = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
fun x() = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
import kotlin.contracts.contract
|
||||
|
||||
class A {
|
||||
var x: Int
|
||||
get() {
|
||||
contract {
|
||||
req
|
||||
}
|
||||
|
||||
fun <expr>doSmth</expr>(i: String) = 4
|
||||
return doSmth("str")
|
||||
}
|
||||
set(value) = Unit
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import kotlin.contracts.contract
|
||||
|
||||
class A {
|
||||
var : Int
|
||||
get() {
|
||||
contract {
|
||||
req
|
||||
}
|
||||
|
||||
fun <expr>doSmth</expr>(i: String) = 4
|
||||
return doSmth("str")
|
||||
}
|
||||
set(value) = Unit
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
val x: Int
|
||||
get() {
|
||||
fun doSmth(i: String) = <expr>4</expr>
|
||||
return doSmth("str")
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
val x: Int get() = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
val : Int get() = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
val x
|
||||
get() {
|
||||
return <expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
analysis/low-level-api-fir/testdata/inBlockModification/memberGetterWithoutTypeWithoutBodyScript.kts
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
val x get() = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
analysis/low-level-api-fir/testdata/inBlockModification/memberGetterWithoutTypeWithoutBodyScript.txt
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
val x: Int by lazy {
|
||||
fun <expr>doSmth</expr>(i: String) = 4
|
||||
doSmth("str")
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
val : Int by lazy {
|
||||
fun doSmth(i: String) = 4
|
||||
<expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
val x: Int by <expr>ErrorDelegate</expr>()
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
val x: Int = run {
|
||||
fun doSmth(i: String) = 4
|
||||
<expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
val : Int = run {
|
||||
fun doSmth(i: String) = 4
|
||||
<expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
val x by lazy {
|
||||
fun doSmth(i: String) = 4
|
||||
<expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
val x by <expr>ErrorDelegate</expr>()
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
val x = run {
|
||||
<expr>doSmth</expr>("str")
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
var x: Int = 1
|
||||
set(value) {
|
||||
<expr>doSmth</expr>(value)
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
var : Int = 1
|
||||
set(value) {
|
||||
<expr>doSmth</expr>(value)
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
var x: Int = 1
|
||||
set(value) = <expr>doSmth</expr>(value)
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
var : Int = 1
|
||||
set(value) = <expr>doSmth</expr>(value)
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
var x
|
||||
get() = 1
|
||||
set(value) {
|
||||
<expr>doSmth</expr>(value)
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
analysis/low-level-api-fir/testdata/inBlockModification/memberSetterWithoutTypeWithoutBodyScript.kts
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
var x
|
||||
get() = 1
|
||||
set(value) = <expr>doSmth</expr>(value)
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
analysis/low-level-api-fir/testdata/inBlockModification/memberSetterWithoutTypeWithoutBodyScript.txt
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
@@ -0,0 +1,9 @@
|
||||
fun foo(arg: Any?, num: Int?, block: () -> Unit) contract [
|
||||
returns() implies (arg is String),
|
||||
returns() implies (num != null),
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
] {
|
||||
require(arg is String)
|
||||
require(num != null)
|
||||
<expr>block</expr>()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
@@ -0,0 +1,26 @@
|
||||
class Builder {
|
||||
var version: String = ""
|
||||
|
||||
fun execute() {
|
||||
println(version)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(action: Builder.() -> Unit) = Builder().apply(action)
|
||||
|
||||
build {
|
||||
version = "123"
|
||||
class A {
|
||||
fun doo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
execute()
|
||||
}
|
||||
|
||||
val builder = build {
|
||||
version = "321"
|
||||
}
|
||||
|
||||
builder.<expr>execute</expr>()
|
||||
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
@@ -0,0 +1,26 @@
|
||||
class Builder {
|
||||
var version: String = ""
|
||||
|
||||
fun execute() {
|
||||
println(version)
|
||||
}
|
||||
}
|
||||
|
||||
fun build(action: Builder.() -> Unit) = Builder().apply(action)
|
||||
|
||||
build {
|
||||
version = "123"
|
||||
class A {
|
||||
fun doo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
execute()
|
||||
}
|
||||
|
||||
val builder = <expr>build</expr> {
|
||||
version = "321"
|
||||
}
|
||||
|
||||
builder.execute()
|
||||
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun () {
|
||||
val a = <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
fun foo(): Int {
|
||||
return <expr>doSmth</expr>("str")
|
||||
}
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun foo(): Int = <expr>doSmth</expr>("str")
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun (): Int = <expr>doSmth</expr>("str")
|
||||
|
||||
fun doSmth(i: String) = 4
|
||||
+1
@@ -0,0 +1 @@
|
||||
IN-BLOCK MODIFICATION IS NOT APPLICABLE FOR THIS PLACE
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user