Process inline functions from libraries (if sources available) + process source libraries if analysis scope includes them

This commit is contained in:
Valentin Kipyatkov
2020-04-13 13:50:42 +03:00
parent 06de3de1a6
commit 411f2c833c
35 changed files with 408 additions and 345 deletions
@@ -77,7 +77,7 @@ class InflowSlicer(
val getter = (property.unsafeResolveToDescriptor() as VariableDescriptorWithAccessors).getter ?: return
val bindingContext = property.analyzeWithContent()
val delegateGetterResolvedCall = bindingContext[BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, getter]
delegateGetterResolvedCall?.resultingDescriptor?.originalSource?.getPsi()?.passToProcessor()
delegateGetterResolvedCall?.resultingDescriptor?.toPsi()?.passToProcessor()
return
}
@@ -178,7 +178,7 @@ class InflowSlicer(
}
val accessedDescriptor = createdAt.target.accessedDescriptor ?: return
val accessedDeclaration = accessedDescriptor.originalSource.getPsi()
val accessedDeclaration = accessedDescriptor.toPsi()
when (accessedDescriptor) {
is SyntheticFieldDescriptor -> {
val property = accessedDeclaration as? KtProperty ?: return
@@ -192,7 +192,7 @@ class InflowSlicer(
is ReceiverParameterDescriptor -> {
//TODO: handle non-extension receivers?
val callable = accessedDescriptor.containingDeclaration as? CallableDescriptor ?: return
when (val declaration = callable.originalSource.getPsi()) {
when (val declaration = callable.toPsi()) {
is KtFunctionLiteral -> {
declaration.passToProcessorAsValue(mode.withBehaviour(LambdaCallsBehaviour(ReceiverSliceProducer)))
}
@@ -231,8 +231,7 @@ class InflowSlicer(
val callableRefExpr = expressionValue.element as? KtCallableReferenceExpression ?: return
val bindingContext = expression.analyze(BodyResolveMode.PARTIAL)
val referencedDescriptor = bindingContext[BindingContext.REFERENCE_TARGET, callableRefExpr.callableReference] ?: return
val referencedDeclaration = (referencedDescriptor as? DeclarationDescriptorWithSource)?.originalSource?.getPsi()
?: return
val referencedDeclaration = (referencedDescriptor as? DeclarationDescriptorWithSource)?.toPsi() ?: return
when (currentBehaviour) {
is LambdaResultInflowBehaviour -> {
referencedDeclaration.passToProcessor(mode.dropBehaviour())
@@ -262,7 +261,7 @@ class InflowSlicer(
(resolvedCall.dispatchReceiver as? ExpressionReceiver)?.expression
?.passToProcessorAsValue(mode.withBehaviour(LambdaResultInflowBehaviour))
} else {
resultingDescriptor.originalSource.getPsi()?.passToProcessorInCallMode(createdAt.element, withOverriders = true)
resultingDescriptor.toPsi()?.passToProcessorInCallMode(createdAt.element, withOverriders = true)
}
}
}
@@ -9,6 +9,7 @@ import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector.Access
import com.intellij.psi.PsiComment
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.psi.search.LocalSearchScope
import com.intellij.psi.util.parentOfType
import com.intellij.usageView.UsageInfo
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
@@ -32,7 +33,6 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.parameterIndex
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.resolve.source.getPsi
class OutflowSlicer(
element: KtElement,
@@ -68,7 +68,7 @@ class OutflowSlicer(
declaration.resolveToDescriptorIfAny(BodyResolveMode.FULL)
?.actualsForExpected()
?.forEach {
val actualDeclaration = (it as? DeclarationDescriptorWithSource)?.originalSource?.getPsi()
val actualDeclaration = (it as? DeclarationDescriptorWithSource)?.toPsi()
(actualDeclaration as? KtCallableDeclaration)?.receiverTypeReference?.passToProcessor()
}
}
@@ -112,6 +112,8 @@ class OutflowSlicer(
}
}
var searchScope = analysisScope
if (variable is KtParameter) {
if (!canProcessParameter(variable)) return //TODO
@@ -122,7 +124,7 @@ class OutflowSlicer(
variable.resolveToDescriptorIfAny(BodyResolveMode.FULL)
?.actualsForExpected()
?.forEach {
(it as? DeclarationDescriptorWithSource)?.originalSource?.getPsi()?.passToProcessor()
(it as? DeclarationDescriptorWithSource)?.toPsi()?.passToProcessor()
}
}
@@ -148,10 +150,14 @@ class OutflowSlicer(
}
true
}
if (callable is KtNamedFunction) { // references to parameters of inline function can be outside analysis scope
searchScope = LocalSearchScope(callable)
}
}
}
processVariableAccesses(variable, analysisScope, accessKind, ::processVariableAccess)
processVariableAccesses(variable, searchScope, accessKind, ::processVariableAccess)
}
private fun processFunction(function: KtFunction) {
@@ -167,7 +173,7 @@ class OutflowSlicer(
when (instruction) {
is WriteValueInstruction -> {
if (!pseudoValue.processIfReceiverValue(instruction, mode)) {
instruction.target.accessedDescriptor?.originalSource?.getPsi()?.passToProcessor()
instruction.target.accessedDescriptor?.toPsi()?.passToProcessor()
}
}
@@ -178,7 +184,7 @@ class OutflowSlicer(
is CallInstruction -> {
if (!pseudoValue.processIfReceiverValue(instruction, mode)) {
val parameterDescriptor = instruction.arguments[pseudoValue] ?: return@processPseudocodeUsages
val parameter = parameterDescriptor.originalSource.getPsi()
val parameter = parameterDescriptor.toPsi()
if (parameter != null) {
parameter.passToProcessorInCallMode(instruction.element)
} else {
@@ -225,7 +231,7 @@ class OutflowSlicer(
val targetDescriptor = bindingContext[BindingContext.REFERENCE_TARGET, receiverExpression]
if (targetDescriptor is CallableDescriptor) {
receiverType = targetDescriptor.returnType
receiver = targetDescriptor.originalSource.getPsi() ?: return
receiver = targetDescriptor.toPsi() ?: return
}
}
if (receiverType == null || !receiverType.isFunctionType) return
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFunctionLiteral
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.resolve.source.getPsi
object ReceiverSliceProducer : SliceProducer {
override fun produce(usage: UsageInfo, mode: KotlinSliceAnalysisMode, parent: SliceUsage): Collection<SliceUsage>? {
@@ -29,16 +28,15 @@ object ReceiverSliceProducer : SliceProducer {
}
is ImplicitReceiver -> {
val callableDescriptor = receiver.declarationDescriptor as? CallableDescriptor
?: return emptyList()
when (val callableDeclaration = callableDescriptor.originalSource.getPsi()) {
val callableDescriptor = receiver.declarationDescriptor as? CallableDescriptor ?: return emptyList()
when (val declaration = Slicer.descriptorToPsi(callableDescriptor, usage.project, parent.scope.toSearchScope())) {
is KtFunctionLiteral -> {
val newMode = mode.withBehaviour(LambdaCallsBehaviour(ReceiverSliceProducer))
return listOf(KotlinSliceUsage(callableDeclaration, parent, newMode, forcedExpressionMode = true))
return listOf(KotlinSliceUsage(declaration, parent, newMode, forcedExpressionMode = true))
}
is KtCallableDeclaration -> {
val receiverTypeReference = callableDeclaration.receiverTypeReference ?: return emptyList()
val receiverTypeReference = declaration.receiverTypeReference ?: return emptyList()
return listOf(KotlinSliceUsage(receiverTypeReference, parent, mode, false))
}
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.idea.slicer
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiComment
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
@@ -25,6 +26,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
import org.jetbrains.kotlin.idea.core.getDeepestSuperDeclarations
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions
@@ -38,9 +40,12 @@ import org.jetbrains.kotlin.idea.util.expectedDescriptor
import org.jetbrains.kotlin.idea.util.hasInlineModifier
import org.jetbrains.kotlin.idea.util.isExpectDeclaration
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.contains
import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType
import org.jetbrains.kotlin.psi.psiUtil.parents
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
@@ -119,7 +124,7 @@ abstract class Slicer(
resolveToDescriptorIfAny(BodyResolveMode.FULL)
?.actualsForExpected()
?.forEach {
(it as? DeclarationDescriptorWithSource)?.originalSource?.getPsi()?.passToProcessor(mode)
(it as? DeclarationDescriptorWithSource)?.toPsi()?.passToProcessor(mode)
}
}
}
@@ -168,7 +173,7 @@ abstract class Slicer(
}
for (superDescriptor in superDescriptors) {
val declaration = superDescriptor.originalSource.getPsi() ?: continue
val declaration = superDescriptor.toPsi() ?: continue
when (declaration) {
is KtDeclaration -> {
val usageProcessor: (UsageInfo) -> Unit = processor@ { usageInfo ->
@@ -226,12 +231,28 @@ abstract class Slicer(
DescriptorUtils.getAllOverriddenDeclarations(descriptor)
}
additionalDescriptors.mapNotNullTo(allDeclarations) {
it.originalSource.getPsi() as? KtCallableDeclaration
it.toPsi() as? KtCallableDeclaration
}
}
allDeclarations.forEach { it.processAllExactUsages(options, usageProcessor) }
allDeclarations.forEach {
it.processAllExactUsages(options) { usageInfo ->
if (!shouldIgnoreVariableUsage(usageInfo)) {
usageProcessor.invoke(usageInfo)
}
}
}
}
// ignore parameter usages in function contract
private fun shouldIgnoreVariableUsage(usage: UsageInfo): Boolean {
val element = usage.element ?: return true
return element.parents.any {
it is KtCallExpression &&
(it.calleeExpression as? KtSimpleNameExpression)?.getReferencedName() == "contract" &&
it.resolveToCall()?.resultingDescriptor?.fqNameOrNull()?.asString() == "kotlin.contracts.contract"
}
}
protected fun canProcessParameter(parameter: KtParameter) = !parameter.isVarArg
@@ -304,21 +325,24 @@ abstract class Slicer(
val createdAt = dispatchReceiverPseudoValue.createdAt
val accessedDescriptor = (createdAt as ReadValueInstruction?)?.target?.accessedDescriptor
if (accessedDescriptor is VariableDescriptor) {
val accessedDeclaration = accessedDescriptor.originalSource.getPsi()
accessedDeclaration?.passToProcessor(mode.withBehaviour(LambdaReceiverInflowBehaviour))
accessedDescriptor.toPsi()?.passToProcessor(mode.withBehaviour(LambdaReceiverInflowBehaviour))
}
}
}
} else {
if (receiverValue == resolvedCall.extensionReceiver) {
val declaration = descriptor.originalSource.getPsi()
(declaration as? KtCallableDeclaration)?.receiverTypeReference?.passToProcessorInCallMode(instruction.element, mode)
(descriptor.toPsi() as? KtCallableDeclaration)?.receiverTypeReference
?.passToProcessorInCallMode(instruction.element, mode)
}
}
return true
}
protected fun DeclarationDescriptor.toPsi(): PsiElement? {
return descriptorToPsi(this, project, analysisScope)
}
companion object {
protected fun KtDeclaration?.callMode(callElement: KtElement, defaultMode: KotlinSliceAnalysisMode): KotlinSliceAnalysisMode {
return if (this is KtNamedFunction && hasInlineModifier())
@@ -326,21 +350,25 @@ abstract class Slicer(
else
defaultMode
}
fun descriptorToPsi(descriptor: DeclarationDescriptor, project: Project, analysisScope: SearchScope): PsiElement? {
val declaration = DescriptorToSourceUtilsIde.getAnyDeclaration(project, descriptor) ?: return null
if (analysisScope.contains(declaration)) return declaration.navigationElement
// we ignore access scope for inline declarations
val isInline = when (declaration) {
is KtNamedFunction -> declaration.hasInlineModifier()
is KtParameter -> declaration.ownerFunction?.hasInlineModifier() == true
else -> false
}
return if (isInline) declaration.navigationElement else null
}
}
}
val DeclarationDescriptorWithSource.originalSource: SourceElement
get() {
var descriptor = this
while (descriptor.original != descriptor) {
descriptor = descriptor.original
}
return descriptor.source
}
fun CallableDescriptor.isImplicitInvokeFunction(): Boolean {
if (this !is FunctionDescriptor) return false
if (!isOperator) return false
if (name != OperatorNameConventions.INVOKE) return false
return originalSource.getPsi() == null
return source.getPsi() == null
}
@@ -1,4 +1,5 @@
// FLOW: IN
// RUNTIME_WITH_SOURCES
fun foo(f: String.(Int) -> Unit) {
f("", 1)
@@ -1,18 +1,18 @@
4 f("", <bold>1</bold>)
15 val v = <bold>it</bold>
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
4 f("", <bold>1</bold>)
5 f("", <bold>1</bold>)
16 val v = <bold>it</bold>
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
5 f("", <bold>1</bold>)
6 "".f(<bold>2</bold>)
15 val v = <bold>it</bold>
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
6 "".f(<bold>2</bold>)
7 "".f(<bold>2</bold>)
16 val v = <bold>it</bold>
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
7 "".f(<bold>2</bold>)
9 f(<bold>3</bold>)
15 val v = <bold>it</bold>
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
9 f(<bold>3</bold>)
10 f(<bold>3</bold>)
16 val v = <bold>it</bold>
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
10 f(<bold>3</bold>)
@@ -1,4 +1,4 @@
[NotNull Values]
15 val v = <bold>it</bold>
15 val v = <bold>it</bold>
16 val v = <bold>it</bold>
16 val v = <bold>it</bold>
@@ -1,6 +1,6 @@
15 val v = <bold>it</bold>
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
4 f("", <bold>1</bold>)
6 "".f(<bold>2</bold>)
9 f(<bold>3</bold>)
16 val v = <bold>it</bold>
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{</bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
5 f("", <bold>1</bold>)
7 "".f(<bold>2</bold>)
10 f(<bold>3</bold>)
+1 -4
View File
@@ -1,4 +1,5 @@
// FLOW: IN
// RUNTIME_WITH_SOURCES
fun foo(f: String.(Int) -> Unit) {
f("", 1)
@@ -15,7 +16,3 @@ fun test() {
val v = <caret>i
}
}
inline fun <T, R> with(receiver: T, block: T.() -> R): R {
return receiver.block()
}
@@ -1,21 +1,21 @@
4 f("", <bold>1</bold>)
15 val v = <bold>i</bold>
14 foo { <bold>i</bold> ->
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
4 f("", <bold>1</bold>)
5 f("", <bold>1</bold>)
16 val v = <bold>i</bold>
15 foo { <bold>i</bold> ->
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
5 f("", <bold>1</bold>)
6 "".f(<bold>2</bold>)
15 val v = <bold>i</bold>
14 foo { <bold>i</bold> ->
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
6 "".f(<bold>2</bold>)
7 "".f(<bold>2</bold>)
16 val v = <bold>i</bold>
15 foo { <bold>i</bold> ->
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
7 "".f(<bold>2</bold>)
9 f(<bold>3</bold>)
15 val v = <bold>i</bold>
14 foo { <bold>i</bold> ->
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
9 f(<bold>3</bold>)
10 f(<bold>3</bold>)
16 val v = <bold>i</bold>
15 foo { <bold>i</bold> ->
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
10 f(<bold>3</bold>)
@@ -1,4 +1,4 @@
[NotNull Values]
15 val v = <bold>i</bold>
15 val v = <bold>i</bold>
16 val v = <bold>i</bold>
16 val v = <bold>i</bold>
@@ -1,7 +1,7 @@
15 val v = <bold>i</bold>
14 foo { <bold>i</bold> ->
14 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
3 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
4 f("", <bold>1</bold>)
6 "".f(<bold>2</bold>)
9 f(<bold>3</bold>)
16 val v = <bold>i</bold>
15 foo { <bold>i</bold> ->
15 [LAMBDA CALLS ARGUMENT #0 EXTENSION] foo <bold>{ i -></bold>
4 [LAMBDA CALLS ARGUMENT #0 EXTENSION] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
5 f("", <bold>1</bold>)
7 "".f(<bold>2</bold>)
10 f(<bold>3</bold>)
+1 -4
View File
@@ -1,11 +1,8 @@
// FLOW: IN
// RUNTIME_WITH_SOURCES
fun foo() {
with("A") {
val <caret>v = this
}
}
inline fun <T, R> with(receiver: T, block: T.() -> R): R {
return receiver.block()
}
@@ -1,9 +1,9 @@
4 with(<bold>"A"</bold>) {
5 val <bold>v = this</bold>
5 val v = <bold>this</bold>
4 [LAMBDA CALLS RECEIVER] with("A") <bold>{</bold>
9 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
10 (INLINE CALL with) return <bold>receiver</bold>.block()
9 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
4 with(<bold>"A"</bold>) {
5 with(<bold>"A"</bold>) {
6 val <bold>v = this</bold>
6 val v = <bold>this</bold>
5 [LAMBDA CALLS RECEIVER] with("A") <bold>{</bold>
66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
5 with(<bold>"A"</bold>) {
@@ -1,3 +1,4 @@
[NotNull Values]
5 val <bold>v = this</bold>
5 val <bold>v = this</bold>
6 val <bold>v = this</bold>
6 val <bold>v = this</bold>
@@ -1,7 +1,7 @@
5 val <bold>v = this</bold>
5 val v = <bold>this</bold>
4 [LAMBDA CALLS RECEIVER] with("A") <bold>{</bold>
9 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
10 (INLINE CALL with) return <bold>receiver</bold>.block()
9 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
4 with(<bold>"A"</bold>) {
6 val <bold>v = this</bold>
6 val v = <bold>this</bold>
5 [LAMBDA CALLS RECEIVER] with("A") <bold>{</bold>
66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
5 with(<bold>"A"</bold>) {
@@ -0,0 +1,12 @@
// FLOW: IN
// RUNTIME_WITH_SOURCES
class C
fun foo() {
val c = C().apply {
extensionFun()
}
}
fun <caret>C.extensionFun() {}
@@ -0,0 +1,8 @@
4 class <bold>C</bold>
12 fun <bold>C</bold>.extensionFun() {}
7 [LAMBDA CALLS RECEIVER] val c = C().apply <bold>{</bold>
79 (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun <T> T.apply(<bold>block: T.() -> Unit</bold>): T {
79 (INLINE CALL apply) public inline fun <T> <bold>T</bold>.apply(block: T.() -> Unit): T {
7 val c = <bold>C()</bold>.apply {
4 class <bold>C</bold>
@@ -0,0 +1,8 @@
[NotNull Values]
7 val c = <bold>C()</bold>.apply {
12 fun <bold>C</bold>.extensionFun() {}
7 [LAMBDA CALLS RECEIVER] val c = C().apply <bold>{</bold>
79 (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun <T> T.apply(<bold>block: T.() -> Unit</bold>): T {
79 (INLINE CALL apply) public inline fun <T> <bold>T</bold>.apply(block: T.() -> Unit): T {
7 val c = <bold>C()</bold>.apply {
@@ -0,0 +1,6 @@
12 fun <bold>C</bold>.extensionFun() {}
7 [LAMBDA CALLS RECEIVER] val c = C().apply <bold>{</bold>
79 (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun <T> T.apply(<bold>block: T.() -> Unit</bold>): T {
79 (INLINE CALL apply) public inline fun <T> <bold>T</bold>.apply(block: T.() -> Unit): T {
7 val c = <bold>C()</bold>.apply {
4 class <bold>C</bold>
+1 -4
View File
@@ -1,4 +1,5 @@
// FLOW: IN
// RUNTIME_WITH_SOURCES
fun <caret>Any.extensionFun() {
}
@@ -46,10 +47,6 @@ inline fun <T, R> with(receiver: T, block: T.() -> R): R {
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
@@ -1,60 +1,60 @@
35 <bold>"D"</bold>.letNoInline {
3 fun <bold>Any</bold>.extensionFun() {
36 <bold>it</bold>.extensionFun()
35 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline <bold>{</bold>
58 [LAMBDA CALLS ARGUMENT #0] fun <T, R> T.letNoInline(<bold>block: (T) -> R</bold>): R {
59 return block(<bold>this</bold>)
58 fun <T, R> <bold>T</bold>.letNoInline(block: (T) -> R): R {
35 <bold>"D"</bold>.letNoInline {
36 <bold>"D"</bold>.letNoInline {
4 fun <bold>Any</bold>.extensionFun() {
37 <bold>it</bold>.extensionFun()
36 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline <bold>{</bold>
55 [LAMBDA CALLS ARGUMENT #0] fun <T, R> T.letNoInline(<bold>block: (T) -> R</bold>): R {
56 return block(<bold>this</bold>)
55 fun <T, R> <bold>T</bold>.letNoInline(block: (T) -> R): R {
36 <bold>"D"</bold>.letNoInline {
39 <bold>"C"</bold>.letNoInline {
3 fun <bold>Any</bold>.extensionFun() {
36 <bold>it</bold>.extensionFun()
35 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline <bold>{</bold>
58 [LAMBDA CALLS ARGUMENT #0] fun <T, R> T.letNoInline(<bold>block: (T) -> R</bold>): R {
59 return block(<bold>this</bold>)
58 fun <T, R> <bold>T</bold>.letNoInline(block: (T) -> R): R {
39 <bold>"C"</bold>.letNoInline {
40 <bold>"C"</bold>.letNoInline {
4 fun <bold>Any</bold>.extensionFun() {
37 <bold>it</bold>.extensionFun()
36 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline <bold>{</bold>
55 [LAMBDA CALLS ARGUMENT #0] fun <T, R> T.letNoInline(<bold>block: (T) -> R</bold>): R {
56 return block(<bold>this</bold>)
55 fun <T, R> <bold>T</bold>.letNoInline(block: (T) -> R): R {
40 <bold>"C"</bold>.letNoInline {
27 <bold>"A"</bold>.let {
3 fun <bold>Any</bold>.extensionFun() {
28 <bold>it</bold>.extensionFun()
27 [LAMBDA CALLS ARGUMENT #0] "A".let <bold>{</bold>
49 (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
50 (INLINE CALL let) return block(<bold>this</bold>)
49 (INLINE CALL let) inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
27 <bold>"A"</bold>.let {
28 <bold>"A"</bold>.let {
4 fun <bold>Any</bold>.extensionFun() {
29 <bold>it</bold>.extensionFun()
28 [LAMBDA CALLS ARGUMENT #0] "A".let <bold>{</bold>
108 (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
112 (INLINE CALL let) return block(<bold>this</bold>)
108 (INLINE CALL let) public inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
28 <bold>"A"</bold>.let {
19 withNoInline(<bold>1</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
19 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
53 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
54 val result = <bold>receiver</bold>.block()
53 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
19 withNoInline(<bold>1</bold>) {
20 withNoInline(<bold>1</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
20 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
50 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
51 val result = <bold>receiver</bold>.block()
50 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
20 withNoInline(<bold>1</bold>) {
7 with(<bold>123</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
7 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
44 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
45 (INLINE CALL with) val result = <bold>receiver</bold>.block()
44 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
7 with(<bold>123</bold>) {
8 with(<bold>123</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
8 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
45 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
46 (INLINE CALL with) val result = <bold>receiver</bold>.block()
45 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
8 with(<bold>123</bold>) {
23 withNoInline(<bold>2</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
19 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
53 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
54 val result = <bold>receiver</bold>.block()
53 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
23 withNoInline(<bold>2</bold>) {
24 withNoInline(<bold>2</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
20 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
50 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
51 val result = <bold>receiver</bold>.block()
50 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
24 withNoInline(<bold>2</bold>) {
11 with(<bold>456</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
12 <bold>this</bold>.extensionFun()
11 [LAMBDA CALLS RECEIVER] with(456) <bold>{</bold>
44 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
45 (INLINE CALL with) val result = <bold>receiver</bold>.block()
44 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
11 with(<bold>456</bold>) {
12 with(<bold>456</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
13 <bold>this</bold>.extensionFun()
12 [LAMBDA CALLS RECEIVER] with(456) <bold>{</bold>
45 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
46 (INLINE CALL with) val result = <bold>receiver</bold>.block()
45 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
12 with(<bold>456</bold>) {
@@ -1,30 +1,30 @@
[NotNull Values]
7 with(<bold>123</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
7 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
44 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
45 (INLINE CALL with) val result = <bold>receiver</bold>.block()
44 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
7 with(<bold>123</bold>) {
12 <bold>this</bold>.extensionFun()
3 fun <bold>Any</bold>.extensionFun() {
12 <bold>this</bold>.extensionFun()
19 withNoInline(<bold>1</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
19 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
53 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
54 val result = <bold>receiver</bold>.block()
53 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
19 withNoInline(<bold>1</bold>) {
23 withNoInline(<bold>2</bold>) {
3 fun <bold>Any</bold>.extensionFun() {
19 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
53 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
54 val result = <bold>receiver</bold>.block()
53 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
23 withNoInline(<bold>2</bold>) {
28 <bold>it</bold>.extensionFun()
3 fun <bold>Any</bold>.extensionFun() {
28 <bold>it</bold>.extensionFun()
36 <bold>it</bold>.extensionFun()
8 with(<bold>123</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
8 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
45 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
46 (INLINE CALL with) val result = <bold>receiver</bold>.block()
45 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
8 with(<bold>123</bold>) {
13 <bold>this</bold>.extensionFun()
4 fun <bold>Any</bold>.extensionFun() {
13 <bold>this</bold>.extensionFun()
20 withNoInline(<bold>1</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
20 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
50 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
51 val result = <bold>receiver</bold>.block()
50 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
20 withNoInline(<bold>1</bold>) {
24 withNoInline(<bold>2</bold>) {
4 fun <bold>Any</bold>.extensionFun() {
20 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
50 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
51 val result = <bold>receiver</bold>.block()
50 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
24 withNoInline(<bold>2</bold>) {
37 <bold>it</bold>.extensionFun()
4 fun <bold>Any</bold>.extensionFun() {
29 <bold>it</bold>.extensionFun()
37 <bold>it</bold>.extensionFun()
@@ -1,31 +1,31 @@
3 fun <bold>Any</bold>.extensionFun() {
7 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
44 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
45 (INLINE CALL with) val result = <bold>receiver</bold>.block()
44 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
7 with(<bold>123</bold>) {
12 <bold>this</bold>.extensionFun()
11 [LAMBDA CALLS RECEIVER] with(456) <bold>{</bold>
44 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
45 (INLINE CALL with) val result = <bold>receiver</bold>.block()
44 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
11 with(<bold>456</bold>) {
19 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
53 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
54 val result = <bold>receiver</bold>.block()
53 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
19 withNoInline(<bold>1</bold>) {
23 withNoInline(<bold>2</bold>) {
28 <bold>it</bold>.extensionFun()
27 [LAMBDA CALLS ARGUMENT #0] "A".let <bold>{</bold>
49 (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
50 (INLINE CALL let) return block(<bold>this</bold>)
49 (INLINE CALL let) inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
27 <bold>"A"</bold>.let {
36 <bold>it</bold>.extensionFun()
35 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline <bold>{</bold>
58 [LAMBDA CALLS ARGUMENT #0] fun <T, R> T.letNoInline(<bold>block: (T) -> R</bold>): R {
59 return block(<bold>this</bold>)
58 fun <T, R> <bold>T</bold>.letNoInline(block: (T) -> R): R {
35 <bold>"D"</bold>.letNoInline {
39 <bold>"C"</bold>.letNoInline {
4 fun <bold>Any</bold>.extensionFun() {
8 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
45 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
46 (INLINE CALL with) val result = <bold>receiver</bold>.block()
45 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
8 with(<bold>123</bold>) {
13 <bold>this</bold>.extensionFun()
12 [LAMBDA CALLS RECEIVER] with(456) <bold>{</bold>
45 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
46 (INLINE CALL with) val result = <bold>receiver</bold>.block()
45 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
12 with(<bold>456</bold>) {
20 [LAMBDA CALLS RECEIVER] withNoInline(1) <bold>{</bold>
50 [LAMBDA CALLS RECEIVER] fun <T, R> withNoInline(receiver: T, <bold>block: T.() -> R</bold>): R {
51 val result = <bold>receiver</bold>.block()
50 fun <T, R> withNoInline(<bold>receiver: T</bold>, block: T.() -> R): R {
20 withNoInline(<bold>1</bold>) {
24 withNoInline(<bold>2</bold>) {
29 <bold>it</bold>.extensionFun()
28 [LAMBDA CALLS ARGUMENT #0] "A".let <bold>{</bold>
108 (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
112 (INLINE CALL let) return block(<bold>this</bold>)
108 (INLINE CALL let) public inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
28 <bold>"A"</bold>.let {
37 <bold>it</bold>.extensionFun()
36 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline <bold>{</bold>
55 [LAMBDA CALLS ARGUMENT #0] fun <T, R> T.letNoInline(<bold>block: (T) -> R</bold>): R {
56 return block(<bold>this</bold>)
55 fun <T, R> <bold>T</bold>.letNoInline(block: (T) -> R): R {
36 <bold>"D"</bold>.letNoInline {
40 <bold>"C"</bold>.letNoInline {
+1 -5
View File
@@ -1,5 +1,5 @@
// FLOW: IN
// WITH_RUNTIME
// RUNTIME_WITH_SOURCES
@file: JvmName("KotlinUtil")
@@ -23,7 +23,3 @@ fun String.foo() {
fun main() {
"A".foo()
}
inline fun <T, R> with(receiver: T, block: T.() -> R): R {
return receiver.block()
}
@@ -18,8 +18,8 @@
18 with(<bold>123</bold>) {
8 fun <bold>Any</bold>.extensionFun() {
18 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
27 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
28 (INLINE CALL with) return <bold>receiver</bold>.block()
27 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
18 with(<bold>123</bold>) {
@@ -8,9 +8,9 @@
18 with(<bold>123</bold>) {
8 fun <bold>Any</bold>.extensionFun() {
18 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
27 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
28 (INLINE CALL with) return <bold>receiver</bold>.block()
27 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
18 with(<bold>123</bold>) {
24 <bold>"A"</bold>.foo()
8 fun <bold>Any</bold>.extensionFun() {
@@ -5,7 +5,7 @@
12 <bold>""</bold>.extensionFun()
14 <bold>1</bold>.extensionFun()
18 [LAMBDA CALLS RECEIVER] with(123) <bold>{</bold>
27 (INLINE CALL with) [LAMBDA CALLS RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
28 (INLINE CALL with) return <bold>receiver</bold>.block()
27 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
18 with(<bold>123</bold>) {
+1 -4
View File
@@ -1,4 +1,5 @@
// FLOW: OUT
// RUNTIME_WITH_SOURCES
fun foo(<caret>p: String) {
val v1 = p.let { value -> bar(value) }
@@ -15,7 +16,3 @@ fun foo(<caret>p: String) {
fun bar(s: String) = s
fun zoo(s: String) = s
inline fun <T, R> T.let(block: (T) -> R): R {
return block(this)
}
+48 -48
View File
@@ -1,48 +1,48 @@
3 fun foo(<bold>p: String</bold>) {
4 val v1 = <bold>p</bold>.let { value -> bar(value) }
19 (INLINE CALL let) inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
20 (INLINE CALL let) return block(<bold>this</bold>)
19 (INLINE CALL let) [LAMBDA PARAMETER #0] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
4 [LAMBDA PARAMETER #0] val v1 = p.let <bold>{ value -> bar(value) }</bold>
4 val v1 = p.let { <bold>value</bold> -> bar(value) }
4 val v1 = p.let { value -> bar(<bold>value</bold>) }
16 fun bar(<bold>s: String</bold>) = s
16 fun bar(s: String) = <bold>s</bold>
16 fun <bold>bar(s: String) = s</bold>
4 val v1 = p.let { value -> <bold>bar(value)</bold> }
4 val v1 = p.let <bold>{ value -> bar(value) }</bold>
4 [LAMBDA CALLS] val v1 = p.let <bold>{ value -> bar(value) }</bold>
19 (INLINE CALL let) [LAMBDA CALLS] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
20 (INLINE CALL let) return <bold>block(this)</bold>
4 val v1 = p.<bold>let { value -> bar(value) }</bold>
4 val <bold>v1 = p.let { value -> bar(value) }</bold>
6 val v2 = <bold>p</bold>.let { it }
19 (INLINE CALL let) inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
20 (INLINE CALL let) return block(<bold>this</bold>)
19 (INLINE CALL let) [LAMBDA PARAMETER #0] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
6 [LAMBDA PARAMETER #0] val v2 = p.let <bold>{ it }</bold>
6 val v2 = p.let { <bold>it</bold> }
6 val v2 = p.let <bold>{ it }</bold>
6 [LAMBDA CALLS] val v2 = p.let <bold>{ it }</bold>
19 (INLINE CALL let) [LAMBDA CALLS] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
20 (INLINE CALL let) return <bold>block(this)</bold>
6 val v2 = p.<bold>let { it }</bold>
6 val <bold>v2 = p.let { it }</bold>
8 val v3 = <bold>p</bold>.let {
19 (INLINE CALL let) inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
20 (INLINE CALL let) return block(<bold>this</bold>)
19 (INLINE CALL let) [LAMBDA PARAMETER #0] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
8 [LAMBDA PARAMETER #0] val v3 = p.let <bold>{</bold>
13 val v4 = <bold>p</bold>.let(::zoo)
19 (INLINE CALL let) inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
20 (INLINE CALL let) return block(<bold>this</bold>)
19 (INLINE CALL let) [LAMBDA PARAMETER #0] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
13 [LAMBDA PARAMETER #0] val v4 = p.let(<bold>::zoo</bold>)
17 fun zoo(<bold>s: String</bold>) = s
17 fun zoo(s: String) = <bold>s</bold>
17 fun <bold>zoo(s: String) = s</bold>
13 [LAMBDA CALLS] val v4 = p.let(<bold>::zoo</bold>)
19 (INLINE CALL let) [LAMBDA CALLS] inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
20 (INLINE CALL let) return <bold>block(this)</bold>
13 val v4 = p.<bold>let(::zoo)</bold>
13 val <bold>v4 = p.let(::zoo)</bold>
4 fun foo(<bold>p: String</bold>) {
5 val v1 = <bold>p</bold>.let { value -> bar(value) }
108 (INLINE CALL let) public inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
112 (INLINE CALL let) return block(<bold>this</bold>)
108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
5 [LAMBDA PARAMETER #0] val v1 = p.let <bold>{ value -> bar(value) }</bold>
5 val v1 = p.let { <bold>value</bold> -> bar(value) }
5 val v1 = p.let { value -> bar(<bold>value</bold>) }
17 fun bar(<bold>s: String</bold>) = s
17 fun bar(s: String) = <bold>s</bold>
17 fun <bold>bar(s: String) = s</bold>
5 val v1 = p.let { value -> <bold>bar(value)</bold> }
5 val v1 = p.let <bold>{ value -> bar(value) }</bold>
5 [LAMBDA CALLS] val v1 = p.let <bold>{ value -> bar(value) }</bold>
108 (INLINE CALL let) [LAMBDA CALLS] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
112 (INLINE CALL let) return <bold>block(this)</bold>
5 val v1 = p.<bold>let { value -> bar(value) }</bold>
5 val <bold>v1 = p.let { value -> bar(value) }</bold>
7 val v2 = <bold>p</bold>.let { it }
108 (INLINE CALL let) public inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
112 (INLINE CALL let) return block(<bold>this</bold>)
108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
7 [LAMBDA PARAMETER #0] val v2 = p.let <bold>{ it }</bold>
7 val v2 = p.let { <bold>it</bold> }
7 val v2 = p.let <bold>{ it }</bold>
7 [LAMBDA CALLS] val v2 = p.let <bold>{ it }</bold>
108 (INLINE CALL let) [LAMBDA CALLS] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
112 (INLINE CALL let) return <bold>block(this)</bold>
7 val v2 = p.<bold>let { it }</bold>
7 val <bold>v2 = p.let { it }</bold>
9 val v3 = <bold>p</bold>.let {
108 (INLINE CALL let) public inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
112 (INLINE CALL let) return block(<bold>this</bold>)
108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
9 [LAMBDA PARAMETER #0] val v3 = p.let <bold>{</bold>
14 val v4 = <bold>p</bold>.let(::zoo)
108 (INLINE CALL let) public inline fun <T, R> <bold>T</bold>.let(block: (T) -> R): R {
112 (INLINE CALL let) return block(<bold>this</bold>)
108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
14 [LAMBDA PARAMETER #0] val v4 = p.let(<bold>::zoo</bold>)
18 fun zoo(<bold>s: String</bold>) = s
18 fun zoo(s: String) = <bold>s</bold>
18 fun <bold>zoo(s: String) = s</bold>
14 [LAMBDA CALLS] val v4 = p.let(<bold>::zoo</bold>)
108 (INLINE CALL let) [LAMBDA CALLS] public inline fun <T, R> T.let(<bold>block: (T) -> R</bold>): R {
112 (INLINE CALL let) return <bold>block(this)</bold>
14 val v4 = p.<bold>let(::zoo)</bold>
14 val <bold>v4 = p.let(::zoo)</bold>
+1 -4
View File
@@ -1,4 +1,5 @@
// FLOW: OUT
// RUNTIME_WITH_SOURCES
fun String.foo(<caret>p: String) {
val v1 = with(p) { this }
@@ -12,7 +13,3 @@ fun String.foo(<caret>p: String) {
fun bar(s: String) = s
fun zoo(s: String) = s
inline fun <T, R> with(receiver: T, block: T.() -> R): R {
return receiver.block()
}
+47 -47
View File
@@ -1,47 +1,47 @@
3 fun String.foo(<bold>p: String</bold>) {
4 val v1 = with(<bold>p</bold>) { this }
16 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
17 (INLINE CALL with) return <bold>receiver</bold>.block()
16 (INLINE CALL with) [LAMBDA RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
4 [LAMBDA RECEIVER] val v1 = with(p) <bold>{ this }</bold>
4 val v1 = with(p) { <bold>this</bold> }
4 val v1 = with(p) <bold>{ this }</bold>
4 [LAMBDA CALLS] val v1 = with(p) <bold>{ this }</bold>
16 (INLINE CALL with) [LAMBDA CALLS] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
17 (INLINE CALL with) return receiver.<bold>block()</bold>
4 val v1 = <bold>with(p) { this }</bold>
4 val <bold>v1 = with(p) { this }</bold>
6 val v2 = with(<bold>p</bold>) { bar(this) }
16 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
17 (INLINE CALL with) return <bold>receiver</bold>.block()
16 (INLINE CALL with) [LAMBDA RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
6 [LAMBDA RECEIVER] val v2 = with(p) <bold>{ bar(this) }</bold>
6 val v2 = with(p) { bar(<bold>this</bold>) }
13 fun bar(<bold>s: String</bold>) = s
13 fun bar(s: String) = <bold>s</bold>
13 fun <bold>bar(s: String) = s</bold>
6 val v2 = with(p) { <bold>bar(this)</bold> }
6 val v2 = with(p) <bold>{ bar(this) }</bold>
6 [LAMBDA CALLS] val v2 = with(p) <bold>{ bar(this) }</bold>
16 (INLINE CALL with) [LAMBDA CALLS] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
17 (INLINE CALL with) return receiver.<bold>block()</bold>
6 val v2 = <bold>with(p) { bar(this) }</bold>
6 val <bold>v2 = with(p) { bar(this) }</bold>
8 val v3 = with(<bold>p</bold>) { this@foo }
16 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
17 (INLINE CALL with) return <bold>receiver</bold>.block()
16 (INLINE CALL with) [LAMBDA RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
8 [LAMBDA RECEIVER] val v3 = with(p) <bold>{ this@foo }</bold>
10 val v4 = with(<bold>p</bold>, ::zoo)
16 (INLINE CALL with) inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
17 (INLINE CALL with) return <bold>receiver</bold>.block()
16 (INLINE CALL with) [LAMBDA RECEIVER] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
10 [LAMBDA RECEIVER] val v4 = with(p, <bold>::zoo</bold>)
14 fun zoo(<bold>s: String</bold>) = s
14 fun zoo(s: String) = <bold>s</bold>
14 fun <bold>zoo(s: String) = s</bold>
10 [LAMBDA CALLS] val v4 = with(p, <bold>::zoo</bold>)
16 (INLINE CALL with) [LAMBDA CALLS] inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
17 (INLINE CALL with) return receiver.<bold>block()</bold>
10 val v4 = <bold>with(p, ::zoo)</bold>
10 val <bold>v4 = with(p, ::zoo)</bold>
4 fun String.foo(<bold>p: String</bold>) {
5 val v1 = with(<bold>p</bold>) { this }
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
5 [LAMBDA RECEIVER] val v1 = with(p) <bold>{ this }</bold>
5 val v1 = with(p) { <bold>this</bold> }
5 val v1 = with(p) <bold>{ this }</bold>
5 [LAMBDA CALLS] val v1 = with(p) <bold>{ this }</bold>
66 (INLINE CALL with) [LAMBDA CALLS] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return receiver.<bold>block()</bold>
5 val v1 = <bold>with(p) { this }</bold>
5 val <bold>v1 = with(p) { this }</bold>
7 val v2 = with(<bold>p</bold>) { bar(this) }
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
7 [LAMBDA RECEIVER] val v2 = with(p) <bold>{ bar(this) }</bold>
7 val v2 = with(p) { bar(<bold>this</bold>) }
14 fun bar(<bold>s: String</bold>) = s
14 fun bar(s: String) = <bold>s</bold>
14 fun <bold>bar(s: String) = s</bold>
7 val v2 = with(p) { <bold>bar(this)</bold> }
7 val v2 = with(p) <bold>{ bar(this) }</bold>
7 [LAMBDA CALLS] val v2 = with(p) <bold>{ bar(this) }</bold>
66 (INLINE CALL with) [LAMBDA CALLS] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return receiver.<bold>block()</bold>
7 val v2 = <bold>with(p) { bar(this) }</bold>
7 val <bold>v2 = with(p) { bar(this) }</bold>
9 val v3 = with(<bold>p</bold>) { this@foo }
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
9 [LAMBDA RECEIVER] val v3 = with(p) <bold>{ this@foo }</bold>
11 val v4 = with(<bold>p</bold>, ::zoo)
66 (INLINE CALL with) public inline fun <T, R> with(<bold>receiver: T</bold>, block: T.() -> R): R {
70 (INLINE CALL with) return <bold>receiver</bold>.block()
66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
11 [LAMBDA RECEIVER] val v4 = with(p, <bold>::zoo</bold>)
15 fun zoo(<bold>s: String</bold>) = s
15 fun zoo(s: String) = <bold>s</bold>
15 fun <bold>zoo(s: String) = s</bold>
11 [LAMBDA CALLS] val v4 = with(p, <bold>::zoo</bold>)
66 (INLINE CALL with) [LAMBDA CALLS] public inline fun <T, R> with(receiver: T, <bold>block: T.() -> R</bold>): R {
70 (INLINE CALL with) return receiver.<bold>block()</bold>
11 val v4 = <bold>with(p, ::zoo)</bold>
11 val <bold>v4 = with(p, ::zoo)</bold>
@@ -178,6 +178,11 @@ public class SlicerLeafGroupingTestGenerated extends AbstractSlicerLeafGroupingT
runTest("idea/testData/slicer/inflow/ifExpression.kt");
}
@TestMetadata("inlineExtensionImplicitReceiver.kt")
public void testInlineExtensionImplicitReceiver() throws Exception {
runTest("idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.kt");
}
@TestMetadata("inlineFunctionManyCalls.kt")
public void testInlineFunctionManyCalls() throws Exception {
runTest("idea/testData/slicer/inflow/inlineFunctionManyCalls.kt");
@@ -178,6 +178,11 @@ public class SlicerNullnessGroupingTestGenerated extends AbstractSlicerNullnessG
runTest("idea/testData/slicer/inflow/ifExpression.kt");
}
@TestMetadata("inlineExtensionImplicitReceiver.kt")
public void testInlineExtensionImplicitReceiver() throws Exception {
runTest("idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.kt");
}
@TestMetadata("inlineFunctionManyCalls.kt")
public void testInlineFunctionManyCalls() throws Exception {
runTest("idea/testData/slicer/inflow/inlineFunctionManyCalls.kt");
@@ -190,6 +190,11 @@ public class SlicerTreeTestGenerated extends AbstractSlicerTreeTest {
runTest("idea/testData/slicer/inflow/ifExpression.kt");
}
@TestMetadata("inlineExtensionImplicitReceiver.kt")
public void testInlineExtensionImplicitReceiver() throws Exception {
runTest("idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.kt");
}
@TestMetadata("inlineFunctionManyCalls.kt")
public void testInlineFunctionManyCalls() throws Exception {
runTest("idea/testData/slicer/inflow/inlineFunctionManyCalls.kt");