[FIR] Add inline checker for bodies of inline functions
This checker doesn't support `@PublishedAPI` yet, so some BB tests for it were muted. #KT-46270
This commit is contained in:
committed by
TeamCityServer
parent
7e052c1eb1
commit
32c3f85679
Vendored
+4
-4
@@ -15,16 +15,16 @@ fun foo(y: Boolean) {
|
||||
inline fun case1(block: () -> Unit) {
|
||||
val contracts = listOf(
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE)
|
||||
}, contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
)
|
||||
block()
|
||||
}
|
||||
|
||||
inline fun case_2(block: () -> Unit) = contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
callsInPlace(<!USAGE_IS_NOT_INLINABLE!>block<!>, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
|
||||
fun case_3(block: () -> Unit) {
|
||||
@@ -73,4 +73,4 @@ fun case_7(cond: Boolean): Boolean {
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ inline fun test(crossinline c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ inline fun test(crossinline c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ inline fun test(c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ inline fun test(c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ suspend inline fun test(crossinline c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ suspend inline fun test(crossinline c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ suspend inline fun test(c: () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun calculate() = "OK"
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ suspend inline fun test(c: suspend () -> Unit) {
|
||||
}
|
||||
}
|
||||
val l: suspend () -> Unit = { c() }
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
c.<!USAGE_IS_NOT_INLINABLE!>startCoroutine<!>(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
Reference in New Issue
Block a user