From 61d4383cb9d8249f9aac3dadc7d91fffa640cbd8 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Sat, 11 Apr 2020 11:07:04 +0300 Subject: [PATCH] Merged LambdaResultOutflowBehaviour and LambdaCallsBehaviour into one --- .../kotlin/idea/slicer/KotlinSliceUsage.kt | 31 ------------------- .../idea/slicer/LambdaCallsBehaviour.kt | 5 +-- .../slicer/LambdaResultInflowBehaviour.kt | 25 +++++++++++++++ .../kotlin/idea/slicer/OutflowSlicer.kt | 13 +++----- .../kotlin/idea/slicer/SliceProducer.kt | 9 ++++++ .../anonymousFunBodyExpression.leafGroups.txt | 10 +++--- .../anonymousFunBodyExpression.results.txt | 10 +++--- ...nonymousFunReturnExpression.leafGroups.txt | 10 +++--- .../anonymousFunReturnExpression.results.txt | 10 +++--- .../anonymousFunctionParameter.leafGroups.txt | 4 +-- .../anonymousFunctionParameter.results.txt | 4 +-- .../inflow/doubleLambdaResult.leafGroups.txt | 29 +++++++++-------- .../inflow/doubleLambdaResult.results.txt | 29 +++++++++-------- ...sionLambdaImplicitParameter.leafGroups.txt | 12 +++---- ...tensionLambdaImplicitParameter.results.txt | 4 +-- .../extensionLambdaParameter.leafGroups.txt | 12 +++---- .../extensionLambdaParameter.results.txt | 4 +-- .../funResultViaCallableRef.leafGroups.txt | 6 ++-- .../funResultViaCallableRef.results.txt | 6 ++-- ...iaCallableRefWithAssignment.leafGroups.txt | 10 +++--- ...ltViaCallableRefWithAssignment.results.txt | 10 +++--- ...iaCallableRefWithDirectCall.leafGroups.txt | 2 +- ...ltViaCallableRefWithDirectCall.results.txt | 2 +- .../lambdaImplicitParameter.leafGroups.txt | 4 +-- .../lambdaImplicitParameter.results.txt | 4 +-- .../inflow/lambdaParameter.leafGroups.txt | 4 +-- .../slicer/inflow/lambdaParameter.results.txt | 4 +-- .../slicer/inflow/lambdaResult.leafGroups.txt | 10 +++--- .../slicer/inflow/lambdaResult.results.txt | 10 +++--- ...lambdaResultWithAssignments.leafGroups.txt | 18 +++++------ .../lambdaResultWithAssignments.results.txt | 18 +++++------ .../lambdaResultWithDirectCall.leafGroups.txt | 2 +- .../lambdaResultWithDirectCall.results.txt | 2 +- ...WithDirectCallViaAssignment.leafGroups.txt | 6 ++-- ...ultWithDirectCallViaAssignment.results.txt | 6 ++-- .../inflow/nonLocalReturn.leafGroups.txt | 10 +++--- .../slicer/inflow/nonLocalReturn.results.txt | 10 +++--- .../anonymousFunBodyExpression.results.txt | 13 ++++---- .../anonymousFunReturnExpression.results.txt | 13 ++++---- .../outflow/doubleLambdaResult.results.txt | 19 ++++++------ ...explicitLambdaReturnExpression.results.txt | 13 ++++---- .../funResultViaCallableRef.results.txt | 13 ++++---- ...ltViaCallableRefWithAssignment.results.txt | 17 +++++----- ...ltViaCallableRefWithDirectCall.results.txt | 2 +- .../slicer/outflow/lambdaResult.results.txt | 13 ++++---- .../lambdaResultWithAssignments.results.txt | 17 +++++----- .../lambdaResultWithDirectCall.results.txt | 2 +- ...ultWithDirectCallViaAssignment.results.txt | 9 +++--- 48 files changed, 242 insertions(+), 254 deletions(-) create mode 100644 idea/src/org/jetbrains/kotlin/idea/slicer/LambdaResultInflowBehaviour.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceUsage.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceUsage.kt index 8d467992a8869..1dbec4645d38b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceUsage.kt +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceUsage.kt @@ -20,7 +20,6 @@ import com.intellij.psi.PsiElement import com.intellij.slicer.SliceAnalysisParams import com.intellij.slicer.SliceUsage import com.intellij.usageView.UsageInfo -import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor import org.jetbrains.kotlin.psi.KtElement @@ -100,33 +99,3 @@ open class KotlinSliceUsage : SliceUsage { } } -data class LambdaResultOutflowBehaviour( - override val originalBehaviour: KotlinSliceUsage.SpecialBehaviour? -) : KotlinSliceUsage.SpecialBehaviour { - - override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) { - OutflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode) - } - - override val slicePresentationPrefix: String - get() = KotlinBundle.message("slicer.text.tracking.enclosing.lambda") - - override val testPresentationPrefix: String - get() = "[LAMBDA] " -} - -data class LambdaResultInflowBehaviour( - override val originalBehaviour: KotlinSliceUsage.SpecialBehaviour? -) : KotlinSliceUsage.SpecialBehaviour { - - override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) { - InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode) - } - - override val slicePresentationPrefix: String - get() = KotlinBundle.message("slicer.text.tracking.enclosing.lambda") - - override val testPresentationPrefix: String - get() = "[LAMBDA] " -} - diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaCallsBehaviour.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaCallsBehaviour.kt index d45fe7bd2872f..e35ca309feb83 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaCallsBehaviour.kt +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaCallsBehaviour.kt @@ -24,7 +24,8 @@ data class LambdaCallsBehaviour( val sliceElement = sliceUsage.element ?: return true val resolvedCall = (sliceElement as? KtElement)?.resolveToCall() if (resolvedCall?.call?.callType == Call.CallType.INVOKE) { - return sliceProducer.produceAndProcess(sliceUsage, originalBehaviour, parent, uniqueProcessor) + val newSliceUsage = KotlinSliceUsage(resolvedCall.call.callElement, parent, originalBehaviour, true) + return sliceProducer.produceAndProcess(newSliceUsage, originalBehaviour, parent, uniqueProcessor) } } return uniqueProcessor.process(sliceUsage) @@ -37,5 +38,5 @@ data class LambdaCallsBehaviour( get() = KotlinBundle.message("slicer.text.tracking.lambda.calls") override val testPresentationPrefix: String - get() = "[LAMBDA CALLS] " + get() = "[LAMBDA OUT] " } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaResultInflowBehaviour.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaResultInflowBehaviour.kt new file mode 100644 index 0000000000000..c818e4272fe05 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/LambdaResultInflowBehaviour.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.slicer + +import org.jetbrains.kotlin.idea.KotlinBundle +import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor +import org.jetbrains.kotlin.psi.KtElement + +data class LambdaResultInflowBehaviour( + override val originalBehaviour: KotlinSliceUsage.SpecialBehaviour? +) : KotlinSliceUsage.SpecialBehaviour { + + override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) { + InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode) + } + + override val slicePresentationPrefix: String + get() = KotlinBundle.message("slicer.text.tracking.enclosing.lambda") + + override val testPresentationPrefix: String + get() = "[LAMBDA IN] " +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt index 1b435016c6f50..b54f4fdf919c9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt @@ -160,7 +160,7 @@ class OutflowSlicer( is KtNamedFunction -> function else -> null } ?: return - funExpression.passToProcessor(LambdaResultOutflowBehaviour(behaviour), forcedExpressionMode = true) + funExpression.passToProcessor(LambdaCallsBehaviour(SliceProducer.Trivial, behaviour), forcedExpressionMode = true) } private fun processExtensionReceiver(declaration: KtCallableDeclaration, declarationWithBody: KtDeclarationWithBody) { @@ -223,13 +223,8 @@ class OutflowSlicer( } Call.CallType.INVOKE -> { - if (receiverValue == resolvedCall.dispatchReceiver) { - if (behaviour is LambdaResultOutflowBehaviour) { - instruction.element.passToProcessor(behaviour.originalBehaviour) - } - else if (behaviour is LambdaCallsBehaviour) { - instruction.element.passToProcessor(behaviour) - } + if (receiverValue == resolvedCall.dispatchReceiver && behaviour is LambdaCallsBehaviour) { + instruction.element.passToProcessor(behaviour) } } @@ -291,7 +286,7 @@ class OutflowSlicer( refElement.getCallElementForExactCallee() ?.let { this += KotlinSliceUsage(it, parent, behaviour, false) } refElement.getCallableReferenceForExactCallee() - ?.let { this += KotlinSliceUsage(it, parent, LambdaResultOutflowBehaviour(behaviour), false) } + ?.let { this += KotlinSliceUsage(it, parent, LambdaCallsBehaviour(SliceProducer.Trivial, behaviour), false) } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/SliceProducer.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/SliceProducer.kt index bbe7a09326371..c8c71014884e8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/SliceProducer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/SliceProducer.kt @@ -14,6 +14,15 @@ interface SliceProducer { override fun equals(other: Any?): Boolean override fun hashCode(): Int + + object Trivial : SliceProducer { + override fun produce(usage: UsageInfo, behaviour: KotlinSliceUsage.SpecialBehaviour?, parent: SliceUsage): Collection? { + return null + } + + override fun equals(other: Any?) = other === this + override fun hashCode() = 0 + } } fun SliceProducer.produceAndProcess( diff --git a/idea/testData/slicer/inflow/anonymousFunBodyExpression.leafGroups.txt b/idea/testData/slicer/inflow/anonymousFunBodyExpression.leafGroups.txt index c38e2483cdcf9..4a1658ae8e330 100644 --- a/idea/testData/slicer/inflow/anonymousFunBodyExpression.leafGroups.txt +++ b/idea/testData/slicer/inflow/anonymousFunBodyExpression.leafGroups.txt @@ -3,13 +3,13 @@ 8 val x = foo(fun(n: Int) = n) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -8 [LAMBDA] val x = foo(fun(n: Int) = n) +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA IN] val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) -8 [LAMBDA CALLS] val x = foo(fun(n: Int) = n) -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA OUT] val x = foo(fun(n: Int) = n) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { 4 return f(1) diff --git a/idea/testData/slicer/inflow/anonymousFunBodyExpression.results.txt b/idea/testData/slicer/inflow/anonymousFunBodyExpression.results.txt index d8efe582cae5c..129a5aad95a6b 100644 --- a/idea/testData/slicer/inflow/anonymousFunBodyExpression.results.txt +++ b/idea/testData/slicer/inflow/anonymousFunBodyExpression.results.txt @@ -2,12 +2,12 @@ 8 val x = foo(fun(n: Int) = n) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -8 [LAMBDA] val x = foo(fun(n: Int) = n) +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA IN] val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) -8 [LAMBDA CALLS] val x = foo(fun(n: Int) = n) -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA OUT] val x = foo(fun(n: Int) = n) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { 4 return f(1) diff --git a/idea/testData/slicer/inflow/anonymousFunReturnExpression.leafGroups.txt b/idea/testData/slicer/inflow/anonymousFunReturnExpression.leafGroups.txt index 672ee34b7f1ca..49256ba313b37 100644 --- a/idea/testData/slicer/inflow/anonymousFunReturnExpression.leafGroups.txt +++ b/idea/testData/slicer/inflow/anonymousFunReturnExpression.leafGroups.txt @@ -3,13 +3,13 @@ 8 val x = foo(fun(n: Int): Int { return n }) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -8 [LAMBDA] val x = foo(fun(n: Int): Int { return n }) +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA IN] val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) -8 [LAMBDA CALLS] val x = foo(fun(n: Int): Int { return n }) -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA OUT] val x = foo(fun(n: Int): Int { return n }) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { 4 return f(1) diff --git a/idea/testData/slicer/inflow/anonymousFunReturnExpression.results.txt b/idea/testData/slicer/inflow/anonymousFunReturnExpression.results.txt index f32ddac45d101..5176b36b6147b 100644 --- a/idea/testData/slicer/inflow/anonymousFunReturnExpression.results.txt +++ b/idea/testData/slicer/inflow/anonymousFunReturnExpression.results.txt @@ -2,12 +2,12 @@ 8 val x = foo(fun(n: Int): Int { return n }) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -8 [LAMBDA] val x = foo(fun(n: Int): Int { return n }) +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA IN] val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) -8 [LAMBDA CALLS] val x = foo(fun(n: Int): Int { return n }) -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA OUT] val x = foo(fun(n: Int): Int { return n }) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { 4 return f(1) diff --git a/idea/testData/slicer/inflow/anonymousFunctionParameter.leafGroups.txt b/idea/testData/slicer/inflow/anonymousFunctionParameter.leafGroups.txt index ed09a376a8edf..9829d72ec7603 100644 --- a/idea/testData/slicer/inflow/anonymousFunctionParameter.leafGroups.txt +++ b/idea/testData/slicer/inflow/anonymousFunctionParameter.leafGroups.txt @@ -2,7 +2,7 @@ 9 val v = value 9 val v = value 8 foo(fun(value: Int) { -8 [LAMBDA CALLS] foo(fun(value: Int) { -3 [LAMBDA CALLS] fun foo(f: (Int) -> Unit) { +8 [LAMBDA OUT] foo(fun(value: Int) { +3 [LAMBDA OUT] fun foo(f: (Int) -> Unit) { 4 f(1) diff --git a/idea/testData/slicer/inflow/anonymousFunctionParameter.results.txt b/idea/testData/slicer/inflow/anonymousFunctionParameter.results.txt index 527b2743a3c20..a377af065e9e2 100644 --- a/idea/testData/slicer/inflow/anonymousFunctionParameter.results.txt +++ b/idea/testData/slicer/inflow/anonymousFunctionParameter.results.txt @@ -1,6 +1,6 @@ 9 val v = value 9 val v = value 8 foo(fun(value: Int) { -8 [LAMBDA CALLS] foo(fun(value: Int) { -3 [LAMBDA CALLS] fun foo(f: (Int) -> Unit) { +8 [LAMBDA OUT] foo(fun(value: Int) { +3 [LAMBDA OUT] fun foo(f: (Int) -> Unit) { 4 f(1) diff --git a/idea/testData/slicer/inflow/doubleLambdaResult.leafGroups.txt b/idea/testData/slicer/inflow/doubleLambdaResult.leafGroups.txt index d92bcf7034f04..167d71f7fddfb 100644 --- a/idea/testData/slicer/inflow/doubleLambdaResult.leafGroups.txt +++ b/idea/testData/slicer/inflow/doubleLambdaResult.leafGroups.txt @@ -3,21 +3,20 @@ 8 val x = foo(1, 2) { { it } } 3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { 4 return f(a)(b) -4 [LAMBDA] return f(a)(b) -4 [LAMBDA] [LAMBDA] return f(a)(b) -3 [LAMBDA] [LAMBDA] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -8 [LAMBDA] [LAMBDA] val x = foo(1, 2) { { it } } -8 [LAMBDA] val x = foo(1, 2) { { it } } -8 [LAMBDA] val x = foo(1, 2) { { it } } +4 [LAMBDA IN] return f(a)(b) +4 [LAMBDA IN] [LAMBDA IN] return f(a)(b) +3 [LAMBDA IN] [LAMBDA IN] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +8 [LAMBDA IN] [LAMBDA IN] val x = foo(1, 2) { { it } } +8 [LAMBDA IN] val x = foo(1, 2) { { it } } +8 [LAMBDA IN] val x = foo(1, 2) { { it } } 8 val x = foo(1, 2) { { it } } 8 val x = foo(1, 2) { { it } } -8 [LAMBDA CALLS] val x = foo(1, 2) { { it } } -8 [LAMBDA CALLS] val x = foo(1, 2) { { it } } -8 [LAMBDA] [LAMBDA CALLS] val x = foo(1, 2) { { it } } -3 [LAMBDA] [LAMBDA CALLS] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -4 [LAMBDA] [LAMBDA CALLS] return f(a)(b) -4 [LAMBDA CALLS] return f(a)(b) -4 return f(a)(b) -3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -8 val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] [LAMBDA OUT] val x = foo(1, 2) { { it } } +3 [LAMBDA OUT] [LAMBDA OUT] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +4 [LAMBDA OUT] return f(a)(b) +4 return f(a)(b) +3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +8 val x = foo(1, 2) { { it } } diff --git a/idea/testData/slicer/inflow/doubleLambdaResult.results.txt b/idea/testData/slicer/inflow/doubleLambdaResult.results.txt index 1ac7196ff12bb..e2f47571e414a 100644 --- a/idea/testData/slicer/inflow/doubleLambdaResult.results.txt +++ b/idea/testData/slicer/inflow/doubleLambdaResult.results.txt @@ -2,20 +2,19 @@ 8 val x = foo(1, 2) { { it } } 3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { 4 return f(a)(b) -4 [LAMBDA] return f(a)(b) -4 [LAMBDA] [LAMBDA] return f(a)(b) -3 [LAMBDA] [LAMBDA] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -8 [LAMBDA] [LAMBDA] val x = foo(1, 2) { { it } } -8 [LAMBDA] val x = foo(1, 2) { { it } } -8 [LAMBDA] val x = foo(1, 2) { { it } } +4 [LAMBDA IN] return f(a)(b) +4 [LAMBDA IN] [LAMBDA IN] return f(a)(b) +3 [LAMBDA IN] [LAMBDA IN] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +8 [LAMBDA IN] [LAMBDA IN] val x = foo(1, 2) { { it } } +8 [LAMBDA IN] val x = foo(1, 2) { { it } } +8 [LAMBDA IN] val x = foo(1, 2) { { it } } 8 val x = foo(1, 2) { { it } } 8 val x = foo(1, 2) { { it } } -8 [LAMBDA CALLS] val x = foo(1, 2) { { it } } -8 [LAMBDA CALLS] val x = foo(1, 2) { { it } } -8 [LAMBDA] [LAMBDA CALLS] val x = foo(1, 2) { { it } } -3 [LAMBDA] [LAMBDA CALLS] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -4 [LAMBDA] [LAMBDA CALLS] return f(a)(b) -4 [LAMBDA CALLS] return f(a)(b) -4 return f(a)(b) -3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -8 val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] [LAMBDA OUT] val x = foo(1, 2) { { it } } +3 [LAMBDA OUT] [LAMBDA OUT] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +4 [LAMBDA OUT] return f(a)(b) +4 return f(a)(b) +3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +8 val x = foo(1, 2) { { it } } diff --git a/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.leafGroups.txt b/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.leafGroups.txt index bc76f81556186..d0367eedca1b5 100644 --- a/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.leafGroups.txt +++ b/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.leafGroups.txt @@ -1,18 +1,18 @@ 4 f("", 1) 15 val v = it -14 [LAMBDA CALLS] foo { -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 4 f("", 1) 6 "".f(2) 15 val v = it -14 [LAMBDA CALLS] foo { -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 6 "".f(2) 9 f(3) 15 val v = it -14 [LAMBDA CALLS] foo { -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 9 f(3) diff --git a/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.results.txt b/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.results.txt index 0afcb0bf3fac4..d3156e6033b74 100644 --- a/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.results.txt +++ b/idea/testData/slicer/inflow/extensionLambdaImplicitParameter.results.txt @@ -1,6 +1,6 @@ 15 val v = it -14 [LAMBDA CALLS] foo { -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 4 f("", 1) 6 "".f(2) 9 f(3) diff --git a/idea/testData/slicer/inflow/extensionLambdaParameter.leafGroups.txt b/idea/testData/slicer/inflow/extensionLambdaParameter.leafGroups.txt index 9f625c5ca9f95..664005b2e02cc 100644 --- a/idea/testData/slicer/inflow/extensionLambdaParameter.leafGroups.txt +++ b/idea/testData/slicer/inflow/extensionLambdaParameter.leafGroups.txt @@ -1,21 +1,21 @@ 4 f("", 1) 15 val v = i 14 foo { i -> -14 [LAMBDA CALLS] foo { i -> -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { i -> +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 4 f("", 1) 6 "".f(2) 15 val v = i 14 foo { i -> -14 [LAMBDA CALLS] foo { i -> -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { i -> +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 6 "".f(2) 9 f(3) 15 val v = i 14 foo { i -> -14 [LAMBDA CALLS] foo { i -> -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { i -> +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 9 f(3) diff --git a/idea/testData/slicer/inflow/extensionLambdaParameter.results.txt b/idea/testData/slicer/inflow/extensionLambdaParameter.results.txt index f87457e46a3bb..1550b384c4dd9 100644 --- a/idea/testData/slicer/inflow/extensionLambdaParameter.results.txt +++ b/idea/testData/slicer/inflow/extensionLambdaParameter.results.txt @@ -1,7 +1,7 @@ 15 val v = i 14 foo { i -> -14 [LAMBDA CALLS] foo { i -> -3 [LAMBDA CALLS] fun foo(f: String.(Int) -> Unit) { +14 [LAMBDA OUT] foo { i -> +3 [LAMBDA OUT] fun foo(f: String.(Int) -> Unit) { 4 f("", 1) 6 "".f(2) 9 f(3) diff --git a/idea/testData/slicer/inflow/funResultViaCallableRef.leafGroups.txt b/idea/testData/slicer/inflow/funResultViaCallableRef.leafGroups.txt index 4585f60597140..78f794f3de09c 100644 --- a/idea/testData/slicer/inflow/funResultViaCallableRef.leafGroups.txt +++ b/idea/testData/slicer/inflow/funResultViaCallableRef.leafGroups.txt @@ -3,9 +3,9 @@ 9 val x = foo(::bar) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -9 [LAMBDA] val x = foo(::bar) +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +9 [LAMBDA IN] val x = foo(::bar) 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n diff --git a/idea/testData/slicer/inflow/funResultViaCallableRef.results.txt b/idea/testData/slicer/inflow/funResultViaCallableRef.results.txt index f85f5507d9c54..9a7c0d68e5ed3 100644 --- a/idea/testData/slicer/inflow/funResultViaCallableRef.results.txt +++ b/idea/testData/slicer/inflow/funResultViaCallableRef.results.txt @@ -2,9 +2,9 @@ 9 val x = foo(::bar) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -9 [LAMBDA] val x = foo(::bar) +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +9 [LAMBDA IN] val x = foo(::bar) 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n diff --git a/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.leafGroups.txt b/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.leafGroups.txt index 9ec414ea1f52b..0501bacea4dd7 100644 --- a/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.leafGroups.txt +++ b/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.leafGroups.txt @@ -3,11 +3,11 @@ 10 val x = foo(f) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -10 [LAMBDA] val x = foo(f) -9 [LAMBDA] val f = ::bar -9 [LAMBDA] val f = ::bar +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +10 [LAMBDA IN] val x = foo(f) +9 [LAMBDA IN] val f = ::bar +9 [LAMBDA IN] val f = ::bar 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n diff --git a/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.results.txt b/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.results.txt index 39b1d8c302c53..cdcb5f556c2ba 100644 --- a/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.results.txt +++ b/idea/testData/slicer/inflow/funResultViaCallableRefWithAssignment.results.txt @@ -2,11 +2,11 @@ 10 val x = foo(f) 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -10 [LAMBDA] val x = foo(f) -9 [LAMBDA] val f = ::bar -9 [LAMBDA] val f = ::bar +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +10 [LAMBDA IN] val x = foo(f) +9 [LAMBDA IN] val f = ::bar +9 [LAMBDA IN] val f = ::bar 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n diff --git a/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.leafGroups.txt b/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.leafGroups.txt index f5afba2db2278..439052b0033c7 100644 --- a/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.leafGroups.txt +++ b/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.leafGroups.txt @@ -1,7 +1,7 @@ 5 val x = (::bar)(1) 5 val x = (::bar)(1) 5 val x = (::bar)(1) -5 [LAMBDA] val x = (::bar)(1) +5 [LAMBDA IN] val x = (::bar)(1) 4 fun bar(n: Int) = n 4 fun bar(n: Int) = n 4 fun bar(n: Int) = n diff --git a/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.results.txt b/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.results.txt index 2de187b773ffa..0ddad2022ee59 100644 --- a/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.results.txt +++ b/idea/testData/slicer/inflow/funResultViaCallableRefWithDirectCall.results.txt @@ -1,6 +1,6 @@ 5 val x = (::bar)(1) 5 val x = (::bar)(1) -5 [LAMBDA] val x = (::bar)(1) +5 [LAMBDA IN] val x = (::bar)(1) 4 fun bar(n: Int) = n 4 fun bar(n: Int) = n 4 fun bar(n: Int) = n diff --git a/idea/testData/slicer/inflow/lambdaImplicitParameter.leafGroups.txt b/idea/testData/slicer/inflow/lambdaImplicitParameter.leafGroups.txt index 74c485a47eced..f119c12963429 100644 --- a/idea/testData/slicer/inflow/lambdaImplicitParameter.leafGroups.txt +++ b/idea/testData/slicer/inflow/lambdaImplicitParameter.leafGroups.txt @@ -1,6 +1,6 @@ 4 f(1) 9 val v = it -8 [LAMBDA CALLS] foo { -3 [LAMBDA CALLS] fun foo(f: (Int) -> Unit) { +8 [LAMBDA OUT] foo { +3 [LAMBDA OUT] fun foo(f: (Int) -> Unit) { 4 f(1) diff --git a/idea/testData/slicer/inflow/lambdaImplicitParameter.results.txt b/idea/testData/slicer/inflow/lambdaImplicitParameter.results.txt index 29383bcc54e2a..0ee8ed4de5d63 100644 --- a/idea/testData/slicer/inflow/lambdaImplicitParameter.results.txt +++ b/idea/testData/slicer/inflow/lambdaImplicitParameter.results.txt @@ -1,4 +1,4 @@ 9 val v = it -8 [LAMBDA CALLS] foo { -3 [LAMBDA CALLS] fun foo(f: (Int) -> Unit) { +8 [LAMBDA OUT] foo { +3 [LAMBDA OUT] fun foo(f: (Int) -> Unit) { 4 f(1) diff --git a/idea/testData/slicer/inflow/lambdaParameter.leafGroups.txt b/idea/testData/slicer/inflow/lambdaParameter.leafGroups.txt index a8566b9388e29..8223b48932739 100644 --- a/idea/testData/slicer/inflow/lambdaParameter.leafGroups.txt +++ b/idea/testData/slicer/inflow/lambdaParameter.leafGroups.txt @@ -1,7 +1,7 @@ 4 f(1) 9 val v = value 8 foo { value -> -8 [LAMBDA CALLS] foo { value -> -3 [LAMBDA CALLS] fun foo(f: (Int) -> Unit) { +8 [LAMBDA OUT] foo { value -> +3 [LAMBDA OUT] fun foo(f: (Int) -> Unit) { 4 f(1) diff --git a/idea/testData/slicer/inflow/lambdaParameter.results.txt b/idea/testData/slicer/inflow/lambdaParameter.results.txt index 310aec046503e..5baff0fc17c61 100644 --- a/idea/testData/slicer/inflow/lambdaParameter.results.txt +++ b/idea/testData/slicer/inflow/lambdaParameter.results.txt @@ -1,5 +1,5 @@ 9 val v = value 8 foo { value -> -8 [LAMBDA CALLS] foo { value -> -3 [LAMBDA CALLS] fun foo(f: (Int) -> Unit) { +8 [LAMBDA OUT] foo { value -> +3 [LAMBDA OUT] fun foo(f: (Int) -> Unit) { 4 f(1) diff --git a/idea/testData/slicer/inflow/lambdaResult.leafGroups.txt b/idea/testData/slicer/inflow/lambdaResult.leafGroups.txt index 5e71f82c65a1d..dbb18f5b28b87 100644 --- a/idea/testData/slicer/inflow/lambdaResult.leafGroups.txt +++ b/idea/testData/slicer/inflow/lambdaResult.leafGroups.txt @@ -3,12 +3,12 @@ 8 val x = foo { it } 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -8 [LAMBDA] val x = foo { it } +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA IN] val x = foo { it } 8 val x = foo { it } 8 val x = foo { it } -8 [LAMBDA CALLS] val x = foo { it } -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA OUT] val x = foo { it } +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { 4 return f(1) diff --git a/idea/testData/slicer/inflow/lambdaResult.results.txt b/idea/testData/slicer/inflow/lambdaResult.results.txt index d6fe53789dcea..ffe6c322d19bf 100644 --- a/idea/testData/slicer/inflow/lambdaResult.results.txt +++ b/idea/testData/slicer/inflow/lambdaResult.results.txt @@ -2,11 +2,11 @@ 8 val x = foo { it } 3 fun foo(f: (Int) -> Int): Int { 4 return f(1) -4 [LAMBDA] return f(1) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -8 [LAMBDA] val x = foo { it } +4 [LAMBDA IN] return f(1) +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA IN] val x = foo { it } 8 val x = foo { it } 8 val x = foo { it } -8 [LAMBDA CALLS] val x = foo { it } -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { +8 [LAMBDA OUT] val x = foo { it } +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { 4 return f(1) diff --git a/idea/testData/slicer/inflow/lambdaResultWithAssignments.leafGroups.txt b/idea/testData/slicer/inflow/lambdaResultWithAssignments.leafGroups.txt index 93238c3f0d777..b795c1da72fef 100644 --- a/idea/testData/slicer/inflow/lambdaResultWithAssignments.leafGroups.txt +++ b/idea/testData/slicer/inflow/lambdaResultWithAssignments.leafGroups.txt @@ -3,16 +3,16 @@ 9 val y = foo { it } 3 fun foo(f: (Int) -> Int): Int { 5 return x(1) -5 [LAMBDA] return x(1) -4 [LAMBDA] val x = f -4 [LAMBDA] val x = f -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -9 [LAMBDA] val y = foo { it } +5 [LAMBDA IN] return x(1) +4 [LAMBDA IN] val x = f +4 [LAMBDA IN] val x = f +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +9 [LAMBDA IN] val y = foo { it } 9 val y = foo { it } 9 val y = foo { it } -9 [LAMBDA CALLS] val y = foo { it } -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA CALLS] val x = f -4 [LAMBDA CALLS] val x = f +9 [LAMBDA OUT] val y = foo { it } +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 [LAMBDA OUT] val x = f +4 [LAMBDA OUT] val x = f 5 return x(1) diff --git a/idea/testData/slicer/inflow/lambdaResultWithAssignments.results.txt b/idea/testData/slicer/inflow/lambdaResultWithAssignments.results.txt index 18c9144f7bcaf..8be294333955c 100644 --- a/idea/testData/slicer/inflow/lambdaResultWithAssignments.results.txt +++ b/idea/testData/slicer/inflow/lambdaResultWithAssignments.results.txt @@ -2,15 +2,15 @@ 9 val y = foo { it } 3 fun foo(f: (Int) -> Int): Int { 5 return x(1) -5 [LAMBDA] return x(1) -4 [LAMBDA] val x = f -4 [LAMBDA] val x = f -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -9 [LAMBDA] val y = foo { it } +5 [LAMBDA IN] return x(1) +4 [LAMBDA IN] val x = f +4 [LAMBDA IN] val x = f +3 [LAMBDA IN] fun foo(f: (Int) -> Int): Int { +9 [LAMBDA IN] val y = foo { it } 9 val y = foo { it } 9 val y = foo { it } -9 [LAMBDA CALLS] val y = foo { it } -3 [LAMBDA CALLS] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA CALLS] val x = f -4 [LAMBDA CALLS] val x = f +9 [LAMBDA OUT] val y = foo { it } +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 [LAMBDA OUT] val x = f +4 [LAMBDA OUT] val x = f 5 return x(1) diff --git a/idea/testData/slicer/inflow/lambdaResultWithDirectCall.leafGroups.txt b/idea/testData/slicer/inflow/lambdaResultWithDirectCall.leafGroups.txt index bc3ef25b42a51..e5249b417968d 100644 --- a/idea/testData/slicer/inflow/lambdaResultWithDirectCall.leafGroups.txt +++ b/idea/testData/slicer/inflow/lambdaResultWithDirectCall.leafGroups.txt @@ -1,7 +1,7 @@ 4 val x = { 1 }() 4 val x = { 1 }() 4 val x = { 1 }() -4 [LAMBDA] val x = { 1 }() +4 [LAMBDA IN] val x = { 1 }() 4 val x = { 1 }() 4 val x = { 1 }() diff --git a/idea/testData/slicer/inflow/lambdaResultWithDirectCall.results.txt b/idea/testData/slicer/inflow/lambdaResultWithDirectCall.results.txt index bcd8bf85b7ca9..175d038bc3518 100644 --- a/idea/testData/slicer/inflow/lambdaResultWithDirectCall.results.txt +++ b/idea/testData/slicer/inflow/lambdaResultWithDirectCall.results.txt @@ -1,5 +1,5 @@ 4 val x = { 1 }() 4 val x = { 1 }() -4 [LAMBDA] val x = { 1 }() +4 [LAMBDA IN] val x = { 1 }() 4 val x = { 1 }() 4 val x = { 1 }() diff --git a/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.leafGroups.txt b/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.leafGroups.txt index de67d8505937e..d423c0c025de5 100644 --- a/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.leafGroups.txt +++ b/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.leafGroups.txt @@ -1,9 +1,9 @@ 4 val f = { 1 } 5 val x = f() 5 val x = f() -5 [LAMBDA] val x = f() -4 [LAMBDA] val f = { 1 } -4 [LAMBDA] val f = { 1 } +5 [LAMBDA IN] val x = f() +4 [LAMBDA IN] val f = { 1 } +4 [LAMBDA IN] val f = { 1 } 4 val f = { 1 } 4 val f = { 1 } diff --git a/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.results.txt b/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.results.txt index 459bfaf147ca2..8faa41aa96eb8 100644 --- a/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.results.txt +++ b/idea/testData/slicer/inflow/lambdaResultWithDirectCallViaAssignment.results.txt @@ -1,7 +1,7 @@ 5 val x = f() 5 val x = f() -5 [LAMBDA] val x = f() -4 [LAMBDA] val f = { 1 } -4 [LAMBDA] val f = { 1 } +5 [LAMBDA IN] val x = f() +4 [LAMBDA IN] val f = { 1 } +4 [LAMBDA IN] val f = { 1 } 4 val f = { 1 } 4 val f = { 1 } diff --git a/idea/testData/slicer/inflow/nonLocalReturn.leafGroups.txt b/idea/testData/slicer/inflow/nonLocalReturn.leafGroups.txt index 43a3afd0b8f0c..603e3acb2ea00 100644 --- a/idea/testData/slicer/inflow/nonLocalReturn.leafGroups.txt +++ b/idea/testData/slicer/inflow/nonLocalReturn.leafGroups.txt @@ -3,14 +3,14 @@ 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) -3 [LAMBDA] inline fun foo(a: Int, f: (Int) -> Int) = f(a) -3 [LAMBDA] inline fun foo(a: Int, f: (Int) -> Int) = f(a) -5 [LAMBDA] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } +3 [LAMBDA IN] inline fun foo(a: Int, f: (Int) -> Int) = f(a) +3 [LAMBDA IN] inline fun foo(a: Int, f: (Int) -> Int) = f(a) +5 [LAMBDA IN] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } -5 [LAMBDA CALLS] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } -3 [LAMBDA CALLS] inline fun foo(a: Int, f: (Int) -> Int) = f(a) +5 [LAMBDA OUT] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } +3 [LAMBDA OUT] inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } diff --git a/idea/testData/slicer/inflow/nonLocalReturn.results.txt b/idea/testData/slicer/inflow/nonLocalReturn.results.txt index d0705bd85d360..5b236f615bdf3 100644 --- a/idea/testData/slicer/inflow/nonLocalReturn.results.txt +++ b/idea/testData/slicer/inflow/nonLocalReturn.results.txt @@ -2,14 +2,14 @@ 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) -3 [LAMBDA] inline fun foo(a: Int, f: (Int) -> Int) = f(a) -3 [LAMBDA] inline fun foo(a: Int, f: (Int) -> Int) = f(a) -5 [LAMBDA] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } +3 [LAMBDA IN] inline fun foo(a: Int, f: (Int) -> Int) = f(a) +3 [LAMBDA IN] inline fun foo(a: Int, f: (Int) -> Int) = f(a) +5 [LAMBDA IN] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } -5 [LAMBDA CALLS] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } -3 [LAMBDA CALLS] inline fun foo(a: Int, f: (Int) -> Int) = f(a) +5 [LAMBDA OUT] fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } +3 [LAMBDA OUT] inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 3 inline fun foo(a: Int, f: (Int) -> Int) = f(a) 5 fun bar(a: Int): Int = foo(a) { if (it > 0) it else return 0 } diff --git a/idea/testData/slicer/outflow/anonymousFunBodyExpression.results.txt b/idea/testData/slicer/outflow/anonymousFunBodyExpression.results.txt index 3b6fe004cf130..a2e798b0e7e9e 100644 --- a/idea/testData/slicer/outflow/anonymousFunBodyExpression.results.txt +++ b/idea/testData/slicer/outflow/anonymousFunBodyExpression.results.txt @@ -1,9 +1,8 @@ 8 val x = foo(fun(n: Int) = n) 8 val x = foo(fun(n: Int) = n) -8 [LAMBDA] val x = foo(fun(n: Int) = n) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] return f(1) -4 return f(1) -3 fun foo(f: (Int) -> Int): Int { -8 val x = foo(fun(n: Int) = n) -8 val x = foo(fun(n: Int) = n) +8 [LAMBDA OUT] val x = foo(fun(n: Int) = n) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 return f(1) +3 fun foo(f: (Int) -> Int): Int { +8 val x = foo(fun(n: Int) = n) +8 val x = foo(fun(n: Int) = n) diff --git a/idea/testData/slicer/outflow/anonymousFunReturnExpression.results.txt b/idea/testData/slicer/outflow/anonymousFunReturnExpression.results.txt index ea3caabdffe54..ad2e54c77d3b0 100644 --- a/idea/testData/slicer/outflow/anonymousFunReturnExpression.results.txt +++ b/idea/testData/slicer/outflow/anonymousFunReturnExpression.results.txt @@ -1,9 +1,8 @@ 8 val x = foo(fun(n: Int): Int { return n }) 8 val x = foo(fun(n: Int): Int { return n }) -8 [LAMBDA] val x = foo(fun(n: Int): Int { return n }) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] return f(1) -4 return f(1) -3 fun foo(f: (Int) -> Int): Int { -8 val x = foo(fun(n: Int): Int { return n }) -8 val x = foo(fun(n: Int): Int { return n }) +8 [LAMBDA OUT] val x = foo(fun(n: Int): Int { return n }) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 return f(1) +3 fun foo(f: (Int) -> Int): Int { +8 val x = foo(fun(n: Int): Int { return n }) +8 val x = foo(fun(n: Int): Int { return n }) diff --git a/idea/testData/slicer/outflow/doubleLambdaResult.results.txt b/idea/testData/slicer/outflow/doubleLambdaResult.results.txt index de34bf5f150ee..f41e955590dcb 100644 --- a/idea/testData/slicer/outflow/doubleLambdaResult.results.txt +++ b/idea/testData/slicer/outflow/doubleLambdaResult.results.txt @@ -1,12 +1,11 @@ 8 val x = foo(1, 2) { { it } } 8 val x = foo(1, 2) { { it } } -8 [LAMBDA] val x = foo(1, 2) { { it } } -8 [LAMBDA] val x = foo(1, 2) { { it } } -8 [LAMBDA] [LAMBDA] val x = foo(1, 2) { { it } } -3 [LAMBDA] [LAMBDA] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -4 [LAMBDA] [LAMBDA] return f(a)(b) -4 [LAMBDA] return f(a)(b) -4 return f(a)(b) -3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { -8 val x = foo(1, 2) { { it } } -8 val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] val x = foo(1, 2) { { it } } +8 [LAMBDA OUT] [LAMBDA OUT] val x = foo(1, 2) { { it } } +3 [LAMBDA OUT] [LAMBDA OUT] fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +4 [LAMBDA OUT] return f(a)(b) +4 return f(a)(b) +3 fun foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int { +8 val x = foo(1, 2) { { it } } +8 val x = foo(1, 2) { { it } } diff --git a/idea/testData/slicer/outflow/explicitLambdaReturnExpression.results.txt b/idea/testData/slicer/outflow/explicitLambdaReturnExpression.results.txt index 512210e71442b..447527aa0603c 100644 --- a/idea/testData/slicer/outflow/explicitLambdaReturnExpression.results.txt +++ b/idea/testData/slicer/outflow/explicitLambdaReturnExpression.results.txt @@ -1,9 +1,8 @@ 9 if (it < 0) return@foo 0 8 val x = foo { -8 [LAMBDA] val x = foo { -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] return f(1) -4 return f(1) -3 fun foo(f: (Int) -> Int): Int { -8 val x = foo { -8 val x = foo { +8 [LAMBDA OUT] val x = foo { +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 return f(1) +3 fun foo(f: (Int) -> Int): Int { +8 val x = foo { +8 val x = foo { diff --git a/idea/testData/slicer/outflow/funResultViaCallableRef.results.txt b/idea/testData/slicer/outflow/funResultViaCallableRef.results.txt index 05ed25f857559..e273977d12c14 100644 --- a/idea/testData/slicer/outflow/funResultViaCallableRef.results.txt +++ b/idea/testData/slicer/outflow/funResultViaCallableRef.results.txt @@ -1,9 +1,8 @@ 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n -9 [LAMBDA] val x = foo(::bar) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] return f(1) -4 return f(1) -3 fun foo(f: (Int) -> Int): Int { -9 val x = foo(::bar) -9 val x = foo(::bar) +9 [LAMBDA OUT] val x = foo(::bar) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 return f(1) +3 fun foo(f: (Int) -> Int): Int { +9 val x = foo(::bar) +9 val x = foo(::bar) diff --git a/idea/testData/slicer/outflow/funResultViaCallableRefWithAssignment.results.txt b/idea/testData/slicer/outflow/funResultViaCallableRefWithAssignment.results.txt index b06a176069dd9..8471a4c9190e3 100644 --- a/idea/testData/slicer/outflow/funResultViaCallableRefWithAssignment.results.txt +++ b/idea/testData/slicer/outflow/funResultViaCallableRefWithAssignment.results.txt @@ -1,11 +1,10 @@ 8 fun bar(n: Int) = n 8 fun bar(n: Int) = n -9 [LAMBDA] val f = ::bar -9 [LAMBDA] val f = ::bar -10 [LAMBDA] val x = foo(f) -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] return f(1) -4 return f(1) -3 fun foo(f: (Int) -> Int): Int { -10 val x = foo(f) -10 val x = foo(f) +9 [LAMBDA OUT] val f = ::bar +9 [LAMBDA OUT] val f = ::bar +10 [LAMBDA OUT] val x = foo(f) +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 return f(1) +3 fun foo(f: (Int) -> Int): Int { +10 val x = foo(f) +10 val x = foo(f) diff --git a/idea/testData/slicer/outflow/funResultViaCallableRefWithDirectCall.results.txt b/idea/testData/slicer/outflow/funResultViaCallableRefWithDirectCall.results.txt index 630a32f7167cc..7436c84abfe5a 100644 --- a/idea/testData/slicer/outflow/funResultViaCallableRefWithDirectCall.results.txt +++ b/idea/testData/slicer/outflow/funResultViaCallableRefWithDirectCall.results.txt @@ -1,5 +1,5 @@ 4 fun bar(n: Int) = n 4 fun bar(n: Int) = n -5 [LAMBDA] val x = (::bar)(1) +5 [LAMBDA OUT] val x = (::bar)(1) 5 val x = (::bar)(1) 5 val x = (::bar)(1) diff --git a/idea/testData/slicer/outflow/lambdaResult.results.txt b/idea/testData/slicer/outflow/lambdaResult.results.txt index 59e86c0e94922..214a4773fdf19 100644 --- a/idea/testData/slicer/outflow/lambdaResult.results.txt +++ b/idea/testData/slicer/outflow/lambdaResult.results.txt @@ -1,9 +1,8 @@ 8 val x = foo { it } 8 val x = foo { it } -8 [LAMBDA] val x = foo { it } -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] return f(1) -4 return f(1) -3 fun foo(f: (Int) -> Int): Int { -8 val x = foo { it } -8 val x = foo { it } +8 [LAMBDA OUT] val x = foo { it } +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 return f(1) +3 fun foo(f: (Int) -> Int): Int { +8 val x = foo { it } +8 val x = foo { it } diff --git a/idea/testData/slicer/outflow/lambdaResultWithAssignments.results.txt b/idea/testData/slicer/outflow/lambdaResultWithAssignments.results.txt index ad2b72a58b7ad..32396c374b21e 100644 --- a/idea/testData/slicer/outflow/lambdaResultWithAssignments.results.txt +++ b/idea/testData/slicer/outflow/lambdaResultWithAssignments.results.txt @@ -1,11 +1,10 @@ 9 val y = foo { it } 9 val y = foo { it } -9 [LAMBDA] val y = foo { it } -3 [LAMBDA] fun foo(f: (Int) -> Int): Int { -4 [LAMBDA] val x = f -4 [LAMBDA] val x = f -5 [LAMBDA] return x(1) -5 return x(1) -3 fun foo(f: (Int) -> Int): Int { -9 val y = foo { it } -9 val y = foo { it } +9 [LAMBDA OUT] val y = foo { it } +3 [LAMBDA OUT] fun foo(f: (Int) -> Int): Int { +4 [LAMBDA OUT] val x = f +4 [LAMBDA OUT] val x = f +5 return x(1) +3 fun foo(f: (Int) -> Int): Int { +9 val y = foo { it } +9 val y = foo { it } diff --git a/idea/testData/slicer/outflow/lambdaResultWithDirectCall.results.txt b/idea/testData/slicer/outflow/lambdaResultWithDirectCall.results.txt index aaef78bb048d9..d01c1b5df7d24 100644 --- a/idea/testData/slicer/outflow/lambdaResultWithDirectCall.results.txt +++ b/idea/testData/slicer/outflow/lambdaResultWithDirectCall.results.txt @@ -1,5 +1,5 @@ 4 val x = { 1 }() 4 val x = { 1 }() -4 [LAMBDA] val x = { 1 }() +4 [LAMBDA OUT] val x = { 1 }() 4 val x = { 1 }() 4 val x = { 1 }() diff --git a/idea/testData/slicer/outflow/lambdaResultWithDirectCallViaAssignment.results.txt b/idea/testData/slicer/outflow/lambdaResultWithDirectCallViaAssignment.results.txt index 9672cf291c19c..7246ec58ee705 100644 --- a/idea/testData/slicer/outflow/lambdaResultWithDirectCallViaAssignment.results.txt +++ b/idea/testData/slicer/outflow/lambdaResultWithDirectCallViaAssignment.results.txt @@ -1,7 +1,6 @@ 4 val f = { 1 } 4 val f = { 1 } -4 [LAMBDA] val f = { 1 } -4 [LAMBDA] val f = { 1 } -5 [LAMBDA] val x = f() -5 val x = f() -5 val x = f() +4 [LAMBDA OUT] val f = { 1 } +4 [LAMBDA OUT] val f = { 1 } +5 val x = f() +5 val x = f()