diff --git a/compiler/testData/codegen/box/functions/kt1038.kt b/compiler/testData/codegen/box/functions/kt1038.kt index 5c7046bfa41..d8c46c35b15 100644 --- a/compiler/testData/codegen/box/functions/kt1038.kt +++ b/compiler/testData/codegen/box/functions/kt1038.kt @@ -58,7 +58,7 @@ fun box() : String { val filtered = x where { it % 2 == 0 } val xx = x select { it * 2 } var res = 0 - for (val x in xx) + for (x in xx) res += x return if (res == 10100) "OK" else "fail" } diff --git a/compiler/testData/codegen/box/functions/nothisnoclosure.kt b/compiler/testData/codegen/box/functions/nothisnoclosure.kt index 6ff90a22afa..68369ae57eb 100644 --- a/compiler/testData/codegen/box/functions/nothisnoclosure.kt +++ b/compiler/testData/codegen/box/functions/nothisnoclosure.kt @@ -1,11 +1,12 @@ fun foo(x: Int) {} -fun loop(var times : Int) { - while(times > 0) { +fun loop(times : Int) { + var left = times + while(left > 0) { val u : (value : Int) -> Unit = { foo(it) } - u(times--) + u(left--) } } diff --git a/compiler/testData/codegen/box/objects/objectLiteral.kt b/compiler/testData/codegen/box/objects/objectLiteral.kt index ca3f96cf336..8f06b7242a6 100644 --- a/compiler/testData/codegen/box/objects/objectLiteral.kt +++ b/compiler/testData/codegen/box/objects/objectLiteral.kt @@ -1,5 +1,6 @@ class C(x: Int, val y : Int) { - fun initChild(var x: Int) : java.lang.Object { + fun initChild(x0: Int) : java.lang.Object { + var x = x0 return object : java.lang.Object() { override fun toString(): String? { x = x + y diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt b/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt index 5b27d7fb271..daf0fc7291e 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/generic.kt @@ -2,7 +2,7 @@ import java.util.* fun ArrayList.findAll(predicate: (T) -> Boolean): ArrayList { val result = ArrayList() - for(val t in this) { + for(t in this) { if (predicate(t)) result.add(t) } return result diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/kt344.kt b/compiler/testData/codegen/boxWithStdlib/regressions/kt344.kt index cdec9809fde..63bb6247617 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/kt344.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/kt344.kt @@ -126,7 +126,8 @@ fun t8() : Boolean { return x == 30.toShort() } -fun t9(var x: Int) : Boolean { +fun t9(x0: Int) : Boolean { + var x = x0 while(x < 100) { x++ } @@ -145,7 +146,8 @@ fun t10() : Boolean { return y == 2 } -fun t11(var x: Int) : Int { +fun t11(x0: Int) : Int { + var x = x0 val foo = { x = x + 1 val bar = { diff --git a/compiler/testData/codegen/notNullAssertions/AssertionChecker.kt b/compiler/testData/codegen/notNullAssertions/AssertionChecker.kt index 0df80e8bc42..da58066e402 100644 --- a/compiler/testData/codegen/notNullAssertions/AssertionChecker.kt +++ b/compiler/testData/codegen/notNullAssertions/AssertionChecker.kt @@ -23,7 +23,7 @@ class Delegated : Tr by Derived() { } -fun checkAssertions(val illegalStateExpected: Boolean) { +fun checkAssertions(illegalStateExpected: Boolean) { val check = AssertionChecker(illegalStateExpected) // simple call diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.kt b/compiler/testData/diagnostics/tests/LValueAssignment.kt index 9acf7d52c6c..4c665730dcb 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.kt +++ b/compiler/testData/diagnostics/tests/LValueAssignment.kt @@ -38,7 +38,9 @@ class D() { fun foo(): Unit {} -fun cannotBe(var i: Int) { +fun cannotBe() { + var i: Int = 5 + z = 30; "" = ""; foo() = Unit.VALUE; @@ -49,7 +51,8 @@ fun cannotBe(var i: Int) { 5 = 34 } -fun canBe(var i: Int, val j: Int) { +fun canBe(i0: Int, j: Int) { + var i = i0 (i: Int) = 36 (@label i) = 34 @@ -60,7 +63,7 @@ fun canBe(var i: Int, val j: Int) { (@ a.a) = 3894 } -fun canBe2(val j: Int) { +fun canBe2(j: Int) { (@label j) = 34 } diff --git a/compiler/testData/diagnostics/tests/NamespaceQualified.kt b/compiler/testData/diagnostics/tests/NamespaceQualified.kt index 15165141c9b..7383ffbc43e 100644 --- a/compiler/testData/diagnostics/tests/NamespaceQualified.kt +++ b/compiler/testData/diagnostics/tests/NamespaceQualified.kt @@ -56,12 +56,13 @@ abstract class Sum() : Iteratee() { } abstract class Collection : Iterable { - fun iterate(var iteratee : Iteratee) : O { + fun iterate(iteratee : Iteratee) : O { + var current = iteratee for (x in this) { - val it = iteratee.process(x) + val it = current.process(x) if (it.isDone) return it.result - iteratee = it + current = it } - return iteratee.done() + return current.done() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.kt index 9025136d100..240395309b8 100644 --- a/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.kt @@ -53,10 +53,8 @@ fun t2() { class A() {} -fun t4(a: A, val b: A, var c: A) { +fun t4(a: A) { a = A() - b = A() - c = A() } // ------------------------------------------------ @@ -190,7 +188,7 @@ class AnonymousInitializers(var a: String, val b: String) { } } -fun reassignFunParams(val a: Int) { +fun reassignFunParams(a: Int) { a = 1 } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1219.1301.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1219.1301.kt index 89b7e3346ca..6e975f1d8f9 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1219.1301.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1219.1301.kt @@ -2,7 +2,8 @@ package kt1219 -fun Iterable.fold(var r: R, op: (T, R) -> R) : R { +fun Iterable.fold(a: R, op: (T, R) -> R) : R { + var r = a this.foreach { r = op(it, r) } //unused value here return r } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt index c7771924632..039faed8588 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt @@ -2,8 +2,9 @@ package kt609 -fun test(var a: Int) { - a = 324 //should be an 'unused value' warning here +fun test(a: Int) { + var aa = a + aa = 324 //should be an 'unused value' warning here } class C() { @@ -16,4 +17,4 @@ open class A() { class B() : A() { final override fun foo(s : String) {} //should not be a warning -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Assignment.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Assignment.kt index 0429a49d37a..ef3dc45a9f6 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Assignment.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/Assignment.kt @@ -3,15 +3,15 @@ trait B : A { fun foo() } -fun bar1(a: A, var b: B) { - b = a as B +fun bar1(a: A) { + var b: B = a as B a.foo() b.foo() } fun id(b: B) = b -fun bar2(a: A, var b: B) { - b = id(a as B) +fun bar2(a: A) { + var b: B = id(a as B) a.foo() b.foo() } diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/AssignmentOperation.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/AssignmentOperation.kt index ff349f770f7..98b9e7d4c08 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/AssignmentOperation.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/AssignmentOperation.kt @@ -1,5 +1,6 @@ -fun bar1(x: Number, var y: Int) { - y += x as Int +fun bar1(x: Number, y: Int) { + var yy = y + yy += x as Int x : Int } diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/DoWhileCondition.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/DoWhileCondition.kt index 9b69655cacf..f9024de80d7 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/DoWhileCondition.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/DoWhileCondition.kt @@ -1,4 +1,5 @@ -fun simpleDoWhile(x: Int?, var y: Int) { +fun simpleDoWhile(x: Int?, y0: Int) { + var y = y0 do { x : Int? y++ @@ -6,7 +7,8 @@ fun simpleDoWhile(x: Int?, var y: Int) { x : Int } -fun doWhileWithBreak(x: Int?, var y: Int) { +fun doWhileWithBreak(x: Int?, y0: Int) { + var y = y0 do { x : Int? y++ diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/WhileCondition.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/WhileCondition.kt index 327fe97329c..32e54cb159f 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/WhileCondition.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/WhileCondition.kt @@ -1,4 +1,5 @@ -fun simpleWhile(x: Int?, var y: Int) { +fun simpleWhile(x: Int?, y0: Int) { + var y = y0 while (x!! == y) { x : Int y++ @@ -6,7 +7,8 @@ fun simpleWhile(x: Int?, var y: Int) { x : Int } -fun whileWithBreak(x: Int?, var y: Int) { +fun whileWithBreak(x: Int?, y0: Int) { + var y = y0 while (x!! == y) { x : Int break diff --git a/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt b/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt index dfc84dac01a..9825f1375f2 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/SupertypeOfErrorType.kt @@ -15,7 +15,7 @@ fun foo() { } } -fun bar(val i: Int, val a: U) { +fun bar(i: Int, a: U) { val r = if (true) i else a val b: Any = r } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt index f12b3c06652..623409b3a04 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1410.kt @@ -11,11 +11,11 @@ public fun MutableCollection.filterToMy(result : MutableList, f return this } -fun foo(result: MutableList, val collection: MutableCollection, prefix : String){ +fun foo(result: MutableList, collection: MutableCollection, prefix : String){ collection.filterToMy(result, {it.startsWith(prefix)}) } -fun test(result: MutableList, val collection: MutableCollection, prefix : String){ +fun test(result: MutableList, collection: MutableCollection, prefix : String){ val c = collection.filterToMy(result, {it.startsWith(prefix)}) c: MutableCollection } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt index e2e3b2c715b..a8361880bb3 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1558.kt @@ -3,7 +3,7 @@ package j fun T?.sure() : T = this!! -fun testArrays(val ci: List, val cii: List?) { +fun testArrays(ci: List, cii: List?) { val c1: Array = cii.sure().toArray(Array) val c2: Array = ci.toArray(Array()) diff --git a/compiler/testData/diagnostics/tests/infos/Autocasts.kt b/compiler/testData/diagnostics/tests/infos/Autocasts.kt index 2c9a490a006..22751137e1c 100644 --- a/compiler/testData/diagnostics/tests/infos/Autocasts.kt +++ b/compiler/testData/diagnostics/tests/infos/Autocasts.kt @@ -210,7 +210,8 @@ fun f(): String { return "" } -fun foo(var a: Any): Int { +fun foo(aa: Any): Int { + var a = aa if (a is Int) { return a } diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.kt index b9d90ddbb5f..20f3c7dd167 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/IteratorAmbiguity.kt @@ -22,6 +22,6 @@ class MyElement fun test1(collection: MyCollection) { collection.iterator() - for (val element in collection) { + for (element in collection) { } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt index 1c24007fa5d..e6299c6f135 100644 --- a/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt +++ b/compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt @@ -43,7 +43,7 @@ fun main(args: Array) { val numbers = ArrayList(4) val rnd = Random(); val prompt = StringBuilder() - for(val i in 0..3) { + for(i in 0..3) { val n = rnd.nextInt(9) + 1 numbers.add(n) if (i > 0) prompt.append(" "); diff --git a/compiler/testData/diagnostics/tests/regressions/Jet72.kt b/compiler/testData/diagnostics/tests/regressions/Jet72.kt index 984bede40d7..0943fd5a2d8 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet72.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet72.kt @@ -9,7 +9,7 @@ abstract class Item(val room: Object) { val items: ArrayList = ArrayList() fun test(room : Object) { - for(val item: Item? in items) { + for(item: Item? in items) { if (item?.room === room) { System.out.println("You see " + item?.name) } diff --git a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java index 6163aa8619b..1e7a401354a 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java @@ -185,25 +185,25 @@ public class PrimitiveTypesTest extends CodegenTestCase { } public void testPreDecrement() throws Exception { - loadText("fun foo(var a: Int): Int { return --a;}"); + loadText("fun foo(a0: Int): Int { var a = a0; return --a;}"); final Method main = generateFunction(); assertEquals(9, main.invoke(null, 10)); } public void testPreIncrementLong() throws Exception { - loadText("fun foo(var a: Long): Long = ++a"); + loadText("fun foo(a0: Long): Long { var a = a0; return ++a}"); final Method main = generateFunction(); assertEquals(11L, main.invoke(null, 10L)); } public void testPreIncrementFloat() throws Exception { - loadText("fun foo(var a: Float): Float = ++a"); + loadText("fun foo(a0: Float): Float { var a = a0; return ++a }"); final Method main = generateFunction(); assertEquals(2.0f, main.invoke(null, 1.0f)); } public void testPreIncrementDouble() throws Exception { - loadText("fun foo(var a: Double): Double = ++a"); + loadText("fun foo(a0: Double): Double {var a = a0; return ++a }"); final Method main = generateFunction(); assertEquals(2.0, main.invoke(null, 1.0)); } diff --git a/idea/testData/checker/NamespaceQualified.kt b/idea/testData/checker/NamespaceQualified.kt index b70861f06ee..e0f8f27b80c 100644 --- a/idea/testData/checker/NamespaceQualified.kt +++ b/idea/testData/checker/NamespaceQualified.kt @@ -31,12 +31,13 @@ abstract class Sum() : Iteratee() { } abstract class Collection : Iterable { - fun iterate(var iteratee : Iteratee) : O { + fun iterate(iteratee : Iteratee) : O { + var current = iteratee for (x in this) { - val it = iteratee.process(x) + val it = current.process(x) if (it.isDone) return it.result - iteratee = it + current = it } - return iteratee.done() + return current.done() } } \ No newline at end of file diff --git a/idea/testData/checker/infos/Autocasts.kt b/idea/testData/checker/infos/Autocasts.kt index 13989701350..4f2ea844895 100644 --- a/idea/testData/checker/infos/Autocasts.kt +++ b/idea/testData/checker/infos/Autocasts.kt @@ -206,7 +206,8 @@ fun f(): String { return "" } -fun foo(var a: Any): Int { +fun foo(aa: Any): Int { + var a = aa if (a is Int) { return a } diff --git a/idea/testData/checker/regression/DoubleDefine.kt b/idea/testData/checker/regression/DoubleDefine.kt index e8d9f0da451..8baa2ef4107 100644 --- a/idea/testData/checker/regression/DoubleDefine.kt +++ b/idea/testData/checker/regression/DoubleDefine.kt @@ -42,7 +42,7 @@ fun main(args: Array) { val numbers = ArrayList(4) val rnd = Random(); val prompt = StringBuilder() - for(val i in 0..3) { + for(i in 0..3) { val n = rnd.nextInt(9) + 1 numbers.add(n) if (i > 0) prompt.append(" "); diff --git a/idea/testData/checker/regression/Jet72.kt b/idea/testData/checker/regression/Jet72.kt index 183f0c26bd7..0e08d7e23a5 100644 --- a/idea/testData/checker/regression/Jet72.kt +++ b/idea/testData/checker/regression/Jet72.kt @@ -9,7 +9,7 @@ abstract class Item(val room: Object) { val items: ArrayList = ArrayList() fun test(room : Object) { - for(val item: Item in items) { + for(item: Item in items) { if (item.room === room) { System.out.println("You see " + item.name) } diff --git a/idea/testData/quickfix/override/afterParameterNameChangedMultipleOverrideRenamePossible.kt b/idea/testData/quickfix/override/afterParameterNameChangedMultipleOverrideRenamePossible.kt index 53646a2b5eb..9fb01d44854 100644 --- a/idea/testData/quickfix/override/afterParameterNameChangedMultipleOverrideRenamePossible.kt +++ b/idea/testData/quickfix/override/afterParameterNameChangedMultipleOverrideRenamePossible.kt @@ -8,8 +8,8 @@ trait X { } class B : A(), X { - override fun foo(var arg: Int) : Int { - arg += 5 + override fun foo(arg: Int) : Int { + val x = arg + arg return arg } } diff --git a/idea/testData/quickfix/override/afterParameterNameChangedRenamePossible.kt b/idea/testData/quickfix/override/afterParameterNameChangedRenamePossible.kt index 5ff86e1b897..04cb7df1c93 100644 --- a/idea/testData/quickfix/override/afterParameterNameChangedRenamePossible.kt +++ b/idea/testData/quickfix/override/afterParameterNameChangedRenamePossible.kt @@ -4,8 +4,8 @@ abstract class A { } class B : A() { - override fun foo(var arg: Int) : Int { - arg += 5 + override fun foo(arg: Int) : Int { + var x = arg + arg return arg } } diff --git a/idea/testData/quickfix/override/beforeParameterNameChangedAmbiguousRename.kt b/idea/testData/quickfix/override/beforeParameterNameChangedAmbiguousRename.kt index 3ef9003586b..42be1de9256 100644 --- a/idea/testData/quickfix/override/beforeParameterNameChangedAmbiguousRename.kt +++ b/idea/testData/quickfix/override/beforeParameterNameChangedAmbiguousRename.kt @@ -8,8 +8,8 @@ trait X { } class B : A(), X { - override fun foo(var arg: Int) : Int { - arg += 5 + override fun foo(arg: Int) : Int { + val x = arg + arg return arg } } diff --git a/idea/testData/quickfix/override/beforeParameterNameChangedMultipleOverrideRenamePossible.kt b/idea/testData/quickfix/override/beforeParameterNameChangedMultipleOverrideRenamePossible.kt index 050cffa03ef..1c3e3445fb7 100644 --- a/idea/testData/quickfix/override/beforeParameterNameChangedMultipleOverrideRenamePossible.kt +++ b/idea/testData/quickfix/override/beforeParameterNameChangedMultipleOverrideRenamePossible.kt @@ -8,8 +8,8 @@ trait X { } class B : A(), X { - override fun foo(var agr : Int) : Int { - agr += 5 + override fun foo(agr : Int) : Int { + val x = agr + agr return agr } } diff --git a/idea/testData/quickfix/override/beforeParameterNameChangedRenamePossible.kt b/idea/testData/quickfix/override/beforeParameterNameChangedRenamePossible.kt index 649e6ae9157..08b7ccda2f0 100644 --- a/idea/testData/quickfix/override/beforeParameterNameChangedRenamePossible.kt +++ b/idea/testData/quickfix/override/beforeParameterNameChangedRenamePossible.kt @@ -4,8 +4,8 @@ abstract class A { } class B : A() { - override fun foo(var agr : Int) : Int { - agr += 5 + override fun foo(agr : Int) : Int { + var x = agr + agr return agr } } diff --git a/js/js.translator/testFiles/expression/for/cases/forIteratesOverArray.kt b/js/js.translator/testFiles/expression/for/cases/forIteratesOverArray.kt index 74ab5b8e675..7d80aa9aca4 100644 --- a/js/js.translator/testFiles/expression/for/cases/forIteratesOverArray.kt +++ b/js/js.translator/testFiles/expression/for/cases/forIteratesOverArray.kt @@ -8,7 +8,7 @@ fun box() : Boolean { a1[3] = 3 a1[5] = 5 - for (var a : Int? in a1) { + for (a : Int? in a1) { if (a != null) { c += 1; } else { diff --git a/js/js.translator/testFiles/expression/function/cases/loopClosure.kt b/js/js.translator/testFiles/expression/function/cases/loopClosure.kt index 4290152f49d..a2dc580a167 100644 --- a/js/js.translator/testFiles/expression/function/cases/loopClosure.kt +++ b/js/js.translator/testFiles/expression/function/cases/loopClosure.kt @@ -2,12 +2,13 @@ package foo var b = 0 -fun loop(var times: Int) { - while (times > 0) { +fun loop(times: Int) { + var left = times + while (left > 0) { val u = {(value: Int) -> b = b + 1 } - u(times--) + u(left--) } } diff --git a/js/js.translator/testFiles/expression/misc/cases/localVarAsFunction.kt b/js/js.translator/testFiles/expression/misc/cases/localVarAsFunction.kt index b31c76e7b43..a4c6daaecba 100644 --- a/js/js.translator/testFiles/expression/misc/cases/localVarAsFunction.kt +++ b/js/js.translator/testFiles/expression/misc/cases/localVarAsFunction.kt @@ -2,12 +2,13 @@ package foo var c = 2 -fun loop(var times : Int) { - while(times > 0) { +fun loop(times : Int) { + var left = times + while(left > 0) { val u : (value : Int) -> Unit = { c++ } - u(times--) + u(left--) } } diff --git a/js/js.translator/testFiles/extensionFunction/cases/generic.kt b/js/js.translator/testFiles/extensionFunction/cases/generic.kt index d13147d5d22..206e55f5a43 100644 --- a/js/js.translator/testFiles/extensionFunction/cases/generic.kt +++ b/js/js.translator/testFiles/extensionFunction/cases/generic.kt @@ -4,7 +4,7 @@ import java.util.* fun ArrayList.findAll(predicate: (T) -> Boolean): ArrayList { val result = ArrayList() - for(val t in this) { + for(t in this) { if (predicate(t)) result.add(t) } return result diff --git a/js/js.translator/testFiles/webDemoCanvasExamples/cases/Traffic light.kt b/js/js.translator/testFiles/webDemoCanvasExamples/cases/Traffic light.kt index eabc4564391..044c17e1dc7 100644 --- a/js/js.translator/testFiles/webDemoCanvasExamples/cases/Traffic light.kt +++ b/js/js.translator/testFiles/webDemoCanvasExamples/cases/Traffic light.kt @@ -495,6 +495,6 @@ class Vector(val x: Double = 0.0, val y: Double = 0.0) { get() = this * (1.0 / Math.sqrt(sqr)) } -fun getRandomArbitary(val min: Int, val max: Int): Double { +fun getRandomArbitary(min: Int, max: Int): Double { return Math.random() * (max - min) + min; } diff --git a/libraries/stdlib/src/kotlin/IterablesSpecial.kt b/libraries/stdlib/src/kotlin/IterablesSpecial.kt index 894719c3b7b..62aff9516be 100644 --- a/libraries/stdlib/src/kotlin/IterablesSpecial.kt +++ b/libraries/stdlib/src/kotlin/IterablesSpecial.kt @@ -54,7 +54,7 @@ public fun Iterable.containsItem(item : T) : Boolean { return this.contains(item); } - for (var elem in this) { + for (elem in this) { if (elem == item) { return true } diff --git a/libraries/stdlib/src/kotlin/OrderingJVM.kt b/libraries/stdlib/src/kotlin/OrderingJVM.kt index 9ef69e752c9..7533bd79d58 100644 --- a/libraries/stdlib/src/kotlin/OrderingJVM.kt +++ b/libraries/stdlib/src/kotlin/OrderingJVM.kt @@ -36,7 +36,7 @@ public inline fun > compareValues(a: T?, b: T?): Int { /** * Creates a comparator using the sequence of functions used to calculate a value to compare on */ -public inline fun comparator(vararg val functions: T.() -> Comparable<*>?): Comparator { +public inline fun comparator(vararg functions: T.() -> Comparable<*>?): Comparator { return FunctionComparator(*functions) } diff --git a/libraries/stdlib/src/kotlin/template/Templates.kt b/libraries/stdlib/src/kotlin/template/Templates.kt index b887329791e..816f61617f4 100644 --- a/libraries/stdlib/src/kotlin/template/Templates.kt +++ b/libraries/stdlib/src/kotlin/template/Templates.kt @@ -82,7 +82,7 @@ public fun StringTemplate.toHtml(formatter : HtmlFormatter = HtmlFormatter()) : * to escape particular characters in different output formats such as [[HtmlFormatter] */ public trait Formatter { - public fun format(buffer : Appendable, val value : Any?) : Unit + public fun format(buffer : Appendable, value : Any?) : Unit } /** diff --git a/libraries/stdlib/test/ArraysTest.kt b/libraries/stdlib/test/ArraysTest.kt index e1aec0d471f..cfb4c50ff48 100644 --- a/libraries/stdlib/test/ArraysTest.kt +++ b/libraries/stdlib/test/ArraysTest.kt @@ -3,7 +3,7 @@ package test.arrays import kotlin.test.* import org.junit.Test as test -fun checkContent(val iter : Iterator, val length : Int, val value : (Int) -> T) { +fun checkContent(iter : Iterator, length : Int, value : (Int) -> T) { var idx = 0 while (idx != length && iter.hasNext()) { assertEquals(value(idx++), iter.next(), "Invalid element") diff --git a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/SyntaxHighlighter.kt b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/SyntaxHighlighter.kt index db94b4b7516..27c21b9553d 100644 --- a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/SyntaxHighlighter.kt +++ b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/SyntaxHighlighter.kt @@ -22,7 +22,7 @@ class SyntaxHighligher() { val styleMap = createStyleMap() /** Highlights the given kotlin code as HTML */ - fun highlight(val code: String): String { + fun highlight(code: String): String { try { val builder = StringBuilder() builder.append( diff --git a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/templates/KDocTemplate.kt b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/templates/KDocTemplate.kt index 6749ab7fe3b..1dee78b05eb 100644 --- a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/templates/KDocTemplate.kt +++ b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/templates/KDocTemplate.kt @@ -154,7 +154,7 @@ abstract class KDocTemplate() : TextTemplate() { } } - open fun typeArguments(arguments: List, val prefix: String = "<", val postfix: String = ">", val empty: String = ""): String { + open fun typeArguments(arguments: List, prefix: String = "<", postfix: String = ">", empty: String = ""): String { val text = arguments.map() { link(it) }.makeString(", ") return if (text.length() == 0) empty else "$prefix$text$postfix" }