From b6b1ce52e1e49da1740c750500a5502844181589 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Fri, 25 May 2012 21:18:55 +0400 Subject: [PATCH] tests changed: added check for unused/uninitialized variables inside local and anonymous functions --- .../diagnostics/tests/FunctionReturnTypes.jet | 16 ++++++++-------- .../diagnostics/tests/StringTemplates.jet | 6 +++--- .../tests/UninitializedOrReassignedVariables.jet | 6 +++--- .../diagnostics/tests/regressions/kt235.jet | 6 +++--- .../ShadowParameterInNestedBlockInFor.jet | 4 ++-- .../shadowing/ShadowVariableInNestedBlock.jet | 4 ++-- .../shadowing/ShadowVariableInNestedClosure.jet | 4 ++-- idea/testData/checker/StringTemplates.jet | 4 ++-- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet b/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet index 5202b74ec61..7374b73bd99 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.jet @@ -175,12 +175,12 @@ class B() { fun testFunctionLiterals() { val endsWithVarDeclaration : () -> Boolean = { - val x = 2 + val x = 2 } val endsWithAssignment = { () : Int -> - var x = 1 - x = 333 + var x = 1 + x = 333 } val endsWithReAssignment = { () : Int -> @@ -189,19 +189,19 @@ fun testFunctionLiterals() { } val endsWithFunDeclaration : () -> String = { - var x = 1 - x = 333 + var x = 1 + x = 333 fun meow() : Unit {} } val endsWithObjectDeclaration : () -> Int = { - var x = 1 - x = 333 + var x = 1 + x = 333 object A {} } val expectedUnitReturnType1 = { () : Unit -> - val x = 1 + val x = 1 } val expectedUnitReturnType2 = { () : Unit -> diff --git a/compiler/testData/diagnostics/tests/StringTemplates.jet b/compiler/testData/diagnostics/tests/StringTemplates.jet index 7c0d90f20be..15bb94259ec 100644 --- a/compiler/testData/diagnostics/tests/StringTemplates.jet +++ b/compiler/testData/diagnostics/tests/StringTemplates.jet @@ -3,8 +3,8 @@ fun demo() { val a = "" val asd = 1 val bar = 5 - fun map(f : () -> Any?) : Int = 1 - fun buzz(f : () -> Any?) : Int = 1 + fun map(f : () -> Any?) : Int = 1 + fun buzz(f : () -> Any?) : Int = 1 val sdf = 1 val foo = 3; "$abc" @@ -19,4 +19,4 @@ fun demo() { "foo${bar + map { "foo$sdf${ buzz{}}" }}sdfsdf" "a\u \u0 \u00 \u000 \u0000 \u0AaA \u0AAz.length( ) + \u0022b" -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet b/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet index 27be26f068d..e76d907ce23 100644 --- a/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet +++ b/compiler/testData/diagnostics/tests/UninitializedOrReassignedVariables.jet @@ -101,7 +101,7 @@ fun t5() { for (i in 0..2) { i += 1 fun t5() { - i += 3 + i += 3 } } } @@ -297,8 +297,8 @@ class TestObjectExpression() { a = 231 } fun inner2() { - y = 101 - a = 231 + y = 101 + a = 231 } } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt235.jet b/compiler/testData/diagnostics/tests/regressions/kt235.jet index 5d86407e32e..5adfcf6adbc 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt235.jet +++ b/compiler/testData/diagnostics/tests/regressions/kt235.jet @@ -12,8 +12,8 @@ fun main(args: Array) { x += 2 //no error, but it should be here } val h = {(): String -> - var x = 1 - x = 2 //the same + var x = 1 + x = 2 //the same } val array1 = MyArray1() val i = { (): String -> @@ -46,4 +46,4 @@ class MyArray1() { class MyNumber() { fun inc(): MyNumber = MyNumber() -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.jet b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.jet index e9534b0cf26..8d11904199a 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.jet +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.jet @@ -1,7 +1,7 @@ fun f(i: Int) { for (j in 1..100) { { - var i = 12 + var i = 12 } } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.jet b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.jet index ac5ff05e1f5..815357015d2 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.jet +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.jet @@ -1,7 +1,7 @@ fun ff(): Int { var i = 1 { - val i = 2 + val i = 2 } return i -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet index b64caacd881..29ebe8f2c2e 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.jet @@ -1,5 +1,5 @@ fun f(): Int { var i = 17 - { (): Unit -> var i = 18 } + { (): Unit -> var i = 18 } return i -} +} \ No newline at end of file diff --git a/idea/testData/checker/StringTemplates.jet b/idea/testData/checker/StringTemplates.jet index 236c7a4f0ef..88cd788a1ad 100644 --- a/idea/testData/checker/StringTemplates.jet +++ b/idea/testData/checker/StringTemplates.jet @@ -3,8 +3,8 @@ fun demo() { val a = "" val asd = 1 val bar = 5 - fun map(f : () -> Any?) : Int = 1 - fun buzz(f : () -> Any?) : Int = 1 + fun map(f : () -> Any?) : Int = 1 + fun buzz(f : () -> Any?) : Int = 1 val sdf = 1 val foo = 3; use("$abc")