From 3de0dff575e866151c45cc6dbf4cae24f327ff77 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Fri, 3 Apr 2015 13:40:07 +0300 Subject: [PATCH] Migrate testdata to new lambda syntax --- .../varAsFunInsideLocalFun.kt | 2 +- .../box/closures/closureWithParameter.kt | 2 +- .../closures/closureWithParameterAndBoxing.kt | 2 +- .../codegen/box/closures/enclosingThis.kt | 2 +- .../codegen/box/closures/extensionClosure.kt | 2 +- .../codegen/box/closures/localReturn.kt | 4 +-- .../box/closures/localReturnWithAutolabel.kt | 4 +-- .../codegen/box/controlStructures/kt237.kt | 6 ++-- .../codegen/box/extensionFunctions/kt1061.kt | 2 +- .../codegen/box/extensionFunctions/kt1290.kt | 2 +- .../codegen/box/extensionFunctions/nested2.kt | 2 +- .../functions/functionLiteralExpression.kt | 10 +++---- .../box/functions/functionNtoString.kt | 28 +++++++++---------- .../functions/invoke/extensionInvokeOnExpr.kt | 4 +-- .../invoke/invokeOnExprByConvention.kt | 4 +-- .../testData/codegen/box/functions/kt395.kt | 2 +- .../testData/codegen/box/functions/kt785.kt | 2 +- .../box/functions/localFunctions/kt2895.kt | 2 +- .../propertyAccessorInnerExtensionFun.kt | 4 +-- .../functionLiteralGenericSignature.kt | 12 ++++---- .../codegen/box/regressions/kt3173.kt | 2 +- .../codegen/box/regressions/kt3999.kt | 2 +- .../sam/adapters/nonLiteralComparator.kt | 2 +- .../capture/simpleCapturingInClass.1.kt | 8 +++--- .../capture/simpleCapturingInPackage.1.kt | 24 ++++++++-------- .../boxInline/complex/closureChain.1.kt | 2 +- .../defaultValues/defaultInExtension.1.kt | 8 +++--- .../defaultValues/defaultMethodInClass.1.kt | 4 +-- .../codegen/boxInline/noInline/noInline.1.kt | 2 +- .../boxInline/noInline/withoutInline.1.kt | 2 +- .../deparenthesize/bracket.1.kt | 1 - .../deparenthesize/labeled.1.kt | 1 - .../nonLocalReturns/explicitLocalReturn.1.kt | 1 - .../nonLocalReturns/nestedNonLocals.1.kt | 2 -- .../nonLocalReturns/noInlineLocalReturn.1.kt | 1 - .../tryFinally/callSite/callSite.1.kt | 2 -- .../tryFinally/declSite/complex.1.kt | 2 -- .../tryFinally/declSite/returnInTry.1.kt | 1 - .../declSite/returnInTryAndFinally.1.kt | 5 +--- .../codegen/boxInline/simple/extension.1.kt | 6 ++-- .../codegen/boxInline/simple/extension.2.kt | 4 +-- .../codegen/boxInline/simple/params.1.kt | 8 +++--- .../boxInline/simple/severalClosures.1.kt | 6 ++-- .../boxInline/simple/simpleDouble.1.kt | 14 +++++----- .../codegen/boxInline/simple/simpleInt.1.kt | 14 +++++----- .../boxInline/simple/simpleObject.1.kt | 14 +++++----- .../codegen/boxInline/simple/vararg.2.kt | 2 +- .../boxInline/special/inlineChain.1.kt | 4 +-- .../boxInline/tryCatchFinally/tryCatch2.1.kt | 6 ++-- .../tryCatchFinally/tryCatchFinally.1.kt | 2 +- .../codegen/boxWithStdlib/arrays/kt4118.kt | 6 ++-- .../boxWithStdlib/regressions/generic.kt | 2 +- .../directInvoke/inplaceClosure.kt | 2 +- .../FunctionTypes/FunctionTypes.kt | 4 +-- .../lambdaParameter.kt | 2 +- ...allWithMultipleArgumentsAndSingleLambda.kt | 2 +- ...hMultipleArgumentsAndSingleLambda.kt.after | 2 +- .../functionCallWithSingleLambda.kt | 2 +- .../functionCallWithSingleLambda.kt.after | 2 +- ...icableFunctionCallWithCallableReference.kt | 2 +- .../removeExplicitTypeArguments/lambdaType.kt | 2 +- .../lambdaType.kt.after | 2 +- ...tApplicable_notFunctionLiteralParameter.kt | 2 +- .../notApplicable_parameterHasExplicitType.kt | 2 +- .../intentions/specifyType/functionType.kt | 2 +- .../specifyType/functionType.kt.after | 2 +- .../afterSAMConstructorFromLambda.kt | 2 +- .../beforeSAMConstructorFromLambda.kt | 2 +- .../callExpression/afterCallWithLambdaArg.kt | 2 +- .../afterCallWithLambdaArgOnly.kt | 2 +- .../callExpression/beforeCallWithLambdaArg.kt | 2 +- .../beforeCallWithLambdaArgOnly.kt | 2 +- .../call/afterCallWithLambdaArg.kt | 2 +- .../call/afterCallWithLambdaArgOnly.kt | 2 +- .../call/beforeCallWithLambdaArg.kt | 2 +- .../call/beforeCallWithLambdaArgOnly.kt | 2 +- .../localVariable/afterInLambdaWithParams.kt | 2 +- .../afterInMultiLineLambdaWithParams.kt | 2 +- .../localVariable/beforeInLambdaWithParams.kt | 2 +- .../beforeInMultiLineLambdaWithParams.kt | 2 +- .../parameter/afterInLambdaWithParams.kt | 2 +- .../parameter/afterInLambdaWithTypedParams.kt | 2 +- .../parameter/beforeInLambdaWithParams.kt | 2 +- .../beforeInLambdaWithTypedParams.kt | 2 +- .../afterChangeFunctionParameterType1.kt | 2 +- ...afterChangeParameterTypeLongNameRuntime.kt | 2 +- .../beforeChangeFunctionParameterType1.kt | 2 +- ...eforeChangeParameterTypeLongNameRuntime.kt | 2 +- .../constructor/SAMConstructorFromLambda.kt | 2 +- .../SAMConstructorFromLambda.kt.after | 2 +- .../lambdas/multipleParamsRuntime.kt | 8 +++--- .../lambdas/multipleParamsRuntime.kt.match | 6 ++-- .../localCallables/lambdas/singleParam.kt | 4 +-- .../lambdas/singleParam.kt.match | 4 +-- .../unifier/equivalence/types/function2.kt | 12 ++++---- .../testData/dataClass/cases/hashcode.kt | 2 +- .../compareTo/cases/customCompareToMethod.kt | 2 +- .../expression/function/cases/adderClosure.kt | 2 +- .../function/cases/closureWithParameter.kt | 2 +- .../cases/closureWithParameterAndBoxing.kt | 2 +- .../function/cases/enclosingThis.kt | 2 +- .../function/cases/expressionAsFunction.kt | 6 ++-- .../function/cases/functionExpression.kt | 4 +-- .../function/cases/functionLiteral.kt | 2 +- .../cases/functionLiteralAsLastParameter.kt | 2 +- .../cases/functionLiteralAsParameter.kt | 2 +- .../expression/function/cases/loopClosure.kt | 2 +- .../function/cases/manglingStability.kt | 8 +++--- .../invoke/cases/explicitInvokeLambda.kt | 2 +- .../invoke/cases/invokeInFunctionLiteral.kt | 4 +-- .../invoke/cases/invokeOnExprByConvention.kt | 4 +-- .../extensionFunction/cases/generic.kt | 2 +- .../testData/inline/cases/extension.kt | 8 +++--- .../cases/extensionWithManyArguments.kt | 2 +- .../inline/cases/inlineFunctionInLambda.kt | 2 +- .../inline/cases/inlineLambdaNoCapture.kt | 2 +- .../inline/cases/inlineLambdaWithCapture.kt | 2 +- .../inline/cases/lambdaReassignment.kt | 6 ++-- .../cases/lambdaReassignmentWithCapture.kt | 6 ++-- .../testData/inline/cases/params.kt | 8 +++--- .../testData/inline/cases/severalClosures.kt | 6 ++-- .../testData/inline/cases/simpleDouble.kt | 14 +++++----- .../testData/inline/cases/simpleInt.kt | 14 +++++----- .../testData/inline/cases/simpleObject.kt | 14 +++++----- .../cases/closureChain/closureChain.1.kt | 2 +- .../simpleCapturingInClass.1.kt | 8 +++--- .../simpleCapturingInPackage.1.kt | 8 +++--- .../cases/tryCatch2/tryCatch2.1.kt | 6 ++-- .../tryCatchFinally/tryCatchFinally.1.kt | 2 +- .../cases/closureInObjectLiteral.kt | 2 +- .../testData/jsCode/cases/function.kt | 2 +- .../testData/jsCode/cases/invocation.kt | 2 +- .../cases/arrayFunctionConstructor.kt | 2 +- .../standardClasses/cases/arraysIterator.kt | 2 +- 134 files changed, 263 insertions(+), 277 deletions(-) diff --git a/compiler/testData/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt b/compiler/testData/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt index e0fb5427100..ec2ea57118e 100644 --- a/compiler/testData/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt +++ b/compiler/testData/codegen/box/closures/closureInsideClosure/varAsFunInsideLocalFun.kt @@ -2,7 +2,7 @@ fun box(): String { fun rec(n : Int) { - val x = { (m : Int) -> + val x = { m : Int -> if (n > 0) rec(n - 1) } diff --git a/compiler/testData/codegen/box/closures/closureWithParameter.kt b/compiler/testData/codegen/box/closures/closureWithParameter.kt index e0b5d616951..6e5d15af401 100644 --- a/compiler/testData/codegen/box/closures/closureWithParameter.kt +++ b/compiler/testData/codegen/box/closures/closureWithParameter.kt @@ -1,5 +1,5 @@ fun box() : String { - return apply( "OK", {(arg: String) -> arg } ) + return apply( "OK", {arg: String -> arg } ) } fun apply(arg : String, f : (p:String) -> String) : String { diff --git a/compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt b/compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt index 2b64a547d29..a1a13fb62a6 100644 --- a/compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt +++ b/compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt @@ -1,5 +1,5 @@ fun box() : String { - return if (apply( 5, {(arg: Int) -> arg + 13 } ) == 18) "OK" else "fail" + return if (apply( 5, {arg: Int -> arg + 13 } ) == 18) "OK" else "fail" } fun apply(arg : Int, f : (p:Int) -> Int) : Int { diff --git a/compiler/testData/codegen/box/closures/enclosingThis.kt b/compiler/testData/codegen/box/closures/enclosingThis.kt index d227b3a2cc9..c04dd822152 100644 --- a/compiler/testData/codegen/box/closures/enclosingThis.kt +++ b/compiler/testData/codegen/box/closures/enclosingThis.kt @@ -1,6 +1,6 @@ class Point(val x:Int, val y:Int) { fun mul() : (scalar:Int)->Point { - return { (scalar:Int):Point -> Point(x * scalar, y * scalar) } + return { scalar:Int -> Point(x * scalar, y * scalar) } } } diff --git a/compiler/testData/codegen/box/closures/extensionClosure.kt b/compiler/testData/codegen/box/closures/extensionClosure.kt index 21307ea42ab..d4c73c7bcfe 100644 --- a/compiler/testData/codegen/box/closures/extensionClosure.kt +++ b/compiler/testData/codegen/box/closures/extensionClosure.kt @@ -1,7 +1,7 @@ class Point(val x : Int, val y : Int) fun box() : String { - val answer = apply(Point(3, 5), { Point.(scalar : Int) : Point -> + val answer = apply(Point(3, 5), { scalar : Int -> Point(x * scalar, y * scalar) }) diff --git a/compiler/testData/codegen/box/closures/localReturn.kt b/compiler/testData/codegen/box/closures/localReturn.kt index 2cdd072774f..d7dfe040b2e 100644 --- a/compiler/testData/codegen/box/closures/localReturn.kt +++ b/compiler/testData/codegen/box/closures/localReturn.kt @@ -1,13 +1,13 @@ fun box(): String { val a = 1 - val explicitlyReturned = run1 @f{(): String -> + val explicitlyReturned = run1 @f{ if (a > 0) return@f "OK" else "Fail 1" } if (explicitlyReturned != "OK") return explicitlyReturned - val implicitlyReturned = run1 @f{(): String -> + val implicitlyReturned = run1 @f{ if (a < 0) return@f "Fail 2" else "OK" diff --git a/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt b/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt index ac4b10aabf4..0b5bbf9a48c 100644 --- a/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt +++ b/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt @@ -1,13 +1,13 @@ fun box(): String { val a = 1 - val explicitlyReturned = run1 {(): String -> + val explicitlyReturned = run1 { if (a > 0) return@run1 "OK" else "Fail 1" } if (explicitlyReturned != "OK") return explicitlyReturned - val implicitlyReturned = run1 {(): String -> + val implicitlyReturned = run1 { if (a < 0) return@run1 "Fail 2" else "OK" diff --git a/compiler/testData/codegen/box/controlStructures/kt237.kt b/compiler/testData/codegen/box/controlStructures/kt237.kt index fad5157e9eb..0bb5065eefe 100644 --- a/compiler/testData/codegen/box/controlStructures/kt237.kt +++ b/compiler/testData/codegen/box/controlStructures/kt237.kt @@ -5,7 +5,7 @@ fun main(args: Array?) { //do not compile System.out?.println(fff(Unit)) //do not compile System.out?.println(id(y)) //do not compile - System.out?.println(fff(id(y)) == id(foreach(arrayOfNulls(0) as Array,{(e : Int) : Unit -> }))) //do not compile + System.out?.println(fff(id(y)) == id(foreach(arrayOfNulls(0) as Array,{ e : Int -> }))) //do not compile } class A() @@ -34,8 +34,8 @@ fun box() : String { a[0] = 0 a[1] = 1 a[2] = 2 - foreach(a, { (el : Int) : Unit -> System.out?.println(el) }) - almostFilter(a, { (el : Int) : Int -> el }) + foreach(a, { el : Int -> System.out?.println(el) }) + almostFilter(a, { el : Int -> el }) main(null) return "OK" } diff --git a/compiler/testData/codegen/box/extensionFunctions/kt1061.kt b/compiler/testData/codegen/box/extensionFunctions/kt1061.kt index af7d1d7b6d2..051768c9c74 100644 --- a/compiler/testData/codegen/box/extensionFunctions/kt1061.kt +++ b/compiler/testData/codegen/box/extensionFunctions/kt1061.kt @@ -1,7 +1,7 @@ //KT-1061 Can't call function defined as a val object X { - val doit = { (i: Int) -> i } + val doit = { i: Int -> i } } fun box() : String = if (X.doit(3) == 3) "OK" else "fail" diff --git a/compiler/testData/codegen/box/extensionFunctions/kt1290.kt b/compiler/testData/codegen/box/extensionFunctions/kt1290.kt index da8de1b208f..19f03dc8883 100644 --- a/compiler/testData/codegen/box/extensionFunctions/kt1290.kt +++ b/compiler/testData/codegen/box/extensionFunctions/kt1290.kt @@ -6,7 +6,7 @@ class Foo(val filter: (T) -> Boolean) { } } -fun foo() = Foo({ (i: Int) -> i < 5 }).bar(2) +fun foo() = Foo({ i: Int -> i < 5 }).bar(2) fun box() : String { if (!foo()) return "fail" diff --git a/compiler/testData/codegen/box/extensionFunctions/nested2.kt b/compiler/testData/codegen/box/extensionFunctions/nested2.kt index b6638b37ee9..9c0aecd0ffb 100644 --- a/compiler/testData/codegen/box/extensionFunctions/nested2.kt +++ b/compiler/testData/codegen/box/extensionFunctions/nested2.kt @@ -1,6 +1,6 @@ fun box() : String { val y = 12 - val op = { (x:Int) -> (x + y).toString() } + val op = { x:Int -> (x + y).toString() } val op2 : Int.(Int) -> String = { op(this + it) } diff --git a/compiler/testData/codegen/box/functions/functionLiteralExpression.kt b/compiler/testData/codegen/box/functions/functionLiteralExpression.kt index aaeadaf0c56..81f4695ff78 100644 --- a/compiler/testData/codegen/box/functions/functionLiteralExpression.kt +++ b/compiler/testData/codegen/box/functions/functionLiteralExpression.kt @@ -8,17 +8,17 @@ fun Int.foo2() : (i : Int) -> Int { fun fooT1(t : T) = { t.toString() } -fun fooT2(t: T) = { (x:T) -> t.toString() + x.toString() } +fun fooT2(t: T) = { x:T -> t.toString() + x.toString() } fun box() : String { if( (10.foo1())() != "23910") return "foo1 fail" if( (10.foo2())(1) != 11 ) return "foo2 fail" - if(1.{Int.() -> this + 1}() != 2) return "test 3 failed"; + if(1.(fun Int.() = this + 1)() != 2) return "test 3 failed"; if( {1}() != 1) return "test 4 failed"; - if( {(x : Int) -> x}(1) != 1) return "test 5 failed"; - if( 1.{Int.(x : Int) -> x + this}(1) != 2) return "test 6 failed"; - if( 1.({Int.() -> this})() != 1) return "test 7 failed"; + if( {x : Int -> x}(1) != 1) return "test 5 failed"; + if( 1.(fun Int.(x: Int) = x + this)(1) != 2) return "test 6 failed"; + if( 1.(fun Int.() = this)() != 1) return "test 7 failed"; if( (fooT1("mama"))() != "mama") return "test 8 failed"; if( (fooT2("mama"))("papa") != "mamapapa") return "test 9 failed"; return "OK" diff --git a/compiler/testData/codegen/box/functions/functionNtoString.kt b/compiler/testData/codegen/box/functions/functionNtoString.kt index d2dc8e2f89c..1add172e443 100644 --- a/compiler/testData/codegen/box/functions/functionNtoString.kt +++ b/compiler/testData/codegen/box/functions/functionNtoString.kt @@ -7,22 +7,22 @@ fun check(expected: String, obj: Any?) { fun box(): String { check("kotlin.Function0") - { () : Unit -> } + { -> } check("kotlin.Function0") - { () : Int -> 42 } - check("kotlin.Function1") - { (s: String) : Long -> 42.toLong() } + { -> 42 } + check("kotlin.Function1", + fun (s: String) = 42.toLong()) check("kotlin.Function2") - { (x: Int, y: Int) : Unit -> } + { x: Int, y: Int -> } - check("kotlin.ExtensionFunction0") - { Int.() : Unit -> } - check("kotlin.ExtensionFunction0") - { Unit.() : Int -> 42 } - check("kotlin.ExtensionFunction1") - { String.(s: String) : Long -> 42.toLong() } - check("kotlin.ExtensionFunction2") - { Int.(x: Int, y: Int) : Unit -> } + check("kotlin.ExtensionFunction0", + fun Int.() {}) + check("kotlin.ExtensionFunction0", + fun Unit.(): Int = 42) + check("kotlin.ExtensionFunction1", + fun String.(s: String): Long = 42.toLong()) + check("kotlin.ExtensionFunction2", + fun Int.(x: Int, y: Int) {}) return "OK" -} +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/functions/invoke/extensionInvokeOnExpr.kt b/compiler/testData/codegen/box/functions/invoke/extensionInvokeOnExpr.kt index 31473f1bff6..d1d98a6826b 100644 --- a/compiler/testData/codegen/box/functions/invoke/extensionInvokeOnExpr.kt +++ b/compiler/testData/codegen/box/functions/invoke/extensionInvokeOnExpr.kt @@ -13,8 +13,8 @@ fun B.test(): String { if (foo()() != "##") return "fail3" if (foo()(42) != "#42") return "fail4" if ((foo())(42) != "#42") return "fail5" - if ({() -> A()}()() != "##") return "fail6" - if ({() -> A()}()(37) != "#37") return "fail7" + if ({ -> A()}()() != "##") return "fail6" + if ({ -> A()}()(37) != "#37") return "fail7" return "OK" } diff --git a/compiler/testData/codegen/box/functions/invoke/invokeOnExprByConvention.kt b/compiler/testData/codegen/box/functions/invoke/invokeOnExprByConvention.kt index e98bc418624..19ebda7ef19 100644 --- a/compiler/testData/codegen/box/functions/invoke/invokeOnExprByConvention.kt +++ b/compiler/testData/codegen/box/functions/invoke/invokeOnExprByConvention.kt @@ -14,7 +14,7 @@ fun box(): String { if (foo()() != "##") return "fail3" if (foo()(42) != "#42") return "fail4" if ((foo())(42) != "#42") return "fail5" - if ({() -> A()}()() != "##") return "fail6" - if ({() -> A()}()(37) != "#37") return "fail7" + if ({ -> A()}()() != "##") return "fail6" + if ({ -> A()}()(37) != "#37") return "fail7" return "OK" } \ No newline at end of file diff --git a/compiler/testData/codegen/box/functions/kt395.kt b/compiler/testData/codegen/box/functions/kt395.kt index 11f1deb9334..310640226e0 100644 --- a/compiler/testData/codegen/box/functions/kt395.kt +++ b/compiler/testData/codegen/box/functions/kt395.kt @@ -1,6 +1,6 @@ fun Any.with(operation : Any.() -> Any) = operation().toString() -val f = { (a : Int) :Unit -> } +val f = { a : Int -> } fun box () : String { return if(20.with { diff --git a/compiler/testData/codegen/box/functions/kt785.kt b/compiler/testData/codegen/box/functions/kt785.kt index 245d18a14ba..e3073856d42 100644 --- a/compiler/testData/codegen/box/functions/kt785.kt +++ b/compiler/testData/codegen/box/functions/kt785.kt @@ -1,7 +1,7 @@ class A() { var x : Int = 0 - var z = { () -> + var z = { x++ } } diff --git a/compiler/testData/codegen/box/functions/localFunctions/kt2895.kt b/compiler/testData/codegen/box/functions/localFunctions/kt2895.kt index 58d122e489d..76db2bdc71e 100644 --- a/compiler/testData/codegen/box/functions/localFunctions/kt2895.kt +++ b/compiler/testData/codegen/box/functions/localFunctions/kt2895.kt @@ -2,7 +2,7 @@ fun outer() { fun inner(i: Int) { if (i > 0){ { - (it: Int) -> inner(0) // <- invocation of literal itself is generated instead + it: Int -> inner(0) // <- invocation of literal itself is generated instead }.invoke(1) } } diff --git a/compiler/testData/codegen/box/labels/propertyAccessorInnerExtensionFun.kt b/compiler/testData/codegen/box/labels/propertyAccessorInnerExtensionFun.kt index 113ec4bdf87..1a57fc6e039 100644 --- a/compiler/testData/codegen/box/labels/propertyAccessorInnerExtensionFun.kt +++ b/compiler/testData/codegen/box/labels/propertyAccessorInnerExtensionFun.kt @@ -1,6 +1,6 @@ val Int.getter: Int get() { - val extFun = { Int.() -> + val extFun: Int.() -> Int = { this@getter } return this@getter.extFun() @@ -10,7 +10,7 @@ val Int.getter: Int var Int.setter: Int get() = 1 set(i: Int) { - val extFun = { Int.() -> + val extFun: Int.() -> Int = { this@setter } this@setter.extFun() diff --git a/compiler/testData/codegen/box/reflection/functionLiteralGenericSignature.kt b/compiler/testData/codegen/box/reflection/functionLiteralGenericSignature.kt index 4cde37f7cd1..167fb492450 100644 --- a/compiler/testData/codegen/box/reflection/functionLiteralGenericSignature.kt +++ b/compiler/testData/codegen/box/reflection/functionLiteralGenericSignature.kt @@ -10,13 +10,13 @@ fun assertGenericSuper(expected: String, function: Any?) { val unitFun = { } val intFun = { 42 } -val stringParamFun = { (x: String) : Unit -> } -val listFun = { (l: List) : List -> l } -val mutableListFun = { (l: MutableList) : MutableList -> null!! } -val funWithIn = { (x: Comparable) : Unit -> } +val stringParamFun = { x: String -> } +val listFun = { l: List -> l } +val mutableListFun = fun (l: MutableList): MutableList = null!! +val funWithIn = fun (x: Comparable) {} -val extensionFun = { Any.() : Unit -> } -val extensionWithArgFun = { Long.(x: Any) : Date -> Date() } +val extensionFun = fun Any.() {} +val extensionWithArgFun = fun Long.(x: Any): Date = Date() fun box(): String { assertGenericSuper("kotlin.Function0", unitFun) diff --git a/compiler/testData/codegen/box/regressions/kt3173.kt b/compiler/testData/codegen/box/regressions/kt3173.kt index 5de8316ee1e..35833189d55 100644 --- a/compiler/testData/codegen/box/regressions/kt3173.kt +++ b/compiler/testData/codegen/box/regressions/kt3173.kt @@ -1,4 +1,4 @@ fun box(): String { - val sum = {Int.(other: Int) -> this + other } + val sum = fun Int.(other: Int) = this + other return if (1 sum 2 == 3) "OK" else "Fail" } diff --git a/compiler/testData/codegen/box/regressions/kt3999.kt b/compiler/testData/codegen/box/regressions/kt3999.kt index 5fa11f9a480..d6897d0fde5 100644 --- a/compiler/testData/codegen/box/regressions/kt3999.kt +++ b/compiler/testData/codegen/box/regressions/kt3999.kt @@ -19,7 +19,7 @@ fun test2() { } fun Int.foo(a: Int) = this * a -val boo = {Int.(a: Int): Int -> this + a} +val boo = fun Int.(a: Int): Int = this + a fun box(): String { test1() diff --git a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt index 084a31ab8f4..86a484a6590 100644 --- a/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt +++ b/compiler/testData/codegen/boxAgainstJava/sam/adapters/nonLiteralComparator.kt @@ -4,7 +4,7 @@ fun box(): String { val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5)) val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1)) - val f = { (a: Int, b: Int) -> b - a } + val f = { a: Int, b: Int -> b - a } JavaClass.sortIntList(list, f) return if (list == expected) "OK" else list.toString() } \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/capture/simpleCapturingInClass.1.kt b/compiler/testData/codegen/boxInline/capture/simpleCapturingInClass.1.kt index 66e16ee9e2d..718adfb1432 100644 --- a/compiler/testData/codegen/boxInline/capture/simpleCapturingInClass.1.kt +++ b/compiler/testData/codegen/boxInline/capture/simpleCapturingInClass.1.kt @@ -1,7 +1,7 @@ fun testAll(): String { val inlineX = InlineAll() - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5}, 1, 12.0, 13.0, "14", 15) } @@ -19,7 +19,7 @@ fun testAllWithCapturedVal(): String { val c8 = 27.toShort() val c9 = 28.toFloat() - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.0, 13.0, "14", 15) } @@ -37,7 +37,7 @@ fun testAllWithCapturedVar(): String { var c8 = 27.toShort() val c9 = 28.toFloat() - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.0, 13.0, "14", 15) } @@ -55,7 +55,7 @@ fun testAllWithCapturedValAndVar(): String { var c8 = 27.toShort() val c9 = 28.toFloat() - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.0, 13.0, "14", 15) } diff --git a/compiler/testData/codegen/boxInline/capture/simpleCapturingInPackage.1.kt b/compiler/testData/codegen/boxInline/capture/simpleCapturingInPackage.1.kt index d281a5506f2..f6239940bad 100644 --- a/compiler/testData/codegen/boxInline/capture/simpleCapturingInPackage.1.kt +++ b/compiler/testData/codegen/boxInline/capture/simpleCapturingInPackage.1.kt @@ -1,7 +1,7 @@ fun testAll(): String { - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> - "" + a1 + a2 + a3 + a4 + a5}, - 1, 12.0, 13.0, "14", 15) + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> + "" + a1 + a2 + a3 + a4 + a5}, + 1, 12.0, 13.0, "14", 15) } fun testAllWithCapturedVal(): String { @@ -15,9 +15,9 @@ fun testAllWithCapturedVal(): String { val c8 = 27.toShort() val c9 = 28.toFloat() - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> + "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, + 1, 12.0, 13.0, "14", 15) } fun testAllWithCapturedVar(): String { @@ -31,9 +31,9 @@ fun testAllWithCapturedVar(): String { var c8 = 27.toShort() val c9 = 28.toFloat() - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> + "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, + 1, 12.0, 13.0, "14", 15) } fun testAllWithCapturedValAndVar(): String { @@ -47,9 +47,9 @@ fun testAllWithCapturedValAndVar(): String { var c8 = 27.toShort() val c9 = 28.toFloat() - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> - "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, - 1, 12.0, 13.0, "14", 15) + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> + "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, + 1, 12.0, 13.0, "14", 15) } diff --git a/compiler/testData/codegen/boxInline/complex/closureChain.1.kt b/compiler/testData/codegen/boxInline/complex/closureChain.1.kt index b65222a0bd6..2c426e71557 100644 --- a/compiler/testData/codegen/boxInline/complex/closureChain.1.kt +++ b/compiler/testData/codegen/boxInline/complex/closureChain.1.kt @@ -1,6 +1,6 @@ fun test1(): Int { val inlineX = Inline() - return inlineX.foo({(z: Int) -> "" + z}, 25, {String.() -> this.length()}) + return inlineX.foo({ z: Int -> "" + z}, 25, fun String.(): Int = this.length()) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/defaultValues/defaultInExtension.1.kt b/compiler/testData/codegen/boxInline/defaultValues/defaultInExtension.1.kt index 501cd8b71ce..41dcb7f91f8 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/defaultInExtension.1.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/defaultInExtension.1.kt @@ -8,10 +8,10 @@ fun testExtensionInClass() : String { res = with(Z(1)) { "1".run() } if (res != "1null") return "failed in class 2: $res" - res = with(Z(2)) { "3".run("OK", {(a, b) -> a + b + value }, 1) } + res = with(Z(2)) { "3".run("OK", { a, b -> a + b + value }, 1) } if (res != "OK123") return "failed in class 3: $res" - res = with(Z(3)) { "4".run(lambda = {(a, b) -> a + b + value }) } + res = with(Z(3)) { "4".run(lambda = { a, b -> a + b + value }) } if (res != "034") return "failed in class 4: $res" return "OK" @@ -25,10 +25,10 @@ fun box(): String { res = "1".run() if (res != "1null") return "failed 2: $res" - res = "3".run("OK", {(a, b) -> a + b}, 1) + res = "3".run("OK", { a, b -> a + b}, 1) if (res != "OK13") return "failed 3: $res" - res = "4".run(lambda = {(a, b) -> a + b}) + res = "4".run(lambda = { a, b -> a + b}) if (res != "04") return "failed 4: $res" return testExtensionInClass() diff --git a/compiler/testData/codegen/boxInline/defaultValues/defaultMethodInClass.1.kt b/compiler/testData/codegen/boxInline/defaultValues/defaultMethodInClass.1.kt index f1822824496..a6c96bb9bf8 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/defaultMethodInClass.1.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/defaultMethodInClass.1.kt @@ -5,9 +5,9 @@ fun box(): String { if (Z().run("OK") != "OK0") return "fail 2" - if (Z().run("OK", {(a, b) -> a + b }, 1) != "OK1") return "fail 3" + if (Z().run("OK", { a, b -> a + b }, 1) != "OK1") return "fail 3" - if (Z().run(lambda = {(a: String, b: Int) -> a + b }) != "0") return "fail 4" + if (Z().run(lambda = { a: String, b: Int -> a + b }) != "0") return "fail 4" return "OK" } diff --git a/compiler/testData/codegen/boxInline/noInline/noInline.1.kt b/compiler/testData/codegen/boxInline/noInline/noInline.1.kt index 4358f5acfe5..1e87ef9c877 100644 --- a/compiler/testData/codegen/boxInline/noInline/noInline.1.kt +++ b/compiler/testData/codegen/boxInline/noInline/noInline.1.kt @@ -1,5 +1,5 @@ fun test1(): Int { - return calc( {(l : Int) -> 2*l}, {(l : Int) -> 4*l}) + return calc( { l: Int -> 2*l}, { l: Int -> 4*l}) } diff --git a/compiler/testData/codegen/boxInline/noInline/withoutInline.1.kt b/compiler/testData/codegen/boxInline/noInline/withoutInline.1.kt index a37ab7f198c..39a2be7e16a 100644 --- a/compiler/testData/codegen/boxInline/noInline/withoutInline.1.kt +++ b/compiler/testData/codegen/boxInline/noInline/withoutInline.1.kt @@ -1,6 +1,6 @@ fun test1(): Int { val inlineX = Inline() - var p = {(l : Int) -> l}; + var p = { l : Int -> l}; return inlineX.calc(p, 25) } diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.1.kt index fa5bbf7c55b..de5a4790e99 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/bracket.1.kt @@ -2,7 +2,6 @@ import test.* fun test1(b: Boolean): String { val localResult = doCall ((@local { - () : String -> if (b) { return@local "local" } else { diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.1.kt index 0e1e774c3c9..2dae9289747 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/deparenthesize/labeled.1.kt @@ -2,7 +2,6 @@ import test.* fun test1(b: Boolean): String { val localResult = doCall @local { - () : String -> if (b) { return@local "local" } else { diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/explicitLocalReturn.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/explicitLocalReturn.1.kt index 0e1e774c3c9..2dae9289747 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/explicitLocalReturn.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/explicitLocalReturn.1.kt @@ -2,7 +2,6 @@ import test.* fun test1(b: Boolean): String { val localResult = doCall @local { - () : String -> if (b) { return@local "local" } else { diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/nestedNonLocals.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/nestedNonLocals.1.kt index 7cae382c60f..f707baa8f93 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/nestedNonLocals.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/nestedNonLocals.1.kt @@ -16,10 +16,8 @@ class Global(val value: String) fun test1(intKind: Kind, extKind: Kind): Global { var externalResult = doCall @ext { - () : External -> val internalResult = doCall @int { - () : Internal -> if (intKind == Kind.GLOBAL) { return@test1 Global("internal -> global") } else if (intKind == EXTERNAL) { diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.1.kt index 42195e379df..f45881082a3 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/noInlineLocalReturn.1.kt @@ -2,7 +2,6 @@ import test.* fun test1(b: Boolean): String { val localResult = noInlineCall @local { - () : Int -> if (b) { return@local 1 } else { diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.1.kt index c6b09d75c32..829e3a5b0a7 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/callSite/callSite.1.kt @@ -23,11 +23,9 @@ fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global { holder.value = "" try { var externalResult = doCall @ext { - (): External -> try { val internalResult = doCall @int { - (): Internal -> try { if (intKind == Kind.GLOBAL) { return@test1 Global("internal -> global") diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.1.kt index e0eb0efafca..519931ef7b7 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/complex.1.kt @@ -23,11 +23,9 @@ fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global { holder.value = "" try { var externalResult = doCall (@ext { - (): External -> try { val internalResult = doCall (@int { - (): Internal -> try { if (intKind == Kind.GLOBAL) { return@test1 Global("internal -> global") diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.1.kt index c91bc8bda10..41b621327b9 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTry.1.kt @@ -18,7 +18,6 @@ fun test1(h: Holder): String { fun test2(h: Holder): String { val localResult = doCall (@lambda { - (): String -> h.value += "OK_LOCAL" return@lambda "OK_LOCAL" }, { diff --git a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.1.kt b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.1.kt index 9bab28b5ff1..5d11bfa9a55 100644 --- a/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.1.kt +++ b/compiler/testData/codegen/boxInline/nonLocalReturns/tryFinally/declSite/returnInTryAndFinally.1.kt @@ -22,7 +22,6 @@ fun test1(h: Holder): String { fun test2(h: Holder): String { val localResult = doCall ( @lambda { - (): String -> h.value += "OK_NONLOCAL" return@lambda "OK_NONLOCAL" }, { @@ -47,14 +46,12 @@ fun test3(h: Holder): String { } fun test4(h: Holder): String { - val localResult = doCall ( + val localResult = doCall ( { - ():String -> h.value += "OK_NONLOCAL" return "OK_NONLOCAL" }, @l2 { - ():String -> h.value += ", OK_FINALLY" return@l2 "OK_FINALLY" }) diff --git a/compiler/testData/codegen/boxInline/simple/extension.1.kt b/compiler/testData/codegen/boxInline/simple/extension.1.kt index c86600273ab..c5ec0a15789 100644 --- a/compiler/testData/codegen/boxInline/simple/extension.1.kt +++ b/compiler/testData/codegen/boxInline/simple/extension.1.kt @@ -1,11 +1,11 @@ fun test1(): Int { val inlineX = Inline(9) - return inlineX.calcExt({(z: Int) -> z}, 25) + return inlineX.calcExt({ z: Int -> z}, 25) } fun test2(): Int { val inlineX = Inline(9) - return inlineX.calcExt2({Int.() -> this}, 25) + return inlineX.calcExt2(fun Int.(): Int = this, 25) } fun test3(): Int { @@ -21,7 +21,7 @@ fun test4(): Double { fun test5(): Double { val inlineX = Inline(9) with(inlineX) { - 11.0.calcDouble{(a: Int, b: Double) -> a + b} + 11.0.calcDouble{ a: Int, b: Double -> a + b} } return inlineX.doWorkWithDouble(11.0) } diff --git a/compiler/testData/codegen/boxInline/simple/extension.2.kt b/compiler/testData/codegen/boxInline/simple/extension.2.kt index c77a879deeb..b3ea121fc0b 100644 --- a/compiler/testData/codegen/boxInline/simple/extension.2.kt +++ b/compiler/testData/codegen/boxInline/simple/extension.2.kt @@ -19,11 +19,11 @@ class Inline(val res: Int) { } fun doWork(l : InlineX) : Int { - return l.calcInt({(a: Int, b: Int) -> a + b}) + return l.calcInt({ a: Int, b: Int -> a + b}) } fun doWorkWithDouble(s : Double) : Double { - return s.calcDouble({(a: Int, b: Double) -> a + b}) + return s.calcDouble({ a: Int, b: Double -> a + b}) } } diff --git a/compiler/testData/codegen/boxInline/simple/params.1.kt b/compiler/testData/codegen/boxInline/simple/params.1.kt index 5548d48836f..478f9908dff 100644 --- a/compiler/testData/codegen/boxInline/simple/params.1.kt +++ b/compiler/testData/codegen/boxInline/simple/params.1.kt @@ -1,23 +1,23 @@ fun test1(): Int { val inlineX = Inline() - return inlineX.foo1Int({(z: Int) -> z}, 25) + return inlineX.foo1Int({ z: Int -> z}, 25) } fun test2(): Double { val inlineX = Inline() - return inlineX.foo1Double(25.0, {(z: Double) -> z}) + return inlineX.foo1Double(25.0, { z: Double -> z}) } fun test3(): Double { val inlineX = Inline() - return inlineX.foo2Param(15.0, {(z1: Int, z2: Double) -> z1 + z2}, 10) + return inlineX.foo2Param(15.0, { z1: Int, z2: Double -> z1 + z2}, 10) } fun test3WithCaptured(): Double { val inlineX = Inline() var c = 11.0; - return inlineX.foo2Param(15.0, {(z1: Int, z2: Double) -> z1 + z2 + c}, 10) + return inlineX.foo2Param(15.0, { z1: Int, z2: Double -> z1 + z2 + c}, 10) } diff --git a/compiler/testData/codegen/boxInline/simple/severalClosures.1.kt b/compiler/testData/codegen/boxInline/simple/severalClosures.1.kt index 75dbbea3542..21e7b47c5a2 100644 --- a/compiler/testData/codegen/boxInline/simple/severalClosures.1.kt +++ b/compiler/testData/codegen/boxInline/simple/severalClosures.1.kt @@ -1,17 +1,17 @@ fun test1(): Double { val inlineX = Inline() - return inlineX.foo1({(z: Int) -> z}, 25, {(z: Double) -> z}, 11.5) + return inlineX.foo1({ z: Int -> z}, 25, { z: Double -> z}, 11.5) } fun test1WithCaptured(): Double { val inlineX = Inline() var d = 0.0; - return inlineX.foo1({(z: Int) -> d = 1.0; z}, 25, {(z: Double) -> z + d}, 11.5) + return inlineX.foo1({ z: Int -> d = 1.0; z}, 25, { z: Double -> z + d}, 11.5) } fun test2(): Double { val inlineX = Inline() - return inlineX.foo2({(z: Int, p: Int) -> z + p}, 25, {(x: Double, y: Int, z: Int) -> z + x + y}, 11.5, 2) + return inlineX.foo2({ z: Int, p: Int -> z + p}, 25, { x: Double, y: Int, z: Int -> z + x + y}, 11.5, 2) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/simple/simpleDouble.1.kt b/compiler/testData/codegen/boxInline/simple/simpleDouble.1.kt index 4ae0853ab60..3a7126fa2b0 100644 --- a/compiler/testData/codegen/boxInline/simple/simpleDouble.1.kt +++ b/compiler/testData/codegen/boxInline/simple/simpleDouble.1.kt @@ -1,39 +1,39 @@ fun test0Param(): Double { val inlineX = InlineDouble(10.0) - return inlineX.foo({() -> 1.0}) + return inlineX.foo({ -> 1.0}) } fun test1Param(): Double { val inlineX = InlineDouble(10.0) - return inlineX.foo11({(z: Double) -> z}) + return inlineX.foo11({ z: Double -> z}) } fun test1ParamCaptured(): Double { val s = 100.0 val inlineX = InlineDouble(10.0) - return inlineX.foo11({(z: Double) -> s}) + return inlineX.foo11({ z: Double -> s}) } fun test1ParamMissed() : Double { val inlineX = InlineDouble(10.0) - return inlineX.foo11({(z: Double) -> 111.0}) + return inlineX.foo11({ z: Double -> 111.0}) } fun test1ParamFromCallContext() : Double { val inlineX = InlineDouble(1000.0) - return inlineX.fooRes({(z: Double) -> z}) + return inlineX.fooRes({ z: Double -> z}) } fun test2Params() : Double { val inlineX = InlineDouble(1000.0) - return inlineX.fooRes2({(y: Double, z: Double) -> 2.0 * y + 3.0 * z}) + return inlineX.fooRes2({ y: Double, z: Double -> 2.0 * y + 3.0 * z}) } fun test2ParamsWithCaptured() : Double { val inlineX = InlineDouble(1000.0) val s = 9.0 var t = 1.0 - return inlineX.fooRes2({(y: Double, z: Double) -> 2.0 * s + t}) + return inlineX.fooRes2({ y: Double, z: Double -> 2.0 * s + t}) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/simple/simpleInt.1.kt b/compiler/testData/codegen/boxInline/simple/simpleInt.1.kt index 94e83c10a9f..15a2051fc5a 100644 --- a/compiler/testData/codegen/boxInline/simple/simpleInt.1.kt +++ b/compiler/testData/codegen/boxInline/simple/simpleInt.1.kt @@ -1,39 +1,39 @@ fun test0Param(): Int { val inlineX = Inline(10) - return inlineX.foo({() -> 1}) + return inlineX.foo({ -> 1}) } fun test1Param(): Int { val inlineX = Inline(10) - return inlineX.foo11({(z: Int) -> z}) + return inlineX.foo11({ z: Int -> z}) } fun test1ParamCaptured(): Int { val s = 100 val inlineX = Inline(10) - return inlineX.foo11({(z: Int) -> s}) + return inlineX.foo11({ z: Int -> s}) } fun test1ParamMissed() : Int { val inlineX = Inline(10) - return inlineX.foo11({(z: Int) -> 111}) + return inlineX.foo11({ z: Int -> 111}) } fun test1ParamFromCallContext() : Int { val inlineX = Inline(1000) - return inlineX.fooRes({(z: Int) -> z}) + return inlineX.fooRes({ z: Int -> z}) } fun test2Params() : Int { val inlineX = Inline(1000) - return inlineX.fooRes2({(y: Int, z: Int) -> 2 * y + 3 * z}) + return inlineX.fooRes2({ y: Int, z: Int -> 2 * y + 3 * z}) } fun test2ParamsWithCaptured() : Int { val inlineX = Inline(1000) val s = 9 var t = 1 - return inlineX.fooRes2({(y: Int, z: Int) -> 2 * s + t}) + return inlineX.fooRes2({ y: Int, z: Int -> 2 * s + t}) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/simple/simpleObject.1.kt b/compiler/testData/codegen/boxInline/simple/simpleObject.1.kt index 1578ba88194..6e80ca46e7d 100644 --- a/compiler/testData/codegen/boxInline/simple/simpleObject.1.kt +++ b/compiler/testData/codegen/boxInline/simple/simpleObject.1.kt @@ -1,39 +1,39 @@ fun test0Param(): String { val inlineX = InlineString("10") - return inlineX.foo({() -> "1"}) + return inlineX.foo({ -> "1"}) } fun test1Param(): String { val inlineX = InlineString("10") - return inlineX.foo11({(z: String) -> z}) + return inlineX.foo11({ z: String -> z}) } fun test1ParamCaptured(): String { val s = "100" val inlineX = InlineString("10") - return inlineX.foo11({(z: String) -> s}) + return inlineX.foo11({ z: String -> s}) } fun test1ParamMissed() : String { val inlineX = InlineString("10") - return inlineX.foo11({(z: String) -> "111"}) + return inlineX.foo11({ z: String -> "111"}) } fun test1ParamFromCallContext() : String { val inlineX = InlineString("1000") - return inlineX.fooRes({(z: String) -> z}) + return inlineX.fooRes({ z: String -> z}) } fun test2Params() : String { val inlineX = InlineString("1000") - return inlineX.fooRes2({(y: String, z: String) -> y + "0" + z}) + return inlineX.fooRes2({ y: String, z: String -> y + "0" + z}) } fun test2ParamsWithCaptured() : String { val inlineX = InlineString("1000") val s = "9" var t = "1" - return inlineX.fooRes2({(y: String, z: String) -> s + t}) + return inlineX.fooRes2({ y: String, z: String -> s + t}) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/simple/vararg.2.kt b/compiler/testData/codegen/boxInline/simple/vararg.2.kt index aa416cbee16..af7c66d09f0 100644 --- a/compiler/testData/codegen/boxInline/simple/vararg.2.kt +++ b/compiler/testData/codegen/boxInline/simple/vararg.2.kt @@ -1,5 +1,5 @@ package test inline fun doSmth(vararg a: String) : String { - return a.foldRight("", {(a, b) -> a + b}) + return a.foldRight("", { a, b -> a + b}) } \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/special/inlineChain.1.kt b/compiler/testData/codegen/boxInline/special/inlineChain.1.kt index d05e7703a57..4b53b0054c9 100644 --- a/compiler/testData/codegen/boxInline/special/inlineChain.1.kt +++ b/compiler/testData/codegen/boxInline/special/inlineChain.1.kt @@ -1,13 +1,13 @@ fun test1(): String { val inlineX = My() var d = ""; - inlineX.doWork({(z: String) -> d = z; z}) + inlineX.doWork({ z: String -> d = z; z}) return d } fun test2(): Int { val inlineX = My() - return inlineX.perform({(z: My) -> 11}) + return inlineX.perform({ z: My -> 11}) } fun box(): String { diff --git a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.1.kt b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.1.kt index f51d910d570..f9ba17ba2aa 100644 --- a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.1.kt +++ b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.1.kt @@ -17,7 +17,7 @@ fun test11(): Int { throw RuntimeException("2") } }, - {(ex, thizz) -> + { ex, thizz -> if (ex.getMessage() == "2") { thizz.value } else { @@ -48,7 +48,7 @@ fun test22(): Int { 111 } }, - {(ex, thizz) -> + { ex, thizz -> -11111 }) @@ -80,7 +80,7 @@ fun test33(): Int { throw RuntimeException("-2") } }, - {(ex, thizz) -> + { ex, thizz -> if (ex.getMessage() == "-2") { throw RuntimeException("-3") } else { diff --git a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.1.kt b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.1.kt index b5c38dc9279..fa628dc3687 100644 --- a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.1.kt +++ b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.1.kt @@ -48,7 +48,7 @@ fun test3(): Int { result = it.value; throw RuntimeException("-1") }, - { (e, z)-> + { e, z -> ++result throw RuntimeException("-2") }, diff --git a/compiler/testData/codegen/boxWithStdlib/arrays/kt4118.kt b/compiler/testData/codegen/boxWithStdlib/arrays/kt4118.kt index 2d9d5b27d8d..979effeed54 100644 --- a/compiler/testData/codegen/boxWithStdlib/arrays/kt4118.kt +++ b/compiler/testData/codegen/boxWithStdlib/arrays/kt4118.kt @@ -1,10 +1,10 @@ fun Array.test1(): Array { - val func = {(i:Int) -> this} + val func = { i:Int -> this} return func(1) } fun Array.test1Nested(): Array { - val func = {(i:Int) -> { this }()} + val func = { i: Int -> { this }()} return func(1) } @@ -71,7 +71,7 @@ fun Array.test4Nested() : Array { } fun Array.test1(): Array { - val func = {(i:Int) -> this} + val func = { i: Int -> this} return func(1) } diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt b/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt index daf0fc7291e..e45b8ab50c8 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt @@ -16,6 +16,6 @@ fun box(): String { list.add("Moscow") list.add("Munich") - val m: ArrayList = list.findAll({(name: String) -> name.startsWith("M")}) + val m: ArrayList = list.findAll({ name: String -> name.startsWith("M")}) return if (m.size() == 2) "OK" else "fail" } diff --git a/compiler/testData/codegen/bytecodeText/directInvoke/inplaceClosure.kt b/compiler/testData/codegen/bytecodeText/directInvoke/inplaceClosure.kt index 6785206a901..86033d05e9d 100644 --- a/compiler/testData/codegen/bytecodeText/directInvoke/inplaceClosure.kt +++ b/compiler/testData/codegen/bytecodeText/directInvoke/inplaceClosure.kt @@ -1,5 +1,5 @@ fun test() { - 1.{Int.() -> 2}() + 1.(fun Int.() = 2)() } // 1 invoke \(I\)I \ No newline at end of file diff --git a/idea/testData/decompiler/decompiledText/FunctionTypes/FunctionTypes.kt b/idea/testData/decompiler/decompiledText/FunctionTypes/FunctionTypes.kt index 412698caf73..2e944fc4368 100644 --- a/idea/testData/decompiler/decompiledText/FunctionTypes/FunctionTypes.kt +++ b/idea/testData/decompiler/decompiledText/FunctionTypes/FunctionTypes.kt @@ -2,11 +2,11 @@ package test class FunctionTypes { public fun Function1.compose(f: (P1) -> IP): (P1) -> R { - return {(p1: P1) -> this(f(p1)) } + return { p1: P1 -> this(f(p1)) } } public fun ((IP) -> R).compose2(f: (P1) -> IP) : (P1) -> R { - return {(p1: P1) -> this(f(p1)) } + return { p1: P1 -> this(f(p1)) } } public fun (A.(A) -> A).foo() { diff --git a/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt b/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt index 820d55976ee..72a1344c8f3 100644 --- a/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt +++ b/idea/testData/intentions/convertParameterToReceiver/lambdaParameter.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false -val foo = {(s: String, n: Int) -> s.length() - n/2 > 1 } +val foo = { s: String, n: Int -> s.length() - n/2 > 1 } fun test() { foo("1", 2) diff --git a/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt b/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt index 69d990f549a..7874980140d 100644 --- a/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt +++ b/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt @@ -4,5 +4,5 @@ class Mocha() { } fun main() { val mocha = Mocha() - val testing = mocha(1, "fire"){ (x: Int) -> "hello world" } + val testing = mocha(1, "fire"){ x: Int -> "hello world" } } \ No newline at end of file diff --git a/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after b/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after index d3d9b88baf5..f0b80c3eda7 100644 --- a/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after +++ b/idea/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after @@ -4,5 +4,5 @@ class Mocha() { } fun main() { val mocha = Mocha() - val testing = mocha.invoke(1, "fire"){ (x: Int) -> "hello world" } + val testing = mocha.invoke(1, "fire"){ x: Int -> "hello world" } } \ No newline at end of file diff --git a/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt b/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt index 8fdf204f8e1..89b97d719c4 100644 --- a/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt +++ b/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt @@ -3,5 +3,5 @@ class Mocha() { } fun main() { val mocha = Mocha() - val testing = mocha{ (x: Int) -> "hello world" } + val testing = mocha{ x: Int -> "hello world" } } \ No newline at end of file diff --git a/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after b/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after index 54273f150b9..89760fa36d8 100644 --- a/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after +++ b/idea/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after @@ -3,5 +3,5 @@ class Mocha() { } fun main() { val mocha = Mocha() - val testing = mocha.invoke{ (x: Int) -> "hello world" } + val testing = mocha.invoke{ x: Int -> "hello world" } } \ No newline at end of file diff --git a/idea/testData/intentions/operatorToFunction/notApplicableFunctionCallWithCallableReference.kt b/idea/testData/intentions/operatorToFunction/notApplicableFunctionCallWithCallableReference.kt index 919dffa23c3..ee48adbfc66 100644 --- a/idea/testData/intentions/operatorToFunction/notApplicableFunctionCallWithCallableReference.kt +++ b/idea/testData/intentions/operatorToFunction/notApplicableFunctionCallWithCallableReference.kt @@ -1,6 +1,6 @@ // WITH_RUNTIME // IS_APPLICABLE: false fun foo() { - val bar = { (x: Int) -> x + 1 } + val bar = { x: Int -> x + 1 } val incremented = listOf(1, 2, 3).map(bar) } \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt b/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt index 5194ae4609e..f0668c8ac98 100644 --- a/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt +++ b/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: true fun foo() { - bar<(Int) -> Int> { (it: Int) -> it } + bar<(Int) -> Int> { it: Int -> it } } fun bar(t: T): Int = 1 \ No newline at end of file diff --git a/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt.after b/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt.after index 209981efb70..ab92606d5c7 100644 --- a/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt.after +++ b/idea/testData/intentions/removeExplicitTypeArguments/lambdaType.kt.after @@ -1,6 +1,6 @@ // IS_APPLICABLE: true fun foo() { - bar { (it: Int) -> it } + bar { it: Int -> it } } fun bar(t: T): Int = 1 \ No newline at end of file diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt index 166e396a5b2..b7fb3a3c8e6 100644 --- a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false -val foo = { (x: Int) -> +val foo = { x: Int -> class Inner() { fun temp(y: Int) : Int { return x + y } } diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt index 4ceeb0e877e..5629d47621e 100644 --- a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt @@ -1,2 +1,2 @@ // IS_APPLICABLE: false -val incr = { (x: Int) -> x + 1} +val incr = { x: Int -> x + 1} diff --git a/idea/testData/intentions/specifyType/functionType.kt b/idea/testData/intentions/specifyType/functionType.kt index 9bf79bd87a9..4849832a6b0 100644 --- a/idea/testData/intentions/specifyType/functionType.kt +++ b/idea/testData/intentions/specifyType/functionType.kt @@ -1 +1 @@ -val x = { (a: Int) -> ""} \ No newline at end of file +val x = { a: Int -> ""} \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/functionType.kt.after b/idea/testData/intentions/specifyType/functionType.kt.after index fe8ee5809c5..521c0f63e42 100644 --- a/idea/testData/intentions/specifyType/functionType.kt.after +++ b/idea/testData/intentions/specifyType/functionType.kt.after @@ -1 +1 @@ -val x: (Int) -> String = { (a: Int) -> ""} \ No newline at end of file +val x: (Int) -> String = { a: Int -> ""} \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/afterSAMConstructorFromLambda.kt b/idea/testData/quickfix/autoImports/afterSAMConstructorFromLambda.kt index 67da9517835..e4a3427e445 100644 --- a/idea/testData/quickfix/autoImports/afterSAMConstructorFromLambda.kt +++ b/idea/testData/quickfix/autoImports/afterSAMConstructorFromLambda.kt @@ -6,6 +6,6 @@ import java.util.Comparator fun foo() { Collections.sort( ArrayList(), - Comparator {(x: Int, y: Int) -> x - y } + Comparator { x: Int, y: Int -> x - y } ) } \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/beforeSAMConstructorFromLambda.kt b/idea/testData/quickfix/autoImports/beforeSAMConstructorFromLambda.kt index 5beb36e5e86..85de93e5e79 100644 --- a/idea/testData/quickfix/autoImports/beforeSAMConstructorFromLambda.kt +++ b/idea/testData/quickfix/autoImports/beforeSAMConstructorFromLambda.kt @@ -5,6 +5,6 @@ import java.util.ArrayList fun foo() { Collections.sort( ArrayList(), - Comparator {(x: Int, y: Int) -> x - y } + Comparator { x: Int, y: Int -> x - y } ) } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt index 50b709488a5..5913a77ebdb 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArg.kt @@ -1,7 +1,7 @@ // "Create class 'Foo'" "true" fun test() { - val a = Foo(2, "2") { (p: Int) -> p + 1 } + val a = Foo(2, "2") { p: Int -> p + 1 } } class Foo(i: Int, s: String, function: Function1) { diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt index e6167c3b6e5..4141e375f11 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/afterCallWithLambdaArgOnly.kt @@ -1,7 +1,7 @@ // "Create class 'Foo'" "true" fun test() { - val a = Foo { (p: Int) -> p + 1 } + val a = Foo { p: Int -> p + 1 } } class Foo(function: Function1) { diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt index 6108a0976b3..2117f0a7ab9 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArg.kt @@ -1,5 +1,5 @@ // "Create class 'Foo'" "true" fun test() { - val a = Foo(2, "2") { (p: Int) -> p + 1 } + val a = Foo(2, "2") { p: Int -> p + 1 } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt index b10becc19cc..a6a4f3c1915 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/beforeCallWithLambdaArgOnly.kt @@ -1,5 +1,5 @@ // "Create class 'Foo'" "true" fun test() { - val a = Foo { (p: Int) -> p + 1 } + val a = Foo { p: Int -> p + 1 } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArg.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArg.kt index f90c488b910..fdc64bc9eab 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArg.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArg.kt @@ -8,5 +8,5 @@ class A(val n: T) { } fun test() { - val a: A = A(1).foo(2, "2") { (p: Int) -> p + 1 } + val a: A = A(1).foo(2, "2") { p: Int -> p + 1 } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArgOnly.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArgOnly.kt index 4015b0770e5..768db103ee2 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArgOnly.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/afterCallWithLambdaArgOnly.kt @@ -8,5 +8,5 @@ class A(val n: T) { } fun test() { - val a: A = A(1).foo { (p: Int) -> p + 1 } + val a: A = A(1).foo { p: Int -> p + 1 } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArg.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArg.kt index 3facd5b297c..3359ad63282 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArg.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArg.kt @@ -5,5 +5,5 @@ class A(val n: T) { } fun test() { - val a: A = A(1).foo(2, "2") { (p: Int) -> p + 1 } + val a: A = A(1).foo(2, "2") { p: Int -> p + 1 } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArgOnly.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArgOnly.kt index 4a4043982e7..afd5f0d0371 100644 --- a/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArgOnly.kt +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/beforeCallWithLambdaArgOnly.kt @@ -5,5 +5,5 @@ class A(val n: T) { } fun test() { - val a: A = A(1).foo { (p: Int) -> p + 1 } + val a: A = A(1).foo { p: Int -> p + 1 } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInLambdaWithParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInLambdaWithParams.kt index e1fe2b31832..1613113087c 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInLambdaWithParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInLambdaWithParams.kt @@ -2,7 +2,7 @@ // ACTION: Create parameter 'foo' fun test(n: Int) { - val f: (Int, Int) -> Int = { (a, b) -> + val f: (Int, Int) -> Int = { a, b -> val foo = 0 foo } diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInMultiLineLambdaWithParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInMultiLineLambdaWithParams.kt index e1fe2b31832..1613113087c 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInMultiLineLambdaWithParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/afterInMultiLineLambdaWithParams.kt @@ -2,7 +2,7 @@ // ACTION: Create parameter 'foo' fun test(n: Int) { - val f: (Int, Int) -> Int = { (a, b) -> + val f: (Int, Int) -> Int = { a, b -> val foo = 0 foo } diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInLambdaWithParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInLambdaWithParams.kt index 869228b38e8..407a08fa823 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInLambdaWithParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInLambdaWithParams.kt @@ -2,5 +2,5 @@ // ACTION: Create parameter 'foo' fun test(n: Int) { - val f: (Int, Int) -> Int = { (a, b) -> foo } + val f: (Int, Int) -> Int = { a, b -> foo } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInMultiLineLambdaWithParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInMultiLineLambdaWithParams.kt index e1dd99cf7ad..fdeead6efeb 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInMultiLineLambdaWithParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/localVariable/beforeInMultiLineLambdaWithParams.kt @@ -2,7 +2,7 @@ // ACTION: Create parameter 'foo' fun test(n: Int) { - val f: (Int, Int) -> Int = { (a, b) -> + val f: (Int, Int) -> Int = { a, b -> foo } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithParams.kt index b0d96fa8391..a4c69e87dbd 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithParams.kt @@ -2,5 +2,5 @@ // ACTION: Create local variable 'foo' fun test(n: Int, foo: Int) { - val f: (Int, Int) -> Int = { (a, b) -> foo } + val f: (Int, Int) -> Int = { a, b -> foo } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithTypedParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithTypedParams.kt index c78a7acf9ab..0ca3baca88b 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithTypedParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterInLambdaWithTypedParams.kt @@ -2,5 +2,5 @@ // ACTION: Create local variable 'foo' fun test(n: Int, foo: Any) { - val f = { (a: Int, b: Int) -> foo } + val f = { a: Int, b: Int -> foo } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithParams.kt index 75b0ccc8243..fb7d0575c15 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithParams.kt @@ -2,5 +2,5 @@ // ACTION: Create local variable 'foo' fun test(n: Int) { - val f: (Int, Int) -> Int = { (a, b) -> foo } + val f: (Int, Int) -> Int = { a, b -> foo } } \ No newline at end of file diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithTypedParams.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithTypedParams.kt index ac5d49b6fb9..221882d04b7 100644 --- a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithTypedParams.kt +++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeInLambdaWithTypedParams.kt @@ -2,5 +2,5 @@ // ACTION: Create local variable 'foo' fun test(n: Int) { - val f = { (a: Int, b: Int) -> foo } + val f = { a: Int, b: Int -> foo } } \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeFunctionParameterType1.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeFunctionParameterType1.kt index b253e8b1782..3812beed7ec 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeFunctionParameterType1.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeFunctionParameterType1.kt @@ -1,5 +1,5 @@ // "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true" package bar fun foo(w: Int = 0, x: (String) -> Int, y: Int = 0, z: (Int) -> Int = {42}) { - foo(1, {(a: String) -> 42}, 1) + foo(1, { a: String -> 42}, 1) } diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeParameterTypeLongNameRuntime.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeParameterTypeLongNameRuntime.kt index 247b94da211..01520787701 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeParameterTypeLongNameRuntime.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/afterChangeParameterTypeLongNameRuntime.kt @@ -4,5 +4,5 @@ package bar import kotlin.modules.Module fun foo(w: Int = 0, x: (Module) -> Int, y: Int = 0, z: (Int) -> Int = {42}) { - foo(1, {(a: kotlin.modules.Module) -> 42}, 1) + foo(1, { a: kotlin.modules.Module -> 42}, 1) } diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType1.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType1.kt index deb5313f041..f3bcc3a1ebf 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType1.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeFunctionParameterType1.kt @@ -1,5 +1,5 @@ // "Change parameter 'x' type of function 'bar.foo' to '(String) -> Int'" "true" package bar fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) { - foo(1, {(a: String) -> 42}, 1) + foo(1, { a: String -> 42}, 1) } diff --git a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeParameterTypeLongNameRuntime.kt b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeParameterTypeLongNameRuntime.kt index 3198ef8f5b9..b9e56eae730 100644 --- a/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeParameterTypeLongNameRuntime.kt +++ b/idea/testData/quickfix/typeMismatch/parameterTypeMismatch/beforeChangeParameterTypeLongNameRuntime.kt @@ -1,5 +1,5 @@ // "Change parameter 'x' type of function 'bar.foo' to '(Module) -> Int'" "true" package bar fun foo(w: Int = 0, x: Int, y: Int = 0, z: (Int) -> Int = {42}) { - foo(1, {(a: kotlin.modules.Module) -> 42}, 1) + foo(1, { a: kotlin.modules.Module -> 42}, 1) } diff --git a/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt b/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt index defb287034d..0d431ac8c7c 100644 --- a/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt +++ b/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt @@ -4,6 +4,6 @@ import java.util.ArrayList fun foo() { Collections.sort( ArrayList(), - java.util.Comparator {(x: Int, y: Int) -> x - y } + java.util.Comparator { x: Int, y: Int -> x - y } ) } \ No newline at end of file diff --git a/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt.after b/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt.after index 6d0aede9ecb..5df0746b1fc 100644 --- a/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt.after +++ b/idea/testData/shortenRefs/constructor/SAMConstructorFromLambda.kt.after @@ -5,6 +5,6 @@ import java.util.Comparator fun foo() { Collections.sort( ArrayList(), - Comparator {(x: Int, y: Int) -> x - y } + Comparator { x: Int, y: Int -> x - y } ) } \ No newline at end of file diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt index de19513abe7..a046ef4bad4 100644 --- a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt @@ -1,23 +1,23 @@ fun foo(f: (Int) -> Unit) { - { (n: Int, s: String) -> + { n: Int, s: String -> val a = n + 1 println(s) f(a) } - { (s: String, n: Int) -> + { s: String, n: Int -> val a = n + 1 println(s) f(a) } - { (m: Int, r: String) -> + { m: Int, r: String -> val b = m + 1 println(r) f(b) } - val g: (Int, String) -> Unit = { (a, b) -> + val g: (Int, String) -> Unit = { a, b -> val m = a + 1 println(b) f(m) diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt.match index 21f65eab6ed..7f1df88f983 100644 --- a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt.match +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/multipleParamsRuntime.kt.match @@ -1,16 +1,16 @@ -{ (n: Int, s: String) -> +{ n: Int, s: String -> val a = n + 1 println(s) f(a) } -{ (m: Int, r: String) -> +{ m: Int, r: String -> val b = m + 1 println(r) f(b) } -{ (a, b) -> +{ a, b -> val m = a + 1 println(b) f(m) diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt index 64b58749d51..1586cbd6c04 100644 --- a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt @@ -1,5 +1,5 @@ fun foo(f: (Int) -> Unit) { - { (n: Int) -> + { n: Int -> val a = n + 1 f(a) } @@ -9,7 +9,7 @@ fun foo(f: (Int) -> Unit) { f(a) } - { (m: Int) -> + { m: Int -> val b = m + 1 f(b) } diff --git a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match index 00336007eab..d7093ac008f 100644 --- a/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match +++ b/idea/testData/unifier/equivalence/declarations/localCallables/lambdas/singleParam.kt.match @@ -1,4 +1,4 @@ -{ (n: Int) -> +{ n: Int -> val a = n + 1 f(a) } @@ -8,7 +8,7 @@ f(a) } -{ (m: Int) -> +{ m: Int -> val b = m + 1 f(b) } diff --git a/idea/testData/unifier/equivalence/types/function2.kt b/idea/testData/unifier/equivalence/types/function2.kt index d48c0606304..78250768f61 100644 --- a/idea/testData/unifier/equivalence/types/function2.kt +++ b/idea/testData/unifier/equivalence/types/function2.kt @@ -1,11 +1,11 @@ -val a: Function2 = { (a, b) -> "" } -val b: kotlin.Function2 = { (a, b) -> "" } -val c: (Any, Int) -> String = { (a, b) -> "" } -val d: (a: Any, n: Int) -> kotlin.String = { (a, b) -> "" } +val a: Function2 = { a, b -> "" } +val b: kotlin.Function2 = { a, b -> "" } +val c: (Any, Int) -> String = { a, b -> "" } +val d: (a: Any, n: Int) -> kotlin.String = { a, b -> "" } val e: (String) -> Int = { 0 } val f: () -> Int = { 0 } val g: Any.(Int) -> String = { "" } val h: Int.(Any) -> String = { "" } -val i: ExtensionFunction2 = { (a, b) -> "" } -val j: (t: Any, u: Int) -> kotlin.String = {(a, b) -> "" } +val i: ExtensionFunction2 = { a, b -> "" } +val j: (t: Any, u: Int) -> kotlin.String = { a, b -> "" } val k: ExtensionFunction1 = { "" } \ No newline at end of file diff --git a/js/js.translator/testData/dataClass/cases/hashcode.kt b/js/js.translator/testData/dataClass/cases/hashcode.kt index 0483105b300..005ed650834 100644 --- a/js/js.translator/testData/dataClass/cases/hashcode.kt +++ b/js/js.translator/testData/dataClass/cases/hashcode.kt @@ -32,7 +32,7 @@ fun assertAllEqual(c: Iterable) { val hashCoder: (o: Any) -> Int = { o -> o.hashCode() } -val wrapInH = { (t: T) -> Holder(t) } +val wrapInH = { t: T -> Holder(t) } fun box(): String { diff --git a/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt b/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt index 3184d92f26a..d5cf02c093d 100644 --- a/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt +++ b/js/js.translator/testData/expression/compareTo/cases/customCompareToMethod.kt @@ -7,7 +7,7 @@ class A(val value: Int) : Comparable { class B(val value: Int) fun testExtensionFunctionAsCompareTo() { - val compareTo: B.( B ) -> Int = { (other) -> other.value compareTo this.value } + val compareTo: B.( B ) -> Int = { other -> other.value compareTo this.value } val x: B = B(100) val y: B = B(200) diff --git a/js/js.translator/testData/expression/function/cases/adderClosure.kt b/js/js.translator/testData/expression/function/cases/adderClosure.kt index 95c35b5a10b..6444866af46 100644 --- a/js/js.translator/testData/expression/function/cases/adderClosure.kt +++ b/js/js.translator/testData/expression/function/cases/adderClosure.kt @@ -2,7 +2,7 @@ package foo fun box(): Boolean { var sum = 0 - val adder = {(a: Int) -> sum += a } + val adder = { a: Int -> sum += a } adder(3) adder(2) return sum == 5 diff --git a/js/js.translator/testData/expression/function/cases/closureWithParameter.kt b/js/js.translator/testData/expression/function/cases/closureWithParameter.kt index 5d19a82d6bb..bb883924dd3 100644 --- a/js/js.translator/testData/expression/function/cases/closureWithParameter.kt +++ b/js/js.translator/testData/expression/function/cases/closureWithParameter.kt @@ -1,7 +1,7 @@ package foo fun box(): String { - return apply("OK", {(arg: String) -> arg }) + return apply("OK", { arg: String -> arg }) } fun apply(arg: String, f: (p: String) -> String): String { diff --git a/js/js.translator/testData/expression/function/cases/closureWithParameterAndBoxing.kt b/js/js.translator/testData/expression/function/cases/closureWithParameterAndBoxing.kt index ba9bc917b46..ffe0fd7c6bb 100644 --- a/js/js.translator/testData/expression/function/cases/closureWithParameterAndBoxing.kt +++ b/js/js.translator/testData/expression/function/cases/closureWithParameterAndBoxing.kt @@ -1,7 +1,7 @@ package foo fun box(): String { - return if (apply(5, {(arg: Int) -> arg + 13 }) == 18) "OK" else "fail" + return if (apply(5, { arg: Int -> arg + 13 }) == 18) "OK" else "fail" } fun apply(arg: Int, f: (p: Int) -> Int): Int { diff --git a/js/js.translator/testData/expression/function/cases/enclosingThis.kt b/js/js.translator/testData/expression/function/cases/enclosingThis.kt index 3049151e56d..9b7262ba066 100644 --- a/js/js.translator/testData/expression/function/cases/enclosingThis.kt +++ b/js/js.translator/testData/expression/function/cases/enclosingThis.kt @@ -2,7 +2,7 @@ package foo class Point(val x: Int, val y: Int) { fun mul(): (scalar: Int) -> Point { - return {(scalar: Int): Point -> Point(x * scalar, y * scalar) } + return { scalar: Int -> Point(x * scalar, y * scalar) } } } diff --git a/js/js.translator/testData/expression/function/cases/expressionAsFunction.kt b/js/js.translator/testData/expression/function/cases/expressionAsFunction.kt index de37da41096..2939bfd8e17 100644 --- a/js/js.translator/testData/expression/function/cases/expressionAsFunction.kt +++ b/js/js.translator/testData/expression/function/cases/expressionAsFunction.kt @@ -2,8 +2,8 @@ package foo import java.util.*; -val d = {(a: Int) -> a + 1 } -val p = {(a: Int) -> a * 3 } +val d = { a: Int -> a + 1 } +val p = { a: Int -> a * 3 } val list = ArrayList>(); @@ -35,7 +35,7 @@ fun box(): Boolean { if (chain(2) != -19) { return false; } - if (({(a: Int) -> a * a }(3)) != 9) { + if (({ a: Int -> a * a }(3)) != 9) { return false; } return true; diff --git a/js/js.translator/testData/expression/function/cases/functionExpression.kt b/js/js.translator/testData/expression/function/cases/functionExpression.kt index 0cef74c369f..2914b6858dc 100644 --- a/js/js.translator/testData/expression/function/cases/functionExpression.kt +++ b/js/js.translator/testData/expression/function/cases/functionExpression.kt @@ -10,7 +10,7 @@ fun Int.foo2(): (i: Int) -> Int { fun fooT1(t: T) = { t.toString() } -fun fooT2(t: T) = {(x: T) -> t.toString() + x.toString() } +fun fooT2(t: T) = { x: T -> t.toString() + x.toString() } fun box(): Any? { if ( (10.foo1())() != "23910") return "foo1 fail" @@ -18,7 +18,7 @@ fun box(): Any? { if (1.{ Int.() -> this + 1 }() != 2) return "test 3 failed"; if ( { 1 }() != 1) return "test 4 failed"; - if ( {(x: Int) -> x }(1) != 1) return "test 5 failed"; + if ( { x: Int -> x }(1) != 1) return "test 5 failed"; if ( 1.{ Int.(x: Int) -> x + this }(1) != 2) return "test 6 failed"; val tmp = 1.({ Int.() -> this })() if (+tmp != 1) return "test 7 failed, res: $tmp ${tmp is Int}"; diff --git a/js/js.translator/testData/expression/function/cases/functionLiteral.kt b/js/js.translator/testData/expression/function/cases/functionLiteral.kt index a86c1cc194f..cb4f36cfaf3 100644 --- a/js/js.translator/testData/expression/function/cases/functionLiteral.kt +++ b/js/js.translator/testData/expression/function/cases/functionLiteral.kt @@ -2,7 +2,7 @@ package foo fun box(): Boolean { var sum = 0 - val addFive = {(a: Int) -> a + 5 } + val addFive = { a: Int -> a + 5 } sum = addFive(sum) return sum == 5 } \ No newline at end of file diff --git a/js/js.translator/testData/expression/function/cases/functionLiteralAsLastParameter.kt b/js/js.translator/testData/expression/function/cases/functionLiteralAsLastParameter.kt index 5d66d96ca70..15a03e8b867 100644 --- a/js/js.translator/testData/expression/function/cases/functionLiteralAsLastParameter.kt +++ b/js/js.translator/testData/expression/function/cases/functionLiteralAsLastParameter.kt @@ -8,7 +8,7 @@ fun box(): Boolean { it + 2 } != 3) return false - if (f() {(a: Int) -> a * 300 } != 300) return false; + if (f() { a: Int -> a * 300 } != 300) return false; return true } \ No newline at end of file diff --git a/js/js.translator/testData/expression/function/cases/functionLiteralAsParameter.kt b/js/js.translator/testData/expression/function/cases/functionLiteralAsParameter.kt index 152291558e7..6f63b219417 100644 --- a/js/js.translator/testData/expression/function/cases/functionLiteralAsParameter.kt +++ b/js/js.translator/testData/expression/function/cases/functionLiteralAsParameter.kt @@ -6,5 +6,5 @@ fun apply(f: (Int) -> Int, t: Int): Int { fun box(): Boolean { - return apply({(a: Int) -> a + 5 }, 3) == 8 + return apply({ a: Int -> a + 5 }, 3) == 8 } \ No newline at end of file diff --git a/js/js.translator/testData/expression/function/cases/loopClosure.kt b/js/js.translator/testData/expression/function/cases/loopClosure.kt index a2dc580a167..3367598cd30 100644 --- a/js/js.translator/testData/expression/function/cases/loopClosure.kt +++ b/js/js.translator/testData/expression/function/cases/loopClosure.kt @@ -5,7 +5,7 @@ var b = 0 fun loop(times: Int) { var left = times while (left > 0) { - val u = {(value: Int) -> + val u = { value: Int -> b = b + 1 } u(left--) diff --git a/js/js.translator/testData/expression/function/cases/manglingStability.kt b/js/js.translator/testData/expression/function/cases/manglingStability.kt index f8a8cf15e71..7b22fbc03f2 100644 --- a/js/js.translator/testData/expression/function/cases/manglingStability.kt +++ b/js/js.translator/testData/expression/function/cases/manglingStability.kt @@ -134,8 +134,8 @@ trait TestPublicInTrait { public fun boo(): Int = 2 } -val public_in_trait_f = { (obj: TestPublicInTrait) -> obj.foo() + obj.foo } -val public_in_trait_b = { (obj: TestPublicInTrait) -> obj.boo() + obj.boo } +val public_in_trait_f = { obj: TestPublicInTrait -> obj.foo() + obj.foo } +val public_in_trait_b = { obj: TestPublicInTrait -> obj.boo() + obj.boo } trait TestInternalInTrait { fun foo(): Int = 2 @@ -144,8 +144,8 @@ trait TestInternalInTrait { fun boo(): Int = 2 } -val internal_in_trait_f = { (obj: TestInternalInTrait) -> obj.foo() + obj.foo } -val internal_in_trait_b = { (obj: TestInternalInTrait) -> obj.boo() + obj.boo } +val internal_in_trait_f = { obj: TestInternalInTrait -> obj.foo() + obj.foo } +val internal_in_trait_b = { obj: TestInternalInTrait -> obj.boo() + obj.boo } //Testing diff --git a/js/js.translator/testData/expression/invoke/cases/explicitInvokeLambda.kt b/js/js.translator/testData/expression/invoke/cases/explicitInvokeLambda.kt index 972c8faa2b0..f18f2d90a43 100644 --- a/js/js.translator/testData/expression/invoke/cases/explicitInvokeLambda.kt +++ b/js/js.translator/testData/expression/invoke/cases/explicitInvokeLambda.kt @@ -1,6 +1,6 @@ package foo fun box(): String { - var foo = {(x: String) -> x + "K" } + var foo = { x: String -> x + "K" } return foo.invoke("O") } \ No newline at end of file diff --git a/js/js.translator/testData/expression/invoke/cases/invokeInFunctionLiteral.kt b/js/js.translator/testData/expression/invoke/cases/invokeInFunctionLiteral.kt index a719663d7b3..113a93b0c21 100644 --- a/js/js.translator/testData/expression/invoke/cases/invokeInFunctionLiteral.kt +++ b/js/js.translator/testData/expression/invoke/cases/invokeInFunctionLiteral.kt @@ -1,9 +1,9 @@ package foo fun box(): Boolean { - val v1 = {(x: Int) -> x}(2) + val v1 = { x: Int -> x}(2) - val f = {(x: Int) -> x} + val f = { x: Int -> x} val v2 = (f)(2) return v1 == 2 && v2 == 2 diff --git a/js/js.translator/testData/expression/invoke/cases/invokeOnExprByConvention.kt b/js/js.translator/testData/expression/invoke/cases/invokeOnExprByConvention.kt index 54c5a729f79..b18ca3e1f19 100644 --- a/js/js.translator/testData/expression/invoke/cases/invokeOnExprByConvention.kt +++ b/js/js.translator/testData/expression/invoke/cases/invokeOnExprByConvention.kt @@ -13,7 +13,7 @@ fun box(): String { if (foo()() != "##") return "fail3" if (foo()(42) != "#42") return "fail4" if ((foo())(42) != "#42") return "fail5" - if ({() -> A()}()() != "##") return "fail6" - if ({() -> A()}()(37) != "#37") return "fail7" + if ({ -> A()}()() != "##") return "fail6" + if ({ -> A()}()(37) != "#37") return "fail7" return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/extensionFunction/cases/generic.kt b/js/js.translator/testData/extensionFunction/cases/generic.kt index b50c4593496..109cb27641c 100644 --- a/js/js.translator/testData/extensionFunction/cases/generic.kt +++ b/js/js.translator/testData/extensionFunction/cases/generic.kt @@ -19,6 +19,6 @@ fun box(): String { list.add(5) - val m: ArrayList = list.findAll({(name: Int) -> name < 4 }) + val m: ArrayList = list.findAll({ name: Int -> name < 4 }) return if (m.size() == 2) "OK" else "fail" } diff --git a/js/js.translator/testData/inline/cases/extension.kt b/js/js.translator/testData/inline/cases/extension.kt index 00d7ce36eb7..6be7b29df66 100644 --- a/js/js.translator/testData/inline/cases/extension.kt +++ b/js/js.translator/testData/inline/cases/extension.kt @@ -26,18 +26,18 @@ class Inline(val res: Int) { } fun doWork(l : InlineX) : Int { - return l.calcInt({(a: Int, b: Int) -> a + b}) + return l.calcInt({ a: Int, b: Int -> a + b}) } fun doWorkWithDouble(s : Double) : Double { - return s.calcDouble({(a: Int, b: Double) -> a + b}) + return s.calcDouble({ a: Int, b: Double -> a + b}) } } fun test1(): Int { val inlineX = Inline(9) - return inlineX.calcExt({(z: Int) -> z}, 25) + return inlineX.calcExt({ z: Int -> z}, 25) } fun test2(): Int { @@ -58,7 +58,7 @@ fun test4(): Double { fun test5(): Double { val inlineX = Inline(9) with(inlineX) { - 11.0.calcDouble{(a: Int, b: Double) -> a + b} + 11.0.calcDouble{ a: Int, b: Double -> a + b} } return inlineX.doWorkWithDouble(11.0) } diff --git a/js/js.translator/testData/inline/cases/extensionWithManyArguments.kt b/js/js.translator/testData/inline/cases/extensionWithManyArguments.kt index fe035ccf889..8b71e60cbc4 100644 --- a/js/js.translator/testData/inline/cases/extensionWithManyArguments.kt +++ b/js/js.translator/testData/inline/cases/extensionWithManyArguments.kt @@ -6,7 +6,7 @@ class A(val a: Int) inline fun with2(receiver: T, arg1: R, arg2: R, f: T.(R, R) -> R): R = receiver.f(arg1, arg2) -fun multiply(a: Int, b: Int, c: Int): Int = with2(A(a), b, c) { (x, y) -> a*x*y } +fun multiply(a: Int, b: Int, c: Int): Int = with2(A(a), b, c) { x, y -> a*x*y } fun box(): String { assertEquals(105, multiply(3, 5, 7)) diff --git a/js/js.translator/testData/inline/cases/inlineFunctionInLambda.kt b/js/js.translator/testData/inline/cases/inlineFunctionInLambda.kt index 69dfa16927c..2af4cbab4fa 100644 --- a/js/js.translator/testData/inline/cases/inlineFunctionInLambda.kt +++ b/js/js.translator/testData/inline/cases/inlineFunctionInLambda.kt @@ -11,7 +11,7 @@ inline fun doNothing2(a: T, inline f: (T) -> T): T { } fun doNothingNoInline(a: Int): Int { - return doNothing2(a, {(x) -> doNothing1(x)}) + return doNothing2(a, { x -> doNothing1(x)}) } fun box(): String { diff --git a/js/js.translator/testData/inline/cases/inlineLambdaNoCapture.kt b/js/js.translator/testData/inline/cases/inlineLambdaNoCapture.kt index 072f0800632..7c8e6bf5500 100644 --- a/js/js.translator/testData/inline/cases/inlineLambdaNoCapture.kt +++ b/js/js.translator/testData/inline/cases/inlineLambdaNoCapture.kt @@ -16,7 +16,7 @@ inline fun filteredReduce(a: Array, inline predicate: (Int) -> Boolean, inl } fun sumEven(a: Array): Int { - return filteredReduce(a, {(x) -> x % 2 == 0}, {(x, y) -> x + y}) + return filteredReduce(a, { x -> x % 2 == 0}, { x, y -> x + y}) } fun box(): String { diff --git a/js/js.translator/testData/inline/cases/inlineLambdaWithCapture.kt b/js/js.translator/testData/inline/cases/inlineLambdaWithCapture.kt index 2f9048889b4..94d6901aba5 100644 --- a/js/js.translator/testData/inline/cases/inlineLambdaWithCapture.kt +++ b/js/js.translator/testData/inline/cases/inlineLambdaWithCapture.kt @@ -22,7 +22,7 @@ inline fun maxBy(a: Array, inline keyFun: (Int) -> Int): Int { fun maxBySquare(a: Array, r: Result): Result { var invocationCount = 0 - val maxVal = maxBy(a, {(x) -> invocationCount++; x * x;}) + val maxVal = maxBy(a, { x -> invocationCount++; x * x;}) r.value = maxVal r.invocationCount = invocationCount diff --git a/js/js.translator/testData/inline/cases/lambdaReassignment.kt b/js/js.translator/testData/inline/cases/lambdaReassignment.kt index 12e58d03b27..2f9fb6f1e71 100644 --- a/js/js.translator/testData/inline/cases/lambdaReassignment.kt +++ b/js/js.translator/testData/inline/cases/lambdaReassignment.kt @@ -5,14 +5,14 @@ inline fun run(func: () -> Int): Int { } fun bar(): Int { - var f = { () -> 0 } + var f = { -> 0 } var get0 = f - f = { () -> 1 } + f = { -> 1 } var get1 = f var get2 = get1 - f = { () -> 2 } + f = { -> 2 } get2 = f return run(get0) + run(get1) + run(get2) diff --git a/js/js.translator/testData/inline/cases/lambdaReassignmentWithCapture.kt b/js/js.translator/testData/inline/cases/lambdaReassignmentWithCapture.kt index 06caa58d5a9..76f654bb5e4 100644 --- a/js/js.translator/testData/inline/cases/lambdaReassignmentWithCapture.kt +++ b/js/js.translator/testData/inline/cases/lambdaReassignmentWithCapture.kt @@ -7,14 +7,14 @@ inline fun run(func: () -> Int): Int { } fun bar(p: IntPair): Int { - var f = { () -> p.fst++ } + var f = { -> p.fst++ } var get0 = f - f = { () -> ++p.snd } + f = { -> ++p.snd } var get1 = f var get2 = get1 - f = { () -> ++p.fst } + f = { -> ++p.fst } get2 = f return run(get0) + run(get1) + run(get2) diff --git a/js/js.translator/testData/inline/cases/params.kt b/js/js.translator/testData/inline/cases/params.kt index 71e8ac9d686..dea4decafc3 100644 --- a/js/js.translator/testData/inline/cases/params.kt +++ b/js/js.translator/testData/inline/cases/params.kt @@ -22,23 +22,23 @@ class Inline() { fun test1(): Int { val inlineX = Inline() - return inlineX.foo1Int({(z: Int) -> z}, 25) + return inlineX.foo1Int({ z: Int -> z}, 25) } fun test2(): Double { val inlineX = Inline() - return inlineX.foo1Double(25.0, {(z: Double) -> z}) + return inlineX.foo1Double(25.0, { z: Double -> z}) } fun test3(): Double { val inlineX = Inline() - return inlineX.foo2Param(15.0, {(z1: Int, z2: Double) -> z1 + z2}, 10) + return inlineX.foo2Param(15.0, { z1: Int, z2: Double -> z1 + z2}, 10) } fun test3WithCaptured(): Double { val inlineX = Inline() var c = 11.0; - return inlineX.foo2Param(15.0, {(z1: Int, z2: Double) -> z1 + z2 + c}, 10) + return inlineX.foo2Param(15.0, { z1: Int, z2: Double -> z1 + z2 + c}, 10) } diff --git a/js/js.translator/testData/inline/cases/severalClosures.kt b/js/js.translator/testData/inline/cases/severalClosures.kt index ce5361f200e..1772252486e 100644 --- a/js/js.translator/testData/inline/cases/severalClosures.kt +++ b/js/js.translator/testData/inline/cases/severalClosures.kt @@ -18,18 +18,18 @@ class Inline() { fun test1(): Double { val inlineX = Inline() - return inlineX.foo1({(z: Int) -> z}, 25, {(z: Double) -> z}, 11.5) + return inlineX.foo1({ z: Int -> z}, 25, { z: Double -> z}, 11.5) } fun test1WithCaptured(): Double { val inlineX = Inline() var d = 0.0; - return inlineX.foo1({(z: Int) -> d = 1.0; z}, 25, {(z: Double) -> z + d}, 11.5) + return inlineX.foo1({ z: Int -> d = 1.0; z}, 25, { z: Double -> z + d}, 11.5) } fun test2(): Double { val inlineX = Inline() - return inlineX.foo2({(z: Int, p: Int) -> z + p}, 25, {(x: Double, y: Int, z: Int) -> z + x + y}, 11.5, 2) + return inlineX.foo2({ z: Int, p: Int -> z + p}, 25, { x: Double, y: Int, z: Int -> z + x + y}, 11.5, 2) } fun box(): String { diff --git a/js/js.translator/testData/inline/cases/simpleDouble.kt b/js/js.translator/testData/inline/cases/simpleDouble.kt index b21b43a35d4..8f515ea2b64 100644 --- a/js/js.translator/testData/inline/cases/simpleDouble.kt +++ b/js/js.translator/testData/inline/cases/simpleDouble.kt @@ -31,40 +31,40 @@ class InlineDouble(val res : Double) { fun test0Param(): Double { val inlineX = InlineDouble(10.0) - return inlineX.foo({() -> 1.0}) + return inlineX.foo({ -> 1.0}) } fun test1Param(): Double { val inlineX = InlineDouble(10.0) - return inlineX.foo11({(z: Double) -> z}) + return inlineX.foo11({ z: Double -> z}) } fun test1ParamCaptured(): Double { val s = 100.0 val inlineX = InlineDouble(10.0) - return inlineX.foo11({(z: Double) -> s}) + return inlineX.foo11({ z: Double -> s}) } fun test1ParamMissed() : Double { val inlineX = InlineDouble(10.0) - return inlineX.foo11({(z: Double) -> 111.0}) + return inlineX.foo11({ z: Double -> 111.0}) } fun test1ParamFromCallContext() : Double { val inlineX = InlineDouble(1000.0) - return inlineX.fooRes({(z: Double) -> z}) + return inlineX.fooRes({ z: Double -> z}) } fun test2Params() : Double { val inlineX = InlineDouble(1000.0) - return inlineX.fooRes2({(y: Double, z: Double) -> 2.0 * y + 3.0 * z}) + return inlineX.fooRes2({ y: Double, z: Double -> 2.0 * y + 3.0 * z}) } fun test2ParamsWithCaptured() : Double { val inlineX = InlineDouble(1000.0) val s = 9.0 var t = 1.0 - return inlineX.fooRes2({(y: Double, z: Double) -> 2.0 * s + t}) + return inlineX.fooRes2({ y: Double, z: Double -> 2.0 * s + t}) } fun box(): String { diff --git a/js/js.translator/testData/inline/cases/simpleInt.kt b/js/js.translator/testData/inline/cases/simpleInt.kt index 872b868df2a..18f19be80b7 100644 --- a/js/js.translator/testData/inline/cases/simpleInt.kt +++ b/js/js.translator/testData/inline/cases/simpleInt.kt @@ -31,40 +31,40 @@ class Inline(val res : Int) { fun test0Param(): Int { val inlineX = Inline(10) - return inlineX.foo({() -> 1}) + return inlineX.foo({ -> 1}) } fun test1Param(): Int { val inlineX = Inline(10) - return inlineX.foo11({(z: Int) -> z}) + return inlineX.foo11({ z: Int -> z}) } fun test1ParamCaptured(): Int { val s = 100 val inlineX = Inline(10) - return inlineX.foo11({(z: Int) -> s}) + return inlineX.foo11({ z: Int -> s}) } fun test1ParamMissed() : Int { val inlineX = Inline(10) - return inlineX.foo11({(z: Int) -> 111}) + return inlineX.foo11({ z: Int -> 111}) } fun test1ParamFromCallContext() : Int { val inlineX = Inline(1000) - return inlineX.fooRes({(z: Int) -> z}) + return inlineX.fooRes({ z: Int -> z}) } fun test2Params() : Int { val inlineX = Inline(1000) - return inlineX.fooRes2({(y: Int, z: Int) -> 2 * y + 3 * z}) + return inlineX.fooRes2({ y: Int, z: Int -> 2 * y + 3 * z}) } fun test2ParamsWithCaptured() : Int { val inlineX = Inline(1000) val s = 9 var t = 1 - return inlineX.fooRes2({(y: Int, z: Int) -> 2 * s + t}) + return inlineX.fooRes2({ y: Int, z: Int -> 2 * s + t}) } fun box(): String { diff --git a/js/js.translator/testData/inline/cases/simpleObject.kt b/js/js.translator/testData/inline/cases/simpleObject.kt index 56888308178..7eec3eaa300 100644 --- a/js/js.translator/testData/inline/cases/simpleObject.kt +++ b/js/js.translator/testData/inline/cases/simpleObject.kt @@ -31,40 +31,40 @@ class InlineString(val res : String) { fun test0Param(): String { val inlineX = InlineString("10") - return inlineX.foo({() -> "1"}) + return inlineX.foo({ -> "1"}) } fun test1Param(): String { val inlineX = InlineString("10") - return inlineX.foo11({(z: String) -> z}) + return inlineX.foo11({ z: String -> z}) } fun test1ParamCaptured(): String { val s = "100" val inlineX = InlineString("10") - return inlineX.foo11({(z: String) -> s}) + return inlineX.foo11({ z: String -> s}) } fun test1ParamMissed() : String { val inlineX = InlineString("10") - return inlineX.foo11({(z: String) -> "111"}) + return inlineX.foo11({ z: String -> "111"}) } fun test1ParamFromCallContext() : String { val inlineX = InlineString("1000") - return inlineX.fooRes({(z: String) -> z}) + return inlineX.fooRes({ z: String -> z}) } fun test2Params() : String { val inlineX = InlineString("1000") - return inlineX.fooRes2({(y: String, z: String) -> y + "0" + z}) + return inlineX.fooRes2({ y: String, z: String -> y + "0" + z}) } fun test2ParamsWithCaptured() : String { val inlineX = InlineString("1000") val s = "9" var t = "1" - return inlineX.fooRes2({(y: String, z: String) -> s + t}) + return inlineX.fooRes2({ y: String, z: String -> s + t}) } fun box(): String { diff --git a/js/js.translator/testData/inlineMultiFile/cases/closureChain/closureChain.1.kt b/js/js.translator/testData/inlineMultiFile/cases/closureChain/closureChain.1.kt index 2bd6ccc4165..9c704d8d6af 100644 --- a/js/js.translator/testData/inlineMultiFile/cases/closureChain/closureChain.1.kt +++ b/js/js.translator/testData/inlineMultiFile/cases/closureChain/closureChain.1.kt @@ -7,7 +7,7 @@ package foo fun test1(): Int { val inlineX = Inline() - return inlineX.foo({(z: Int) -> "" + z}, 25, {String.() -> this.length}) + return inlineX.foo({ z: Int -> "" + z}, 25, {String.() -> this.length}) } fun box(): String { diff --git a/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInClass/simpleCapturingInClass.1.kt b/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInClass/simpleCapturingInClass.1.kt index c186499db43..0c2b1484cc0 100644 --- a/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInClass/simpleCapturingInClass.1.kt +++ b/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInClass/simpleCapturingInClass.1.kt @@ -8,7 +8,7 @@ package foo fun testAll(): String { val inlineX = InlineAll() - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5}, 1, 12.5, 13.5, "14", 15) } @@ -26,7 +26,7 @@ fun testAllWithCapturedVal(): String { val c8 = 27 val c9 = 28.5 - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.5, 13.5, "14", 15) } @@ -44,7 +44,7 @@ fun testAllWithCapturedVar(): String { var c8 = 27 val c9 = 28.5 - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.5, 13.5, "14", 15) } @@ -62,7 +62,7 @@ fun testAllWithCapturedValAndVar(): String { var c8 = 27 val c9 = 28.5 - return inlineX.inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inlineX.inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.5, 13.5, "14", 15) } diff --git a/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInPackage/simpleCapturingInPackage.1.kt b/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInPackage/simpleCapturingInPackage.1.kt index 75ced4a06d3..f3edd01ce79 100644 --- a/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInPackage/simpleCapturingInPackage.1.kt +++ b/js/js.translator/testData/inlineMultiFile/cases/simpleCapturingInPackage/simpleCapturingInPackage.1.kt @@ -6,7 +6,7 @@ package foo fun testAll(): String { - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5}, 1, 12.5, 13.5, "14", 15) } @@ -22,7 +22,7 @@ fun testAllWithCapturedVal(): String { val c8 = 27 val c9 = 28.5 - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.5, 13.5, "14", 15) } @@ -38,7 +38,7 @@ fun testAllWithCapturedVar(): String { var c8 = 27 val c9 = 28.5 - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.5, 13.5, "14", 15) } @@ -54,7 +54,7 @@ fun testAllWithCapturedValAndVar(): String { var c8 = 27 val c9 = 28.5 - return inline({(a1: Int, a2: Double, a3: Double, a4: String, a5: Long) -> + return inline({ a1: Int, a2: Double, a3: Double, a4: String, a5: Long -> "" + a1 + a2 + a3 + a4 + a5 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9}, 1, 12.5, 13.5, "14", 15) } diff --git a/js/js.translator/testData/inlineMultiFile/cases/tryCatch2/tryCatch2.1.kt b/js/js.translator/testData/inlineMultiFile/cases/tryCatch2/tryCatch2.1.kt index 084d7644d2f..e6dccaf21bd 100644 --- a/js/js.translator/testData/inlineMultiFile/cases/tryCatch2/tryCatch2.1.kt +++ b/js/js.translator/testData/inlineMultiFile/cases/tryCatch2/tryCatch2.1.kt @@ -24,7 +24,7 @@ fun test11(): Int { throw RuntimeExceptionWithValue("2") } }, - {(ex, thizz) -> + { ex, thizz -> if (ex.value == "2") { thizz.value } else { @@ -55,7 +55,7 @@ fun test22(): Int { 111 } }, - {(ex, thizz) -> + { ex, thizz -> -11111 }) @@ -87,7 +87,7 @@ fun test33(): Int { throw RuntimeExceptionWithValue("-2") } }, - {(ex, thizz) -> + { ex, thizz -> if (ex.value == "-2") { throw RuntimeExceptionWithValue("-3") } else { diff --git a/js/js.translator/testData/inlineMultiFile/cases/tryCatchFinally/tryCatchFinally.1.kt b/js/js.translator/testData/inlineMultiFile/cases/tryCatchFinally/tryCatchFinally.1.kt index ac8d9766fde..e3cd5b1aa7d 100644 --- a/js/js.translator/testData/inlineMultiFile/cases/tryCatchFinally/tryCatchFinally.1.kt +++ b/js/js.translator/testData/inlineMultiFile/cases/tryCatchFinally/tryCatchFinally.1.kt @@ -55,7 +55,7 @@ fun test3(): Int { result = it.value; throw RuntimeException("-1") }, - { (e, z)-> + { e, z -> ++result throw RuntimeException("-2") }, diff --git a/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt b/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt index c1ada1f4fee..799046fd500 100644 --- a/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt +++ b/js/js.translator/testData/inlineStdlib/cases/closureInObjectLiteral.kt @@ -4,7 +4,7 @@ val Int.abs: Int get() = if (this >= 0) this else -this fun test(xs: List): List = - xs.sortBy(comparator {(a, b) -> a.abs.compareTo(b.abs) }) + xs.sortBy(comparator { a, b -> a.abs.compareTo(b.abs) }) fun box(): String { assertEquals(listOf(1, -2, 3, -4), test(listOf(-2, 1, -4, 3))) diff --git a/js/js.translator/testData/jsCode/cases/function.kt b/js/js.translator/testData/jsCode/cases/function.kt index 43655cb484a..4828e7d7478 100644 --- a/js/js.translator/testData/jsCode/cases/function.kt +++ b/js/js.translator/testData/jsCode/cases/function.kt @@ -5,7 +5,7 @@ fun callWithArgs(sumFunc: (Int, Int) -> Int, a: Int, b: Int): Int { } fun box(): String { - val kotlinSum: (Int, Int) -> Int = {(a, b) -> a + b} + val kotlinSum: (Int, Int) -> Int = { a, b -> a + b} val jsSum: (Int, Int) -> Int = js("function (a, b) { return a + b; }") assertEquals(callWithArgs(kotlinSum, 1, 2), callWithArgs(jsSum, 1, 2)) diff --git a/js/js.translator/testData/jsCode/cases/invocation.kt b/js/js.translator/testData/jsCode/cases/invocation.kt index 6301f928cf3..72c6e346bbb 100644 --- a/js/js.translator/testData/jsCode/cases/invocation.kt +++ b/js/js.translator/testData/jsCode/cases/invocation.kt @@ -3,7 +3,7 @@ package foo fun run(a: A, b: B, func: (A, B) -> C): C = js("func(a, b)") fun box(): String { - assertEquals(3, run(1, 2) {(a, b) -> a + b}) + assertEquals(3, run(1, 2) { a, b -> a + b}) return "OK" } \ No newline at end of file diff --git a/js/js.translator/testData/standardClasses/cases/arrayFunctionConstructor.kt b/js/js.translator/testData/standardClasses/cases/arrayFunctionConstructor.kt index 47e5b533dbe..7f6fe37c0e6 100644 --- a/js/js.translator/testData/standardClasses/cases/arrayFunctionConstructor.kt +++ b/js/js.translator/testData/standardClasses/cases/arrayFunctionConstructor.kt @@ -1,6 +1,6 @@ package foo -val f = {(i: Int) -> i + 1 } +val f = { i: Int -> i + 1 } val a = Array(3, f) diff --git a/js/js.translator/testData/standardClasses/cases/arraysIterator.kt b/js/js.translator/testData/standardClasses/cases/arraysIterator.kt index 6a8c0a37c6c..da9908c454f 100644 --- a/js/js.translator/testData/standardClasses/cases/arraysIterator.kt +++ b/js/js.translator/testData/standardClasses/cases/arraysIterator.kt @@ -1,6 +1,6 @@ package foo -val a1 = Array(3, {(i: Int) -> i }) +val a1 = Array(3, { i: Int -> i }) fun box(): Boolean { val i = a1.iterator()