Merged LambdaResultOutflowBehaviour and LambdaCallsBehaviour into one
This commit is contained in:
@@ -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] "
|
||||
}
|
||||
|
||||
|
||||
@@ -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] "
|
||||
}
|
||||
@@ -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] "
|
||||
}
|
||||
@@ -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) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<SliceUsage>? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun equals(other: Any?) = other === this
|
||||
override fun hashCode() = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun SliceProducer.produceAndProcess(
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
8 val x = <bold>foo(fun(n: Int) = n)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
8 val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
8 val x = foo(fun(n: Int) = <bold>n</bold>)
|
||||
8 val x = foo(fun(<bold>n: Int</bold>) = n)
|
||||
8 [LAMBDA CALLS] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA OUT] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return f(<bold>1</bold>)
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
8 val x = <bold>foo(fun(n: Int) = n)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
8 val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
8 val x = foo(fun(n: Int) = <bold>n</bold>)
|
||||
8 val x = foo(fun(<bold>n: Int</bold>) = n)
|
||||
8 [LAMBDA CALLS] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA OUT] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return f(<bold>1</bold>)
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
8 val x = <bold>foo(fun(n: Int): Int { return n })</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
8 val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
8 val x = foo(fun(n: Int): Int { return <bold>n</bold> })
|
||||
8 val x = foo(fun(<bold>n: Int</bold>): Int { return n })
|
||||
8 [LAMBDA CALLS] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA OUT] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return f(<bold>1</bold>)
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
8 val x = <bold>foo(fun(n: Int): Int { return n })</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
8 val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
8 val x = foo(fun(n: Int): Int { return <bold>n</bold> })
|
||||
8 val x = foo(fun(<bold>n: Int</bold>): Int { return n })
|
||||
8 [LAMBDA CALLS] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA OUT] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return f(<bold>1</bold>)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
9 val <bold>v = value</bold>
|
||||
9 val v = <bold>value</bold>
|
||||
8 foo(fun(<bold>value: Int</bold>) {
|
||||
8 [LAMBDA CALLS] foo(<bold>fun(value: Int) {</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
8 [LAMBDA OUT] foo(<bold>fun(value: Int) {</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
4 f(<bold>1</bold>)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
9 val <bold>v = value</bold>
|
||||
9 val v = <bold>value</bold>
|
||||
8 foo(fun(<bold>value: Int</bold>) {
|
||||
8 [LAMBDA CALLS] foo(<bold>fun(value: Int) {</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
8 [LAMBDA OUT] foo(<bold>fun(value: Int) {</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
4 f(<bold>1</bold>)
|
||||
|
||||
+14
-15
@@ -3,21 +3,20 @@
|
||||
8 val x = <bold>foo(1, 2) { { it } }</bold>
|
||||
3 fun <bold>foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(a)(b)</bold>
|
||||
4 [LAMBDA] return <bold>f(a)</bold>(b)
|
||||
4 [LAMBDA] [LAMBDA] return <bold>f</bold>(a)(b)
|
||||
3 [LAMBDA] [LAMBDA] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] [LAMBDA] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
4 [LAMBDA IN] return <bold>f(a)</bold>(b)
|
||||
4 [LAMBDA IN] [LAMBDA IN] return <bold>f</bold>(a)(b)
|
||||
3 [LAMBDA IN] [LAMBDA IN] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] [LAMBDA IN] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA IN] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA IN] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 val x = foo(1, 2) { { <bold>it</bold> } }
|
||||
8 [LAMBDA CALLS] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA CALLS] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] [LAMBDA CALLS] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
3 [LAMBDA] [LAMBDA CALLS] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] [LAMBDA CALLS] return <bold>f</bold>(a)(b)
|
||||
4 [LAMBDA CALLS] return <bold>f(a)</bold>(b)
|
||||
4 return f(a)(<bold>b</bold>)
|
||||
3 fun foo(a: Int, <bold>b: Int</bold>, f: (Int) -> (Int) -> Int): Int {
|
||||
8 val x = foo(1, <bold>2</bold>) { { it } }
|
||||
8 [LAMBDA OUT] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA OUT] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA OUT] [LAMBDA OUT] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
3 [LAMBDA OUT] [LAMBDA OUT] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA OUT] return <bold>f(a)</bold>(b)
|
||||
4 return f(a)(<bold>b</bold>)
|
||||
3 fun foo(a: Int, <bold>b: Int</bold>, f: (Int) -> (Int) -> Int): Int {
|
||||
8 val x = foo(1, <bold>2</bold>) { { it } }
|
||||
|
||||
|
||||
+14
-15
@@ -2,20 +2,19 @@
|
||||
8 val x = <bold>foo(1, 2) { { it } }</bold>
|
||||
3 fun <bold>foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(a)(b)</bold>
|
||||
4 [LAMBDA] return <bold>f(a)</bold>(b)
|
||||
4 [LAMBDA] [LAMBDA] return <bold>f</bold>(a)(b)
|
||||
3 [LAMBDA] [LAMBDA] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] [LAMBDA] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
4 [LAMBDA IN] return <bold>f(a)</bold>(b)
|
||||
4 [LAMBDA IN] [LAMBDA IN] return <bold>f</bold>(a)(b)
|
||||
3 [LAMBDA IN] [LAMBDA IN] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] [LAMBDA IN] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA IN] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA IN] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 val x = foo(1, 2) { { <bold>it</bold> } }
|
||||
8 [LAMBDA CALLS] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA CALLS] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] [LAMBDA CALLS] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
3 [LAMBDA] [LAMBDA CALLS] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] [LAMBDA CALLS] return <bold>f</bold>(a)(b)
|
||||
4 [LAMBDA CALLS] return <bold>f(a)</bold>(b)
|
||||
4 return f(a)(<bold>b</bold>)
|
||||
3 fun foo(a: Int, <bold>b: Int</bold>, f: (Int) -> (Int) -> Int): Int {
|
||||
8 val x = foo(1, <bold>2</bold>) { { it } }
|
||||
8 [LAMBDA OUT] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA OUT] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA OUT] [LAMBDA OUT] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
3 [LAMBDA OUT] [LAMBDA OUT] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA OUT] return <bold>f(a)</bold>(b)
|
||||
4 return f(a)(<bold>b</bold>)
|
||||
3 fun foo(a: Int, <bold>b: Int</bold>, f: (Int) -> (Int) -> Int): Int {
|
||||
8 val x = foo(1, <bold>2</bold>) { { it } }
|
||||
|
||||
+6
-6
@@ -1,18 +1,18 @@
|
||||
4 f("", <bold>1</bold>)
|
||||
15 val v = <bold>it</bold>
|
||||
14 [LAMBDA CALLS] foo <bold>{</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
4 f("", <bold>1</bold>)
|
||||
|
||||
6 "".f(<bold>2</bold>)
|
||||
15 val v = <bold>it</bold>
|
||||
14 [LAMBDA CALLS] foo <bold>{</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
6 "".f(<bold>2</bold>)
|
||||
|
||||
9 f(<bold>3</bold>)
|
||||
15 val v = <bold>it</bold>
|
||||
14 [LAMBDA CALLS] foo <bold>{</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
9 f(<bold>3</bold>)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
15 val v = <bold>it</bold>
|
||||
14 [LAMBDA CALLS] foo <bold>{</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
4 f("", <bold>1</bold>)
|
||||
6 "".f(<bold>2</bold>)
|
||||
9 f(<bold>3</bold>)
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
4 f("", <bold>1</bold>)
|
||||
15 val v = <bold>i</bold>
|
||||
14 foo { <bold>i</bold> ->
|
||||
14 [LAMBDA CALLS] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
4 f("", <bold>1</bold>)
|
||||
|
||||
6 "".f(<bold>2</bold>)
|
||||
15 val v = <bold>i</bold>
|
||||
14 foo { <bold>i</bold> ->
|
||||
14 [LAMBDA CALLS] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
6 "".f(<bold>2</bold>)
|
||||
|
||||
9 f(<bold>3</bold>)
|
||||
15 val v = <bold>i</bold>
|
||||
14 foo { <bold>i</bold> ->
|
||||
14 [LAMBDA CALLS] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
9 f(<bold>3</bold>)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
15 val v = <bold>i</bold>
|
||||
14 foo { <bold>i</bold> ->
|
||||
14 [LAMBDA CALLS] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
14 [LAMBDA OUT] foo <bold>{ i -></bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: String.(Int) -> Unit</bold>) {
|
||||
4 f("", <bold>1</bold>)
|
||||
6 "".f(<bold>2</bold>)
|
||||
9 f(<bold>3</bold>)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
9 val x = <bold>foo(::bar)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA] val x = foo(<bold>::bar</bold>)
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA IN] val x = foo(<bold>::bar</bold>)
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun bar(<bold>n: Int</bold>) = n
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
9 val x = <bold>foo(::bar)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA] val x = foo(<bold>::bar</bold>)
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA IN] val x = foo(<bold>::bar</bold>)
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun bar(<bold>n: Int</bold>) = n
|
||||
|
||||
+5
-5
@@ -3,11 +3,11 @@
|
||||
10 val x = <bold>foo(f)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
10 [LAMBDA] val x = foo(<bold>f</bold>)
|
||||
9 [LAMBDA] val <bold>f = ::bar</bold>
|
||||
9 [LAMBDA] val f = <bold>::bar</bold>
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
10 [LAMBDA IN] val x = foo(<bold>f</bold>)
|
||||
9 [LAMBDA IN] val <bold>f = ::bar</bold>
|
||||
9 [LAMBDA IN] val f = <bold>::bar</bold>
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun bar(<bold>n: Int</bold>) = n
|
||||
|
||||
+5
-5
@@ -2,11 +2,11 @@
|
||||
10 val x = <bold>foo(f)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
10 [LAMBDA] val x = foo(<bold>f</bold>)
|
||||
9 [LAMBDA] val <bold>f = ::bar</bold>
|
||||
9 [LAMBDA] val f = <bold>::bar</bold>
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
10 [LAMBDA IN] val x = foo(<bold>f</bold>)
|
||||
9 [LAMBDA IN] val <bold>f = ::bar</bold>
|
||||
9 [LAMBDA IN] val f = <bold>::bar</bold>
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun bar(<bold>n: Int</bold>) = n
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
5 val x = (::bar)(<bold>1</bold>)
|
||||
5 val <bold>x = (::bar)(1)</bold>
|
||||
5 val x = <bold>(::bar)(1)</bold>
|
||||
5 [LAMBDA] val x = <bold>(::bar)</bold>(1)
|
||||
5 [LAMBDA IN] val x = <bold>(::bar)</bold>(1)
|
||||
4 fun <bold>bar(n: Int) = n</bold>
|
||||
4 fun bar(n: Int) = <bold>n</bold>
|
||||
4 fun bar(<bold>n: Int</bold>) = n
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
5 val <bold>x = (::bar)(1)</bold>
|
||||
5 val x = <bold>(::bar)(1)</bold>
|
||||
5 [LAMBDA] val x = <bold>(::bar)</bold>(1)
|
||||
5 [LAMBDA IN] val x = <bold>(::bar)</bold>(1)
|
||||
4 fun <bold>bar(n: Int) = n</bold>
|
||||
4 fun bar(n: Int) = <bold>n</bold>
|
||||
4 fun bar(<bold>n: Int</bold>) = n
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
4 f(<bold>1</bold>)
|
||||
9 val v = <bold>it</bold>
|
||||
8 [LAMBDA CALLS] foo <bold>{</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
8 [LAMBDA OUT] foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
4 f(<bold>1</bold>)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
9 val v = <bold>it</bold>
|
||||
8 [LAMBDA CALLS] foo <bold>{</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
8 [LAMBDA OUT] foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
4 f(<bold>1</bold>)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
4 f(<bold>1</bold>)
|
||||
9 val v = <bold>value</bold>
|
||||
8 foo { <bold>value</bold> ->
|
||||
8 [LAMBDA CALLS] foo <bold>{ value -></bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
8 [LAMBDA OUT] foo <bold>{ value -></bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
4 f(<bold>1</bold>)
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
9 val v = <bold>value</bold>
|
||||
8 foo { <bold>value</bold> ->
|
||||
8 [LAMBDA CALLS] foo <bold>{ value -></bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
8 [LAMBDA OUT] foo <bold>{ value -></bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Unit</bold>) {
|
||||
4 f(<bold>1</bold>)
|
||||
|
||||
+5
-5
@@ -3,12 +3,12 @@
|
||||
8 val x = <bold>foo { it }</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] val x = foo <bold>{ it }</bold>
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] val x = foo <bold>{ it }</bold>
|
||||
8 val x = foo <bold>{ it }</bold>
|
||||
8 val x = foo { <bold>it</bold> }
|
||||
8 [LAMBDA CALLS] val x = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA OUT] val x = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return f(<bold>1</bold>)
|
||||
|
||||
|
||||
+5
-5
@@ -2,11 +2,11 @@
|
||||
8 val x = <bold>foo { it }</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA] val x = foo <bold>{ it }</bold>
|
||||
4 [LAMBDA IN] return <bold>f</bold>(1)
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA IN] val x = foo <bold>{ it }</bold>
|
||||
8 val x = foo <bold>{ it }</bold>
|
||||
8 val x = foo { <bold>it</bold> }
|
||||
8 [LAMBDA CALLS] val x = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
8 [LAMBDA OUT] val x = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return f(<bold>1</bold>)
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
9 val y = <bold>foo { it }</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
5 return <bold>x(1)</bold>
|
||||
5 [LAMBDA] return <bold>x</bold>(1)
|
||||
4 [LAMBDA] val <bold>x = f</bold>
|
||||
4 [LAMBDA] val x = <bold>f</bold>
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA] val y = foo <bold>{ it }</bold>
|
||||
5 [LAMBDA IN] return <bold>x</bold>(1)
|
||||
4 [LAMBDA IN] val <bold>x = f</bold>
|
||||
4 [LAMBDA IN] val x = <bold>f</bold>
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA IN] val y = foo <bold>{ it }</bold>
|
||||
9 val y = foo <bold>{ it }</bold>
|
||||
9 val y = foo { <bold>it</bold> }
|
||||
9 [LAMBDA CALLS] val y = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA CALLS] val x = <bold>f</bold>
|
||||
4 [LAMBDA CALLS] val <bold>x = f</bold>
|
||||
9 [LAMBDA OUT] val y = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA OUT] val x = <bold>f</bold>
|
||||
4 [LAMBDA OUT] val <bold>x = f</bold>
|
||||
5 return x(<bold>1</bold>)
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
9 val y = <bold>foo { it }</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
5 return <bold>x(1)</bold>
|
||||
5 [LAMBDA] return <bold>x</bold>(1)
|
||||
4 [LAMBDA] val <bold>x = f</bold>
|
||||
4 [LAMBDA] val x = <bold>f</bold>
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA] val y = foo <bold>{ it }</bold>
|
||||
5 [LAMBDA IN] return <bold>x</bold>(1)
|
||||
4 [LAMBDA IN] val <bold>x = f</bold>
|
||||
4 [LAMBDA IN] val x = <bold>f</bold>
|
||||
3 [LAMBDA IN] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA IN] val y = foo <bold>{ it }</bold>
|
||||
9 val y = foo <bold>{ it }</bold>
|
||||
9 val y = foo { <bold>it</bold> }
|
||||
9 [LAMBDA CALLS] val y = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA CALLS] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA CALLS] val x = <bold>f</bold>
|
||||
4 [LAMBDA CALLS] val <bold>x = f</bold>
|
||||
9 [LAMBDA OUT] val y = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA OUT] val x = <bold>f</bold>
|
||||
4 [LAMBDA OUT] val <bold>x = f</bold>
|
||||
5 return x(<bold>1</bold>)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
4 val x = { <bold>1</bold> }()
|
||||
4 val <bold>x = { 1 }()</bold>
|
||||
4 val x = <bold>{ 1 }()</bold>
|
||||
4 [LAMBDA] val x = <bold>{ 1 }</bold>()
|
||||
4 [LAMBDA IN] val x = <bold>{ 1 }</bold>()
|
||||
4 val x = <bold>{ 1 }</bold>()
|
||||
4 val x = { <bold>1</bold> }()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
4 val <bold>x = { 1 }()</bold>
|
||||
4 val x = <bold>{ 1 }()</bold>
|
||||
4 [LAMBDA] val x = <bold>{ 1 }</bold>()
|
||||
4 [LAMBDA IN] val x = <bold>{ 1 }</bold>()
|
||||
4 val x = <bold>{ 1 }</bold>()
|
||||
4 val x = { <bold>1</bold> }()
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
4 val f = { <bold>1</bold> }
|
||||
5 val <bold>x = f()</bold>
|
||||
5 val x = <bold>f()</bold>
|
||||
5 [LAMBDA] val x = <bold>f</bold>()
|
||||
4 [LAMBDA] val <bold>f = { 1 }</bold>
|
||||
4 [LAMBDA] val f = <bold>{ 1 }</bold>
|
||||
5 [LAMBDA IN] val x = <bold>f</bold>()
|
||||
4 [LAMBDA IN] val <bold>f = { 1 }</bold>
|
||||
4 [LAMBDA IN] val f = <bold>{ 1 }</bold>
|
||||
4 val f = <bold>{ 1 }</bold>
|
||||
4 val f = { <bold>1</bold> }
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
5 val <bold>x = f()</bold>
|
||||
5 val x = <bold>f()</bold>
|
||||
5 [LAMBDA] val x = <bold>f</bold>()
|
||||
4 [LAMBDA] val <bold>f = { 1 }</bold>
|
||||
4 [LAMBDA] val f = <bold>{ 1 }</bold>
|
||||
5 [LAMBDA IN] val x = <bold>f</bold>()
|
||||
4 [LAMBDA IN] val <bold>f = { 1 }</bold>
|
||||
4 [LAMBDA IN] val f = <bold>{ 1 }</bold>
|
||||
4 val f = <bold>{ 1 }</bold>
|
||||
4 val f = { <bold>1</bold> }
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
5 fun bar(a: Int): Int = <bold>foo(a) { if (it > 0) it else return 0 }</bold>
|
||||
3 inline fun <bold>foo(a: Int, f: (Int) -> Int) = f(a)</bold>
|
||||
3 inline fun foo(a: Int, f: (Int) -> Int) = <bold>f(a)</bold>
|
||||
3 [LAMBDA] inline fun foo(a: Int, f: (Int) -> Int) = <bold>f</bold>(a)
|
||||
3 [LAMBDA] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
5 [LAMBDA] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
3 [LAMBDA IN] inline fun foo(a: Int, f: (Int) -> Int) = <bold>f</bold>(a)
|
||||
3 [LAMBDA IN] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
5 [LAMBDA IN] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
5 fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
5 fun bar(a: Int): Int = foo(a) { <bold>if (it > 0) it else return 0</bold> }
|
||||
5 fun bar(a: Int): Int = foo(a) { if (it > 0) <bold>it</bold> else return 0 }
|
||||
5 [LAMBDA CALLS] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
3 [LAMBDA CALLS] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
5 [LAMBDA OUT] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
3 [LAMBDA OUT] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
3 inline fun foo(a: Int, f: (Int) -> Int) = f(<bold>a</bold>)
|
||||
3 inline fun foo(<bold>a: Int</bold>, f: (Int) -> Int) = f(a)
|
||||
5 fun bar(a: Int): Int = foo(<bold>a</bold>) { if (it > 0) it else return 0 }
|
||||
|
||||
+5
-5
@@ -2,14 +2,14 @@
|
||||
5 fun bar(a: Int): Int = <bold>foo(a) { if (it > 0) it else return 0 }</bold>
|
||||
3 inline fun <bold>foo(a: Int, f: (Int) -> Int) = f(a)</bold>
|
||||
3 inline fun foo(a: Int, f: (Int) -> Int) = <bold>f(a)</bold>
|
||||
3 [LAMBDA] inline fun foo(a: Int, f: (Int) -> Int) = <bold>f</bold>(a)
|
||||
3 [LAMBDA] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
5 [LAMBDA] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
3 [LAMBDA IN] inline fun foo(a: Int, f: (Int) -> Int) = <bold>f</bold>(a)
|
||||
3 [LAMBDA IN] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
5 [LAMBDA IN] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
5 fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
5 fun bar(a: Int): Int = foo(a) { <bold>if (it > 0) it else return 0</bold> }
|
||||
5 fun bar(a: Int): Int = foo(a) { if (it > 0) <bold>it</bold> else return 0 }
|
||||
5 [LAMBDA CALLS] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
3 [LAMBDA CALLS] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
5 [LAMBDA OUT] fun bar(a: Int): Int = foo(a) <bold>{ if (it > 0) it else return 0 }</bold>
|
||||
3 [LAMBDA OUT] inline fun foo(a: Int, <bold>f: (Int) -> Int</bold>) = f(a)
|
||||
3 inline fun foo(a: Int, f: (Int) -> Int) = f(<bold>a</bold>)
|
||||
3 inline fun foo(<bold>a: Int</bold>, f: (Int) -> Int) = f(a)
|
||||
5 fun bar(a: Int): Int = foo(<bold>a</bold>) { if (it > 0) it else return 0 }
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
8 val x = foo(fun(n: Int) = <bold>n</bold>)
|
||||
8 val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
8 [LAMBDA] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo(fun(n: Int) = n)</bold>
|
||||
8 val <bold>x = foo(fun(n: Int) = n)</bold>
|
||||
8 [LAMBDA OUT] val x = foo(<bold>fun(n: Int) = n</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo(fun(n: Int) = n)</bold>
|
||||
8 val <bold>x = foo(fun(n: Int) = n)</bold>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
8 val x = foo(fun(n: Int): Int { return <bold>n</bold> })
|
||||
8 val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
8 [LAMBDA] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo(fun(n: Int): Int { return n })</bold>
|
||||
8 val <bold>x = foo(fun(n: Int): Int { return n })</bold>
|
||||
8 [LAMBDA OUT] val x = foo(<bold>fun(n: Int): Int { return n }</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo(fun(n: Int): Int { return n })</bold>
|
||||
8 val <bold>x = foo(fun(n: Int): Int { return n })</bold>
|
||||
|
||||
+9
-10
@@ -1,12 +1,11 @@
|
||||
8 val x = foo(1, 2) { { <bold>it</bold> } }
|
||||
8 val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA] [LAMBDA] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
3 [LAMBDA] [LAMBDA] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] [LAMBDA] return <bold>f</bold>(a)(b)
|
||||
4 [LAMBDA] return <bold>f(a)</bold>(b)
|
||||
4 return <bold>f(a)(b)</bold>
|
||||
3 fun <bold>foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo(1, 2) { { it } }</bold>
|
||||
8 val <bold>x = foo(1, 2) { { it } }</bold>
|
||||
8 [LAMBDA OUT] val x = foo(1, 2) { <bold>{ it }</bold> }
|
||||
8 [LAMBDA OUT] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
8 [LAMBDA OUT] [LAMBDA OUT] val x = foo(1, 2) <bold>{ { it } }</bold>
|
||||
3 [LAMBDA OUT] [LAMBDA OUT] fun foo(a: Int, b: Int, <bold>f: (Int) -> (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA OUT] return <bold>f(a)</bold>(b)
|
||||
4 return <bold>f(a)(b)</bold>
|
||||
3 fun <bold>foo(a: Int, b: Int, f: (Int) -> (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo(1, 2) { { it } }</bold>
|
||||
8 val <bold>x = foo(1, 2) { { it } }</bold>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
9 if (it < 0) return@foo <bold>0</bold>
|
||||
8 val x = foo <bold>{</bold>
|
||||
8 [LAMBDA] val x = foo <bold>{</bold>
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo {</bold>
|
||||
8 val <bold>x = foo {</bold>
|
||||
8 [LAMBDA OUT] val x = foo <bold>{</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo {</bold>
|
||||
8 val <bold>x = foo {</bold>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
9 [LAMBDA] val x = foo(<bold>::bar</bold>)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
9 val x = <bold>foo(::bar)</bold>
|
||||
9 val <bold>x = foo(::bar)</bold>
|
||||
9 [LAMBDA OUT] val x = foo(<bold>::bar</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
9 val x = <bold>foo(::bar)</bold>
|
||||
9 val <bold>x = foo(::bar)</bold>
|
||||
|
||||
+8
-9
@@ -1,11 +1,10 @@
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
9 [LAMBDA] val f = <bold>::bar</bold>
|
||||
9 [LAMBDA] val <bold>f = ::bar</bold>
|
||||
10 [LAMBDA] val x = foo(<bold>f</bold>)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
10 val x = <bold>foo(f)</bold>
|
||||
10 val <bold>x = foo(f)</bold>
|
||||
9 [LAMBDA OUT] val f = <bold>::bar</bold>
|
||||
9 [LAMBDA OUT] val <bold>f = ::bar</bold>
|
||||
10 [LAMBDA OUT] val x = foo(<bold>f</bold>)
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
10 val x = <bold>foo(f)</bold>
|
||||
10 val <bold>x = foo(f)</bold>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
4 fun bar(n: Int) = <bold>n</bold>
|
||||
4 fun <bold>bar(n: Int) = n</bold>
|
||||
5 [LAMBDA] val x = (<bold>::bar</bold>)(1)
|
||||
5 [LAMBDA OUT] val x = (<bold>::bar</bold>)(1)
|
||||
5 val x = <bold>(::bar)(1)</bold>
|
||||
5 val <bold>x = (::bar)(1)</bold>
|
||||
|
||||
+6
-7
@@ -1,9 +1,8 @@
|
||||
8 val x = foo { <bold>it</bold> }
|
||||
8 val x = foo <bold>{ it }</bold>
|
||||
8 [LAMBDA] val x = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo { it }</bold>
|
||||
8 val <bold>x = foo { it }</bold>
|
||||
8 [LAMBDA OUT] val x = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 return <bold>f(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
8 val x = <bold>foo { it }</bold>
|
||||
8 val <bold>x = foo { it }</bold>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
9 val y = foo { <bold>it</bold> }
|
||||
9 val y = foo <bold>{ it }</bold>
|
||||
9 [LAMBDA] val y = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA] val x = <bold>f</bold>
|
||||
4 [LAMBDA] val <bold>x = f</bold>
|
||||
5 [LAMBDA] return <bold>x</bold>(1)
|
||||
5 return <bold>x(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
9 val y = <bold>foo { it }</bold>
|
||||
9 val <bold>y = foo { it }</bold>
|
||||
9 [LAMBDA OUT] val y = foo <bold>{ it }</bold>
|
||||
3 [LAMBDA OUT] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
4 [LAMBDA OUT] val x = <bold>f</bold>
|
||||
4 [LAMBDA OUT] val <bold>x = f</bold>
|
||||
5 return <bold>x(1)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
9 val y = <bold>foo { it }</bold>
|
||||
9 val <bold>y = foo { it }</bold>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
4 val x = { <bold>1</bold> }()
|
||||
4 val x = <bold>{ 1 }</bold>()
|
||||
4 [LAMBDA] val x = <bold>{ 1 }</bold>()
|
||||
4 [LAMBDA OUT] val x = <bold>{ 1 }</bold>()
|
||||
4 val x = <bold>{ 1 }()</bold>
|
||||
4 val <bold>x = { 1 }()</bold>
|
||||
|
||||
+4
-5
@@ -1,7 +1,6 @@
|
||||
4 val f = { <bold>1</bold> }
|
||||
4 val f = <bold>{ 1 }</bold>
|
||||
4 [LAMBDA] val f = <bold>{ 1 }</bold>
|
||||
4 [LAMBDA] val <bold>f = { 1 }</bold>
|
||||
5 [LAMBDA] val x = <bold>f</bold>()
|
||||
5 val x = <bold>f()</bold>
|
||||
5 val <bold>x = f()</bold>
|
||||
4 [LAMBDA OUT] val f = <bold>{ 1 }</bold>
|
||||
4 [LAMBDA OUT] val <bold>f = { 1 }</bold>
|
||||
5 val x = <bold>f()</bold>
|
||||
5 val <bold>x = f()</bold>
|
||||
|
||||
Reference in New Issue
Block a user