diff --git a/compiler/testData/checkerWithErrorTypes/full/Abstract.jet b/compiler/testData/checkerWithErrorTypes/full/Abstract.jet index e1633f74b05..ce355f02045 100644 --- a/compiler/testData/checkerWithErrorTypes/full/Abstract.jet +++ b/compiler/testData/checkerWithErrorTypes/full/Abstract.jet @@ -236,6 +236,6 @@ abstract class B3(i: Int) { } fun foo(a: B3) { - val a = B3() - val b = B1(2, "s") + val a = B3() + val b = B1(2, "s") } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/AnonymousInitializers.jet b/compiler/testData/checkerWithErrorTypes/full/AnonymousInitializers.jet index 955798a7a9c..74efce233c3 100644 --- a/compiler/testData/checkerWithErrorTypes/full/AnonymousInitializers.jet +++ b/compiler/testData/checkerWithErrorTypes/full/AnonymousInitializers.jet @@ -28,7 +28,7 @@ class WithC() { } this(a : Int) : this() { - val b = x + val b = x } } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/ExtensionFunctions.jet b/compiler/testData/checkerWithErrorTypes/full/ExtensionFunctions.jet index d12496d9e8b..141e47ae591 100644 --- a/compiler/testData/checkerWithErrorTypes/full/ExtensionFunctions.jet +++ b/compiler/testData/checkerWithErrorTypes/full/ExtensionFunctions.jet @@ -28,7 +28,7 @@ fun A.plus(a : Int) { fun T.minus(t : T) : Int = 1 fun test() { - val y = 1.abs + val y = 1.abs } val Int.abs : Int get() = if (this > 0) this else -this; diff --git a/compiler/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet b/compiler/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet index 0cd9f099e25..850cb2fd5e0 100644 --- a/compiler/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet +++ b/compiler/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet @@ -116,7 +116,7 @@ fun blockReturnValueTypeMatch12() : Int { else return 1.0 } fun blockNoReturnIfValDeclaration(): Int { - val x = 1 + val x = 1 } fun blockNoReturnIfEmptyIf(): Int { if (1 < 2) {} else {} @@ -174,37 +174,37 @@ class B() { } fun testFunctionLiterals() { - val endsWithVarDeclaration : fun() : Boolean = { + val endsWithVarDeclaration : fun() : Boolean = { val x = 2 } - val endsWithAssignment = { () : Int => + val endsWithAssignment = { () : Int => var x = 1 x = 333 } - val endsWithReAssignment = { () : Int => + val endsWithReAssignment = { () : Int => var x = 1 x += 333 } - val endsWithFunDeclaration : fun() : String = { + val endsWithFunDeclaration : fun() : String = { var x = 1 x = 333 fun meow() : Unit {} } - val endsWithObjectDeclaration : fun() : Int = { + val endsWithObjectDeclaration : fun() : Int = { var x = 1 x = 333 object A {} } - val expectedUnitReturnType1 = { () : Unit => + val expectedUnitReturnType1 = { () : Unit => val x = 1 } - val expectedUnitReturnType2 = { () : Unit => + val expectedUnitReturnType2 = { () : Unit => fun meow() : Unit {} object A {} } diff --git a/compiler/testData/checkerWithErrorTypes/full/IncDec.jet b/compiler/testData/checkerWithErrorTypes/full/IncDec.jet index 5b7143f3eef..f0cab587ec0 100644 --- a/compiler/testData/checkerWithErrorTypes/full/IncDec.jet +++ b/compiler/testData/checkerWithErrorTypes/full/IncDec.jet @@ -9,10 +9,10 @@ fun testIncDec() { ++x x-- --x - x = x++ - x = x-- + x = x++ + x = x-- x = ++x - x = --x + x = --x } class WrongIncDec() { @@ -39,8 +39,8 @@ fun testUnitIncDec() { ++x x-- --x - x = x++ - x = x-- + x = x++ + x = x-- x = ++x - x = --x + x = --x } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/QualifiedExpressions.jet b/compiler/testData/checkerWithErrorTypes/full/QualifiedExpressions.jet index 67233fd840f..187c745ef63 100644 --- a/compiler/testData/checkerWithErrorTypes/full/QualifiedExpressions.jet +++ b/compiler/testData/checkerWithErrorTypes/full/QualifiedExpressions.jet @@ -1,11 +1,11 @@ namespace qualified_expressions fun test(s: String?) { - val a: Int = s?.length + val a: Int = s?.length val b: Int? = s?.length - val c: Int = s?.length ?: -11 - val d: Int = s?.length ?: "empty" + val c: Int = s?.length ?: -11 + val d: Int = s?.length ?: "empty" val e: String = s?.length ?: "empty" - val f: Int = s?.length ?: b ?: 1 - val g: Int? = e? startsWith("s")?.length + val f: Int = s?.length ?: b ?: 1 + val g: Int? = e? startsWith("s")?.length } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/QualifiedThis.jet b/compiler/testData/checkerWithErrorTypes/full/QualifiedThis.jet index f23c01cfd20..7fab8479b4b 100644 --- a/compiler/testData/checkerWithErrorTypes/full/QualifiedThis.jet +++ b/compiler/testData/checkerWithErrorTypes/full/QualifiedThis.jet @@ -31,11 +31,11 @@ namespace closures { val Int.xx = this : Int fun Char.xx() : Any { this : Char - val a = {Double.() => this : Double + this@xx : Char} - val b = @a{Double.() => this@a : Double + this@xx : Char} - val c = @a{() => this@a + this@xx : Char} + val a = {Double.() => this : Double + this@xx : Char} + val b = @a{Double.() => this@a : Double + this@xx : Char} + val c = @a{() => this@a + this@xx : Char} return (@a{Double.() => this@a : Double + this@xx : Char}) } } } -} +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/ResolveToJava.jet b/compiler/testData/checkerWithErrorTypes/full/ResolveToJava.jet index e2385007530..61483f8ea48 100644 --- a/compiler/testData/checkerWithErrorTypes/full/ResolveToJava.jet +++ b/compiler/testData/checkerWithErrorTypes/full/ResolveToJava.jet @@ -8,13 +8,13 @@ import java.lang.Comparable as Com val l : List = ArrayList() fun test(l : java.util.List) { - val x : java.List - val y : java.util.List - val b : java.lang.Object - val a : util.List - val z : java.utils.List + val x : java.List + val y : java.util.List + val b : java.lang.Object + val a : util.List + val z : java.utils.List - val f : java.io.File? = null + val f : java.io.File? = null Collections.emptyList Collections.emptyList @@ -27,7 +27,7 @@ fun test(l : java.util.List) { List - val o = "sdf" as Object + val o = "sdf" as Object try { // ... @@ -49,4 +49,4 @@ fun test(l : java.util.List) { namespace xxx { import java.lang.Class; -} +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/Unresolved.jet b/compiler/testData/checkerWithErrorTypes/full/Unresolved.jet index 9bd749a8372..a13dae7809b 100644 --- a/compiler/testData/checkerWithErrorTypes/full/Unresolved.jet +++ b/compiler/testData/checkerWithErrorTypes/full/Unresolved.jet @@ -1,13 +1,13 @@ namespace unresolved fun testGenericArgumentsCount() { - val p1: Tuple2 = (2, 2) - val p2: Tuple2 = (2, 2) + val p1: Tuple2 = (2, 2) + val p2: Tuple2 = (2, 2) } fun testUnresolved() { if (a is String) { - val s = a + val s = a } foo(a) val s = "s" @@ -28,4 +28,4 @@ fun testUnresolved() { } } -fun foo1(i: Int) {} +fun foo1(i: Int) {} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/Variance.jet b/compiler/testData/checkerWithErrorTypes/full/Variance.jet index 0607a6f0a13..1306c251f00 100644 --- a/compiler/testData/checkerWithErrorTypes/full/Variance.jet +++ b/compiler/testData/checkerWithErrorTypes/full/Variance.jet @@ -8,13 +8,13 @@ abstract class Usual {} fun foo(c: Consumer, p: Producer, u: Usual) { val c1: Consumer = c - val c2: Consumer = c1 + val c2: Consumer = c1 val p1: Producer = p - val p2: Producer = p1 + val p2: Producer = p1 val u1: Usual = u - val u2: Usual = u1 + val u2: Usual = u1 } //Arrays copy example @@ -37,4 +37,4 @@ fun f(ints: Array, any: Array, numbers: Array) { copy2(ints, numbers) copy3(ints, numbers) copy4(ints, numbers) //ok -} +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/infos/Autocasts.jet b/compiler/testData/checkerWithErrorTypes/full/infos/Autocasts.jet index 0d4a237a116..de468b149b4 100644 --- a/compiler/testData/checkerWithErrorTypes/full/infos/Autocasts.jet +++ b/compiler/testData/checkerWithErrorTypes/full/infos/Autocasts.jet @@ -165,42 +165,42 @@ fun illegalWhenBlock(a: Any): Int { } fun declarations(a: Any?) { if (a is String) { - val p4: (Int, String) = (2, a) + val p4: (Int, String) = (2, a) } if (a is String?) { if (a != null) { - val s: String = a + val s: String = a } } if (a != null) { if (a is String?) { - val s: String = a + val s: String = a } } } fun vars(a: Any?) { - var b: Int = 0 + var b: Int = 0 if (a is Int) { - b = a + b = a } } fun tuples(a: Any?) { if (a != null) { - val s: (Any, String) = (a, a) + val s: (Any, String) = (a, a) } if (a is String) { - val s: (Any, String) = (a, a) + val s: (Any, String) = (a, a) } fun illegalTupleReturnType(): (Any, String) = (a, a) if (a is String) { fun legalTupleReturnType(): (Any, String) = (a, a) } - val illegalFunctionLiteral: Function0 = { a } - val illegalReturnValueInFunctionLiteral: Function0 = { (): Int => a } + val illegalFunctionLiteral: Function0 = { a } + val illegalReturnValueInFunctionLiteral: Function0 = { (): Int => a } if (a is Int) { - val legalFunctionLiteral: Function0 = { a } - val alsoLegalFunctionLiteral: Function0 = { (): Int => a } + val legalFunctionLiteral: Function0 = { a } + val alsoLegalFunctionLiteral: Function0 = { (): Int => a } } } fun returnFunctionLiteralBlock(a: Any?): Function0 { @@ -227,7 +227,7 @@ fun mergeAutocasts(a: Any?) { is String, is Any => a.compareTo("") } if (a is String && a is Any) { - val i: Int = a.compareTo("") + val i: Int = a.compareTo("") } if (a is String && a.compareTo("") == 0) {} if (a is String || a.compareTo("") == 0) {} @@ -237,9 +237,9 @@ fun mergeAutocasts(a: Any?) { fun f(): String { var a: Any = 11 if (a is String) { - val i: String = a + val i: String = a a.compareTo("f") - val f: Function0 = { a } + val f: Function0 = { a } return a } return "" diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/AssignmentsUnderOperators.jet b/compiler/testData/checkerWithErrorTypes/full/regression/AssignmentsUnderOperators.jet index 2acdbfdd984..43f56b9465e 100644 --- a/compiler/testData/checkerWithErrorTypes/full/regression/AssignmentsUnderOperators.jet +++ b/compiler/testData/checkerWithErrorTypes/full/regression/AssignmentsUnderOperators.jet @@ -2,5 +2,5 @@ fun test() { var a : Any? = null if (a is Any) else a = null; while (a is Any) a = null - while (true) a = null + while (true) a = null } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/CoercionToUnit.jet b/compiler/testData/checkerWithErrorTypes/full/regression/CoercionToUnit.jet index 6733ab3a31e..6ce84f8c66b 100644 --- a/compiler/testData/checkerWithErrorTypes/full/regression/CoercionToUnit.jet +++ b/compiler/testData/checkerWithErrorTypes/full/regression/CoercionToUnit.jet @@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : fun() : Unit = { + val a : fun() : Unit = { foo(1) } return 1 diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/DoubleDefine.jet b/compiler/testData/checkerWithErrorTypes/full/regression/DoubleDefine.jet index fbca6a41c99..996c4608778 100644 --- a/compiler/testData/checkerWithErrorTypes/full/regression/DoubleDefine.jet +++ b/compiler/testData/checkerWithErrorTypes/full/regression/DoubleDefine.jet @@ -32,7 +32,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) if (expr.length() > 0) { - val c = expr.charAt(0) + val c = expr.charAt(0) expr.deleteCharAt(0) } return lhs @@ -63,4 +63,4 @@ fun main(args: Array) { catch(e: Throwable) { System.out?.println(e.getMessage()) } -} +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/Jet124.jet b/compiler/testData/checkerWithErrorTypes/full/regression/Jet124.jet index 317b1438f41..58e876a80f2 100644 --- a/compiler/testData/checkerWithErrorTypes/full/regression/Jet124.jet +++ b/compiler/testData/checkerWithErrorTypes/full/regression/Jet124.jet @@ -1,8 +1,8 @@ fun foo1() : fun (Int) : Int = { (x: Int) => x } fun foo() { - val h : fun (Int) : Int = foo1(); + val h : fun (Int) : Int = foo1(); h(1) - val m : fun (Int) : Int = {(a : Int) => 1}//foo1() + val m : fun (Int) : Int = {(a : Int) => 1}//foo1() m(1) } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/Jet183.jet b/compiler/testData/checkerWithErrorTypes/full/regression/Jet183.jet index 59df6e106d6..a6992d2c8e3 100644 --- a/compiler/testData/checkerWithErrorTypes/full/regression/Jet183.jet +++ b/compiler/testData/checkerWithErrorTypes/full/regression/Jet183.jet @@ -18,5 +18,5 @@ enum class Foo { fun box() { - val x: ProtocolState = ProtocolState.WAITING -} + val x: ProtocolState = ProtocolState.WAITING +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/ScopeForSecondaryConstructors.jet b/compiler/testData/checkerWithErrorTypes/full/regression/ScopeForSecondaryConstructors.jet index 80b5a321d89..31212378979 100644 --- a/compiler/testData/checkerWithErrorTypes/full/regression/ScopeForSecondaryConstructors.jet +++ b/compiler/testData/checkerWithErrorTypes/full/regression/ScopeForSecondaryConstructors.jet @@ -1,4 +1,4 @@ - class Foo(var bar : Int, var barr : Int, var barrr : Int) { +class Foo(var bar : Int, var barr : Int, var barrr : Int) { { bar = 1 barr = 1 @@ -11,8 +11,7 @@ bar = 1 this.bar 1 : Int - val a : Int =1 + val a : Int =1 this : Foo } - } - + } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/AutocastsForStableIdentifiers.jet b/compiler/testData/checkerWithErrorTypes/quick/AutocastsForStableIdentifiers.jet index 6bb9d5f51db..37ff349686f 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/AutocastsForStableIdentifiers.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/AutocastsForStableIdentifiers.jet @@ -17,42 +17,42 @@ class AClass() { val x : Any? = 1 fun Any?.vars(a: Any?) : Int { - var b: Int = 0 + var b: Int = 0 if (ns.y is Int) { - b = ns.y + b = ns.y } if (ns.y is Int) { - b = example.ns.y + b = example.ns.y } if (example.ns.y is Int) { - b = ns.y + b = ns.y } if (example.ns.y is Int) { - b = example.ns.y + b = example.ns.y } // if (namespace.bottles.ns.y is Int) { // b = ns.y // } if (Obj.y is Int) { - b = Obj.y + b = Obj.y } if (example.Obj.y is Int) { - b = Obj.y + b = Obj.y } if (AClass.y is Int) { - b = AClass.y + b = AClass.y } if (example.AClass.y is Int) { - b = AClass.y + b = AClass.y } if (x is Int) { - b = x + b = x } if (example.x is Int) { - b = x + b = x } if (example.x is Int) { - b = example.x + b = example.x } return 1 } @@ -74,18 +74,18 @@ trait T {} open class C { fun foo() { - var t : T? = null + var t : T? = null if (this is T) { - t = this + t = this } if (this is T) { - t = this@C + t = this@C } if (this@C is T) { - t = this + t = this } if (this@C is T) { - t = this@C + t = this@C } } } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/Basic.jet b/compiler/testData/checkerWithErrorTypes/quick/Basic.jet index dea3b44a6e1..82775571c83 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/Basic.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/Basic.jet @@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : fun() : Unit = { + val a : fun() : Unit = { foo(1) } return 1 - "1" diff --git a/compiler/testData/checkerWithErrorTypes/quick/IncorrectCharacterLiterals.jet b/compiler/testData/checkerWithErrorTypes/quick/IncorrectCharacterLiterals.jet index d30fa5f45f7..aee64608f0d 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/IncorrectCharacterLiterals.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/IncorrectCharacterLiterals.jet @@ -2,11 +2,11 @@ // KT-451 Incorrect character literals cause assertion failures fun ff() { - val b = '' - val c = '23' - val d = 'a - val e = 'ab - val f = '\' + val b = '' + val c = '23' + val d = 'a + val e = 'ab + val f = '\' } fun test() { @@ -34,5 +34,4 @@ fun test() { '\u000z' '\\u000' '\' -} - +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiver.jet b/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiver.jet index 5157eb39277..8cb0f3c0e86 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiver.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiver.jet @@ -2,5 +2,5 @@ fun ff() { val i: Int = 1 - val a: Int = i?.plus(2) -} + val a: Int = i?.plus(2) +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiverReturnNull.jet b/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiverReturnNull.jet index fe6d5efeeed..f56ba89b746 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiverReturnNull.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/SafeCallNonNullReceiverReturnNull.jet @@ -2,5 +2,5 @@ fun Int.gg() = null fun ff() { val a: Int = 1 - val b: Int = a?.gg() -} + val b: Int = a?.gg() +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/Super.jet b/compiler/testData/checkerWithErrorTypes/quick/Super.jet index 5841b9108f3..7a3095d820f 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/Super.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/Super.jet @@ -5,7 +5,7 @@ fun any(a : Any) {} fun notAnExpression() { any(super) // not an expression if (super) {} else {} // not an expression - val x = super // not an expression + val x = super // not an expression when (1) { super => 1 // not an expression } diff --git a/compiler/testData/checkerWithErrorTypes/quick/TypeInference.jet b/compiler/testData/checkerWithErrorTypes/quick/TypeInference.jet index ed8093219b0..5f35e4d98a5 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/TypeInference.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/TypeInference.jet @@ -6,13 +6,13 @@ fun foo(c: C) {} fun bar() : C {} fun main(args : Array) { - val a : C = C(); - val x : C = C() - val y : C = C() - val z : C<*> = C() + val a : C = C(); + val x : C = C() + val y : C = C() + val z : C<*> = C() - val ba : C = bar(); - val bx : C = bar() - val by : C = bar() - val bz : C<*> = bar() -} + val ba : C = bar(); + val bx : C = bar() + val by : C = bar() + val bz : C<*> = bar() +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/UninitializedOrReassignedVariables.jet b/compiler/testData/checkerWithErrorTypes/quick/UninitializedOrReassignedVariables.jet index 17ddcc58a79..63739b20d4b 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/UninitializedOrReassignedVariables.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/UninitializedOrReassignedVariables.jet @@ -63,11 +63,11 @@ fun t4(a: A, val b: A, var c: A) { // reassigned vals fun t1() { - val a : Int = 1 - a = 2 + val a : Int = 1 + a = 2 - var b : Int = 1 - b = 3 + var b : Int = 1 + b = 3 } abstract enum class ProtocolState { @@ -85,7 +85,7 @@ abstract enum class ProtocolState { fun t3() { val x: ProtocolState = ProtocolState.WAITING x = x.signal() - x = x.signal() //repeat for x + x = x.signal() //repeat for x } fun t4() { @@ -265,7 +265,7 @@ class ClassObject() { } fun foo() { - val a = object { + val a = object { val x : Int val y : Int val z : Int @@ -283,7 +283,7 @@ fun foo() { class TestObjectExpression() { val a : Int fun foo() { - val a = object { + val a = object { val x : Int val y : Int { @@ -325,10 +325,10 @@ object TestObjectDeclaration { fun func() { val b = 1 - val a = object { + val a = object { val x = b { - b = 4 + b = 4 $b = 3 } } @@ -349,4 +349,4 @@ fun test(m : M) { fun test1(m : M) { m.x++ m.y-- -} +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/UnitByDefaultForFunctionTypes.jet b/compiler/testData/checkerWithErrorTypes/quick/UnitByDefaultForFunctionTypes.jet index 383e67e16c4..9a14ad7a471 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/UnitByDefaultForFunctionTypes.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/UnitByDefaultForFunctionTypes.jet @@ -1,3 +1,3 @@ fun foo(f : fun()) { - val x : Unit = f() + val x : Unit = f() } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet b/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet new file mode 100644 index 00000000000..c52c8e8e61d --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet @@ -0,0 +1,142 @@ +namespace unused_variables + +fun testSimpleCases() { + var i = 2 + i = 34 + i = 34 + doSmth(i) + i = 5 + + var j = 2 + j = j++ + j = j-- +} + +class IncDec() { + fun inc() : IncDec = this + fun dec() : IncDec = this +} + +class MyTest() { + fun testIncDec() { + var x = IncDec() + x++ + ++x + x-- + --x + x = x++ + x = x-- + x = ++x + x = --x + } + + var a: String = "s" + set(v: String) { + var i: Int = 23 + doSmth(i) + i = 34 + $a = v + } + + { + a = "rr" + } + + fun testSimple() { + a = "rro" + + var i = 1; + i = 34; + i = 456; + } + + fun testWhile(a : Any?, b : Any?) { + var a : Any? = true + var b : Any? = 34 + while (a is Any) { + a = null + } + while (b != null) { + a = null + } + } + + fun testIf() { + var a : Any + if (1 < 2) { + a = 23 + } + else { + a = "ss" + doSmth(a as String) + } + doSmth(a) + + if (1 < 2) { + a = 23 + } + else { + a = "ss" + } + } + + fun testFor() { + for (i in 1..10) { + doSmth(i) + } + } + + fun doSmth(s: String) {} + fun doSmth(a: Any) {} +} + +fun testInnerFunctions() { + var y = 1 + fun foo() { + y = 1 + } + var z = 1 + fun bar() { + doSmth(z) + } +} + +fun testFunctionLiterals() { + var x = 1 + var fl = { (): Int => + x + } + var y = 2 + var fl1 = { (): Unit => + doSmth(y) + } +} + +trait Trait { + fun foo() +} + +fun testObject() : Trait { + val x = 24 + val o = object : Trait { + val y : Int //in this case y should not be marked as unused + get() = 55 + + override fun foo() { + doSmth(x) + } + } + + return o +} + +fun testBackingFieldsNotMarked() { + val a = object { + val x : Int + { + $x = 1 + } + } +} + +fun doSmth(i : Int) {} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt235.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt235.jet index 5e4f6a0cd9b..7420cb938e5 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt235.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt235.jet @@ -4,33 +4,33 @@ namespace kt235 fun main(args: Array) { val array = MyArray() - val f = { (): String => + val f = { (): String => array[2] = 23 //error: Type mismatch: inferred type is Int (!!!) but String was expected } - val g = {(): String => + val g = {(): String => var x = 1 x += 2 //no error, but it should be here } - val h = {(): String => + val h = {(): String => var x = 1 x = 2 //the same } val array1 = MyArray1() - val x = { (): String => + val x = { (): String => array1[2] = 23 } - val fi = { (): Int => + val fi = { (): Int => array[2] = 23 } - val gi = {(): Int => + val gi = {(): Int => var x = 1 x += 21 } var m: MyNumber = MyNumber() - val a = { (): MyNumber => - m++ + val a = { (): MyNumber => + m++ } } diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt352.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt352.jet index da402197d5f..e9b4eb34e94 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt352.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt352.jet @@ -5,7 +5,7 @@ namespace kt352 val f : fun(Any) : Unit = { () : Unit => } //type mismatch fun foo() { - val f : fun(Any) : Unit = { () : Unit => } //!!! no error + val f : fun(Any) : Unit = { () : Unit => } //!!! no error } class A() { diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt353.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt353.jet index 5a7c9569795..dffdaa68d48 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt353.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt353.jet @@ -5,17 +5,17 @@ trait A { } fun foo(a: A) { - val g : fun() : Unit = { + val g : fun() : Unit = { a.gen() //it works: Unit is derived } - val u: Unit = a.gen() //type mismatch, but Unit can be derived + val u: Unit = a.gen() //type mismatch, but Unit can be derived if (true) { a.gen() //it works: Unit is derived } - val b : fun() : Unit = { + val b : fun() : Unit = { if (true) { a.gen() //type mismatch, but Unit can be derived } @@ -24,9 +24,9 @@ fun foo(a: A) { } } - val f : fun() : Int = { () : Int => + val f : fun() : Int = { () : Int => a.gen() //type mismatch, but Int can be derived } a.gen() //it works: Unit is derived -} +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt411.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt411.jet index aed23ee9382..5d724d405da 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt411.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt411.jet @@ -13,13 +13,13 @@ fun invoker(gen : fun() : Int) : Int = 0 //more tests fun t1() { - val v = @{ () : Int => + val v = @{ () : Int => return@ 111 } } fun t2() : String { - val g : fun(): Int = @{ + val g : fun(): Int = @{ if (true) { return@ 1 } @@ -54,10 +54,10 @@ fun t3() : String { } fun t4() : Int { - val h : fun (): String = @l{ + val h : fun (): String = @l{ return@l "a" } - val g : fun (): String = @{ () : String => + val g : fun (): String = @{ () : String => return@ "a" } diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt442.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt442.jet index 3138ed71587..79390466a35 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt442.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt442.jet @@ -3,13 +3,13 @@ fun funny(f : fun() : T) : T = f() fun testFunny() { - val a : Int = funny {1} + val a : Int = funny {1} } fun funny2(f : fun(t : T) : T) : T {} fun testFunny2() { - val a : Int = funny2 {it} + val a : Int = funny2 {it} } fun box() : String { @@ -25,7 +25,7 @@ fun T.with(f : fun T.()) { } fun main(args : Array) { - val a = 1 with { + val a = 1 with { plus(1) } } \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt526UnresolvedReferenceInnerStatic.jet b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt526UnresolvedReferenceInnerStatic.jet index b918b0d4c17..b258404a6f6 100644 --- a/compiler/testData/checkerWithErrorTypes/quick/regressions/kt526UnresolvedReferenceInnerStatic.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/regressions/kt526UnresolvedReferenceInnerStatic.jet @@ -10,7 +10,6 @@ class Foo { } class User { fun main() : Unit { - var boo : Foo.Bar? /* <-- this reference is red */ = Foo.Bar() + var boo : Foo.Bar? /* <-- this reference is red */ = Foo.Bar() } -} - +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java b/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java index 06ffed74d04..cdf385d3158 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java @@ -67,7 +67,7 @@ public class CheckerTestUtilTest extends JetLiteFixture { doTest(new TheTest("Unexpected NONE_APPLICABLE at 122 to 123", "Missing TYPE_MISMATCH at 161 to 169") { @Override protected void makeTestData(List diagnostics, List diagnosedRanges) { - diagnosedRanges.remove(2); + diagnosedRanges.remove(3); diagnostics.remove(diagnostics.size() - 3); } }); diff --git a/idea/testData/checker/Abstract.jet b/idea/testData/checker/Abstract.jet index ca35e2bac53..4c34620c5e5 100644 --- a/idea/testData/checker/Abstract.jet +++ b/idea/testData/checker/Abstract.jet @@ -161,6 +161,6 @@ abstract class B3(i: Int) { } fun foo(a: B3) { - val a = B3() - val b = B1(2, "s") + val a = B3() + val b = B1(2, "s") } \ No newline at end of file diff --git a/idea/testData/checker/AnonymousInitializers.jet b/idea/testData/checker/AnonymousInitializers.jet index d579cb6f7c8..f5f5db7a224 100644 --- a/idea/testData/checker/AnonymousInitializers.jet +++ b/idea/testData/checker/AnonymousInitializers.jet @@ -28,7 +28,7 @@ class WithC() { } this(a : Int) : this() { - val b = x + val b = x } } \ No newline at end of file diff --git a/idea/testData/checker/ExtensionFunctions.jet b/idea/testData/checker/ExtensionFunctions.jet index f1ec6d22908..3fd3dcffbfb 100644 --- a/idea/testData/checker/ExtensionFunctions.jet +++ b/idea/testData/checker/ExtensionFunctions.jet @@ -28,7 +28,7 @@ fun A.plus(a : Int) { fun T.minus(t : T) : Int = 1 fun test() { - val y = 1.abs + val y = 1.abs } val Int.abs : Int get() = if (this > 0) this else -this; diff --git a/idea/testData/checker/IncDec.jet b/idea/testData/checker/IncDec.jet index 6d562f2ed03..aa46004ffc2 100644 --- a/idea/testData/checker/IncDec.jet +++ b/idea/testData/checker/IncDec.jet @@ -9,10 +9,10 @@ fun testIncDec() { ++x x-- --x - x = x++ - x = x-- + x = x++ + x = x-- x = ++x - x = --x + x = --x } class WrongIncDec() { diff --git a/idea/testData/checker/QualifiedExpressions.jet b/idea/testData/checker/QualifiedExpressions.jet index 0ef138d7cd5..351e15e0e4e 100644 --- a/idea/testData/checker/QualifiedExpressions.jet +++ b/idea/testData/checker/QualifiedExpressions.jet @@ -1,11 +1,11 @@ namespace qualified_expressions fun test(s: String?) { - val a: Int = s?.length + val a: Int = s?.length val b: Int? = s?.length - val c: Int = s?.length ?: -11 - val d: Int = s?.length ?: "empty" + val c: Int = s?.length ?: -11 + val d: Int = s?.length ?: "empty" val e: String = s?.length ?: "empty" - val f: Int = s?.length ?: b ?: 1 - val g: Int? = e? startsWith("s")?.length + val f: Int = s?.length ?: b ?: 1 + val g: Int? = e? startsWith("s")?.length } \ No newline at end of file diff --git a/idea/testData/checker/QualifiedThis.jet b/idea/testData/checker/QualifiedThis.jet index 37a1f0d90d3..c0825aa37c1 100644 --- a/idea/testData/checker/QualifiedThis.jet +++ b/idea/testData/checker/QualifiedThis.jet @@ -31,9 +31,9 @@ namespace closures { val Int.xx = this : Int fun Char.xx() : Any { this : Char - val a = {Double.() => this : Double + this@xx : Char} - val b = @a{Double.() => this@a : Double + this@xx : Char} - val c = @a{() => this@a + this@xx : Char} + val a = {Double.() => this : Double + this@xx : Char} + val b = @a{Double.() => this@a : Double + this@xx : Char} + val c = @a{() => this@a + this@xx : Char} return (@a{Double.() => this@a : Double + this@xx : Char}) } } diff --git a/idea/testData/checker/ResolveToJava.jet b/idea/testData/checker/ResolveToJava.jet index 215e9561ffe..17eafa7b2d8 100644 --- a/idea/testData/checker/ResolveToJava.jet +++ b/idea/testData/checker/ResolveToJava.jet @@ -8,13 +8,13 @@ import java.lang.Comparable as Com val l : List = ArrayList() fun test(l : java.util.List) { - val x : java.List - val y : java.util.List - val b : java.lang.Object - val a : util.List - val z : java.utils.List + val x : java.List + val y : java.util.List + val b : java.lang.Object + val a : util.List + val z : java.utils.List - val f : java.io.File? = null + val f : java.io.File? = null Collections.emptyList Collections.emptyList @@ -27,7 +27,7 @@ fun test(l : java.util.List) { List - val o = "sdf" as Object + val o = "sdf" as Object try { // ... diff --git a/idea/testData/checker/Unresolved.jet b/idea/testData/checker/Unresolved.jet index 2d56e915eb7..159fe931f0b 100644 --- a/idea/testData/checker/Unresolved.jet +++ b/idea/testData/checker/Unresolved.jet @@ -1,13 +1,13 @@ namespace unresolved fun testGenericArgumentsCount() { - val p1: Tuple2 = (2, 2) - val p2: Tuple2 = (2, 2) + val p1: Tuple2 = (2, 2) + val p2: Tuple2 = (2, 2) } fun testUnresolved() { if (a is String) { - val s = a + val s = a } foo(a) val s = "s" diff --git a/idea/testData/checker/Variance.jet b/idea/testData/checker/Variance.jet index 0d173e86dc8..da4384f88bb 100644 --- a/idea/testData/checker/Variance.jet +++ b/idea/testData/checker/Variance.jet @@ -8,13 +8,13 @@ abstract class Usual {} fun foo(c: Consumer, p: Producer, u: Usual) { val c1: Consumer = c - val c2: Consumer = c1 + val c2: Consumer = c1 val p1: Producer = p - val p2: Producer = p1 + val p2: Producer = p1 val u1: Usual = u - val u2: Usual = u1 + val u2: Usual = u1 } //Arrays copy example diff --git a/idea/testData/checker/infos/Autocasts.jet b/idea/testData/checker/infos/Autocasts.jet index d84364c7330..d2acba03849 100644 --- a/idea/testData/checker/infos/Autocasts.jet +++ b/idea/testData/checker/infos/Autocasts.jet @@ -163,42 +163,42 @@ fun illegalWhenBlock(a: Any): Int { } fun declarations(a: Any?) { if (a is String) { - val p4: (Int, String) = (2, a) + val p4: (Int, String) = (2, a) } if (a is String?) { if (a != null) { - val s: String = a + val s: String = a } } if (a != null) { if (a is String?) { - val s: String = a + val s: String = a } } } fun vars(a: Any?) { - var b: Int = 0 + var b: Int = 0 if (a is Int) { - b = a + b = a } } fun tuples(a: Any?) { if (a != null) { - val s: (Any, String) = (a, a) + val s: (Any, String) = (a, a) } if (a is String) { - val s: (Any, String) = (a, a) + val s: (Any, String) = (a, a) } fun illegalTupleReturnType(): (Any, String) = (a, a) if (a is String) { fun legalTupleReturnType(): (Any, String) = (a, a) } - val illegalFunctionLiteral: Function0 = { a } - val illegalReturnValueInFunctionLiteral: Function0 = { (): Int => a } + val illegalFunctionLiteral: Function0 = { a } + val illegalReturnValueInFunctionLiteral: Function0 = { (): Int => a } if (a is Int) { - val legalFunctionLiteral: Function0 = { a } - val alsoLegalFunctionLiteral: Function0 = { (): Int => a } + val legalFunctionLiteral: Function0 = { a } + val alsoLegalFunctionLiteral: Function0 = { (): Int => a } } } fun returnFunctionLiteralBlock(a: Any?): Function0 { @@ -225,7 +225,7 @@ fun mergeAutocasts(a: Any?) { is String, is Any => a.compareTo("") } if (a is String && a is Any) { - val i: Int = a.compareTo("") + val i: Int = a.compareTo("") } if (a is String && a.compareTo("") == 0) {} if (a is String || a.compareTo("") == 0) {} @@ -235,9 +235,9 @@ fun mergeAutocasts(a: Any?) { fun f(): String { var a: Any = 11 if (a is String) { - val i: String = a + val i: String = a a.compareTo("f") - val f: Function0 = { a } + val f: Function0 = { a } return a } return "" diff --git a/idea/testData/checker/infos/WrapIntoRef.jet b/idea/testData/checker/infos/WrapIntoRef.jet index fb938acda53..886b601bbfa 100644 --- a/idea/testData/checker/infos/WrapIntoRef.jet +++ b/idea/testData/checker/infos/WrapIntoRef.jet @@ -1,30 +1,30 @@ fun refs() { - var a = 1 - val v = { - a = 2 + var a = 1 + val v = { + a = 2 } - var x = 1 - val b = object { + var x = 1 + val b = object { fun foo() { - x = 2 + x = 2 } } - var y = 1 + var y = 1 fun foo() { - y = 1 + y = 1 } } fun refsPlusAssign() { var a = 1 - val v = { + val v = { a += 2 } var x = 1 - val b = object { + val b = object { fun foo() { x += 2 } diff --git a/idea/testData/checker/regression/AssignmentsUnderOperators.jet b/idea/testData/checker/regression/AssignmentsUnderOperators.jet index 2acdbfdd984..c8825f90731 100644 --- a/idea/testData/checker/regression/AssignmentsUnderOperators.jet +++ b/idea/testData/checker/regression/AssignmentsUnderOperators.jet @@ -2,5 +2,5 @@ fun test() { var a : Any? = null if (a is Any) else a = null; while (a is Any) a = null - while (true) a = null + while (true) a = null } \ No newline at end of file diff --git a/idea/testData/checker/regression/CoercionToUnit.jet b/idea/testData/checker/regression/CoercionToUnit.jet index 5d814eadc9e..ec8c8e32275 100644 --- a/idea/testData/checker/regression/CoercionToUnit.jet +++ b/idea/testData/checker/regression/CoercionToUnit.jet @@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1 fun test() : Int { foo(1) - val a : fun() : Unit = { + val a : fun() : Unit = { foo(1) } return 1 diff --git a/idea/testData/checker/regression/DoubleDefine.jet b/idea/testData/checker/regression/DoubleDefine.jet index ebbda575d07..09e2f188993 100644 --- a/idea/testData/checker/regression/DoubleDefine.jet +++ b/idea/testData/checker/regression/DoubleDefine.jet @@ -32,7 +32,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList): Int { fun evaluate(expr: StringBuilder, numbers: ArrayList): Int { val lhs = evaluateAdd(expr, numbers) if (expr.length() > 0) { - val c = expr.charAt(0) + val c = expr.charAt(0) expr.deleteCharAt(0) } return lhs diff --git a/idea/testData/checker/regression/Jet124.jet b/idea/testData/checker/regression/Jet124.jet index 317b1438f41..48aa4644dea 100644 --- a/idea/testData/checker/regression/Jet124.jet +++ b/idea/testData/checker/regression/Jet124.jet @@ -1,8 +1,8 @@ fun foo1() : fun (Int) : Int = { (x: Int) => x } fun foo() { - val h : fun (Int) : Int = foo1(); + val h : fun (Int) : Int = foo1(); h(1) - val m : fun (Int) : Int = {(a : Int) => 1}//foo1() + val m : fun (Int) : Int = {(a : Int) => 1}//foo1() m(1) } \ No newline at end of file diff --git a/idea/testData/checker/regression/Jet183.jet b/idea/testData/checker/regression/Jet183.jet index 58712e5db73..645c93f52c4 100644 --- a/idea/testData/checker/regression/Jet183.jet +++ b/idea/testData/checker/regression/Jet183.jet @@ -18,5 +18,5 @@ enum class Foo { fun box() { - val x: ProtocolState = ProtocolState.WAITING + val x: ProtocolState = ProtocolState.WAITING } diff --git a/idea/testData/checker/regression/ScopeForSecondaryConstructors.jet b/idea/testData/checker/regression/ScopeForSecondaryConstructors.jet index 80b5a321d89..f4516941508 100644 --- a/idea/testData/checker/regression/ScopeForSecondaryConstructors.jet +++ b/idea/testData/checker/regression/ScopeForSecondaryConstructors.jet @@ -11,7 +11,7 @@ bar = 1 this.bar 1 : Int - val a : Int =1 + val a : Int =1 this : Foo } }