Special handling of inline function to track values from individual calls

This commit is contained in:
Valentin Kipyatkov
2020-04-12 10:19:52 +03:00
parent 269420a0e0
commit a09a9a65ff
29 changed files with 420 additions and 130 deletions
+60
View File
@@ -0,0 +1,60 @@
// FLOW: IN
fun <caret>Any.extensionFun() {
}
fun String.foo() {
with(123) {
extensionFun()
}
with(456) {
this.extensionFun()
}
with(789) {
// no calls here
}
withNoInline(1) {
extensionFun()
}
withNoInline(2) {
// no calls here
}
"A".let {
it.extensionFun()
}
"B".let {
// no calls here
}
"D".letNoInline {
it.extensionFun()
}
"C".letNoInline {
// no calls here
}
}
inline fun <T, R> with(receiver: T, block: T.() -> R): R {
val result = receiver.block()
return result
}
inline fun <T, R> T.let(block: (T) -> R): R {
return block(this)
}
fun <T, R> withNoInline(receiver: T, block: T.() -> R): R {
val result = receiver.block()
return result
}
fun <T, R> T.letNoInline(block: (T) -> R): R {
return block(this)
}