From 7edff172a2593c377041e03465c04f1d30adcc94 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Sat, 16 May 2015 17:31:56 +0300 Subject: [PATCH] KT-1273 Unused assignment - should highlight assignment instead of expression #KT-1273 Fixed --- .../cfg/JetFlowInformationProvider.java | 2 +- .../jetbrains/kotlin/diagnostics/Errors.java | 4 +-- .../diagnostics/PositioningStrategies.kt | 7 +++++ .../diagnostics/tests/FunctionReturnTypes.kt | 6 ++-- compiler/testData/diagnostics/tests/IncDec.kt | 4 +-- .../diagnostics/tests/LValueAssignment.kt | 6 ++-- .../diagnostics/tests/UnusedVariables.kt | 20 ++++++------- .../UninitializedOrReassignedVariables.kt | 10 +++---- .../tests/controlFlowAnalysis/kt609.kt | 2 +- .../tests/controlFlowAnalysis/kt610.kt | 2 +- .../kt770.kt351.kt735_StatementType.kt | 10 +++---- .../tests/controlStructures/kt786.kt | 2 +- .../SmartcastsForStableIdentifiers.kt | 30 +++++++++---------- .../DataFlowInMultiDeclInFor.kt | 2 +- .../kt2643MultiDeclInControlFlow.kt | 2 +- .../tests/enum/entryShouldBeOfEnumType.kt | 2 +- .../diagnostics/tests/infos/SmartCasts.kt | 2 +- .../tests/labels/labelsMustBeNamed.kt | 2 +- .../diagnostics/tests/library/kt828.kt | 14 ++++----- .../regressions/AssignmentsUnderOperators.kt | 2 +- .../diagnostics/tests/regressions/kt235.kt | 2 +- .../kotlin/idea/highlighter/JetPsiChecker.kt | 5 +++- idea/testData/checker/IncDec.kt | 4 +-- idea/testData/checker/Unused.kt | 2 +- idea/testData/checker/infos/SmartCasts.kt | 2 +- .../regression/AssignmentsUnderOperators.kt | 2 +- 26 files changed, 79 insertions(+), 69 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java index 1482f16e2f8..0e4225cafb4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java @@ -632,7 +632,7 @@ public class JetFlowInformationProvider { ((JetBinaryExpression) element).getOperationToken() == JetTokens.EQ) { JetExpression right = ((JetBinaryExpression) element).getRight(); if (right != null) { - report(Errors.UNUSED_VALUE.on(right, right, variableDescriptor), ctxt); + report(Errors.UNUSED_VALUE.on((JetBinaryExpression) element, right, variableDescriptor), ctxt); } } else if (element instanceof JetPostfixExpression) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 0722cfc15f2..3b9d3b38876 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -531,7 +531,7 @@ public interface Errors { DiagnosticFactory1 ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE = DiagnosticFactory1.create(WARNING, DECLARATION_NAME); DiagnosticFactory1 VARIABLE_WITH_REDUNDANT_INITIALIZER = DiagnosticFactory1.create(WARNING); - DiagnosticFactory2 UNUSED_VALUE = DiagnosticFactory2.create(WARNING); + DiagnosticFactory2 UNUSED_VALUE = DiagnosticFactory2.create(WARNING, PositioningStrategies.UNUSED_VALUE); DiagnosticFactory1 UNUSED_CHANGED_VALUE = DiagnosticFactory1.create(WARNING); DiagnosticFactory0 UNUSED_EXPRESSION = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 UNUSED_FUNCTION_LITERAL = DiagnosticFactory0.create(WARNING); @@ -680,7 +680,7 @@ public interface Errors { INVISIBLE_MEMBER, INVISIBLE_MEMBER_FROM_INLINE, INVISIBLE_REFERENCE, INVISIBLE_SETTER); ImmutableSet> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of( UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE, VARIABLE_WITH_REDUNDANT_INITIALIZER, - UNUSED_FUNCTION_LITERAL, USELESS_CAST); + UNUSED_FUNCTION_LITERAL, USELESS_CAST, UNUSED_VALUE); ImmutableSet> TYPE_INFERENCE_ERRORS = ImmutableSet.of( TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS, TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH, TYPE_INFERENCE_UPPER_BOUND_VIOLATED, TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 3840b124f5b..399cbb8236b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.getCalleeHighlightingRange import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType +import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.utils.sure import kotlin.platform.platformStatic @@ -435,4 +436,10 @@ public object PositioningStrategies { return markElement(if (specifiers.isEmpty()) element else specifiers[0]) } } + + public val UNUSED_VALUE: PositioningStrategy = object: PositioningStrategy() { + override fun mark(element: JetBinaryExpression): List { + return listOf(TextRange(element.getLeft()!!.startOffset, element.getOperationReference().endOffset)) + } + } } diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt index 873013f7840..f0d641a5e5a 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt @@ -176,7 +176,7 @@ fun testFunctionLiterals() { val endsWithAssignment: () -> Int = { var x = 1 - x = 333 + x = 333 } val endsWithReAssignment: () -> Int = { @@ -186,13 +186,13 @@ fun testFunctionLiterals() { val endsWithFunDeclaration : () -> String = { var x = 1 - x = 333 + x = 333 fun meow() : Unit {} } val endsWithObjectDeclaration : () -> Int = { var x = 1 - x = 333 + x = 333 object A {} } diff --git a/compiler/testData/diagnostics/tests/IncDec.kt b/compiler/testData/diagnostics/tests/IncDec.kt index 995b2057679..9b3fcc8512a 100644 --- a/compiler/testData/diagnostics/tests/IncDec.kt +++ b/compiler/testData/diagnostics/tests/IncDec.kt @@ -12,7 +12,7 @@ fun testIncDec() { x = x++ x = x-- x = ++x - x = --x + x = --x } class WrongIncDec() { @@ -42,5 +42,5 @@ fun testUnitIncDec() { x = x++ x = x-- x = ++x - x = --x + x = --x } diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.kt b/compiler/testData/diagnostics/tests/LValueAssignment.kt index b9b6d5c165c..3cdb597d207 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.kt +++ b/compiler/testData/diagnostics/tests/LValueAssignment.kt @@ -53,16 +53,16 @@ fun cannotBe() { fun canBe(i0: Int, j: Int) { var i = i0 - (label@ i) = 34 + (label@ i) = 34 - (label@ j) = 34 //repeat for j + (label@ j) = 34 //repeat for j val a = A() (l@ a.a) = 3894 } fun canBe2(j: Int) { - (label@ j) = 34 + (label@ j) = 34 } class A() { diff --git a/compiler/testData/diagnostics/tests/UnusedVariables.kt b/compiler/testData/diagnostics/tests/UnusedVariables.kt index e8106fe91b7..41d55c37268 100644 --- a/compiler/testData/diagnostics/tests/UnusedVariables.kt +++ b/compiler/testData/diagnostics/tests/UnusedVariables.kt @@ -2,14 +2,14 @@ package unused_variables fun testSimpleCases() { var i = 2 - i = 34 + i = 34 i = 34 doSmth(i) - i = 5 + i = 5 var j = 2 j = j++ - j = j-- + j = j-- } class IncDec() { @@ -27,14 +27,14 @@ class MyTest() { 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 + i = 34 $a = v } @@ -46,8 +46,8 @@ class MyTest() { a = "rro" var i = 1; - i = 34; - i = 456; + i = 34; + i = 456; } fun testWhile() { @@ -57,7 +57,7 @@ class MyTest() { a = null } while (b != null) { - a = null + a = null } } @@ -73,10 +73,10 @@ class MyTest() { doSmth(a) if (1 < 2) { - a = 23 + a = 23 } else { - a = "ss" + a = "ss" } } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt index 43369b5c33f..e87866dffdb 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt @@ -54,7 +54,7 @@ fun t2() { class A() {} fun t4(a: A) { - a = A() + a = A() } // ------------------------------------------------ @@ -62,10 +62,10 @@ fun t4(a: A) { fun t1() { val a : Int = 1 - a = 2 + a = 2 var b : Int = 1 - b = 3 + b = 3 } enum class ProtocolState { @@ -83,7 +83,7 @@ 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() { @@ -189,7 +189,7 @@ class AnonymousInitializers(var a: String, val b: String) { } fun reassignFunParams(a: Int) { - a = 1 + a = 1 } open class Open(a: Int, w: Int) {} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt index 039faed8588..a33b6224518 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt609.kt @@ -4,7 +4,7 @@ package kt609 fun test(a: Int) { var aa = a - aa = 324 //should be an 'unused value' warning here + aa = 324 //should be an 'unused value' warning here } class C() { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.kt index d585d77937a..134b2852a2e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.kt @@ -6,5 +6,5 @@ fun foo() { var j = 9 //'unused variable' error var i = 1 //should be an error 'variable i is assigned but never accessed' - i = 2 + i = 2 } diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt index 65bd1fcd1da..8b117ebbd33 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt770.kt351.kt735_StatementType.kt @@ -95,13 +95,13 @@ fun testImplicitCoercion() { var u = when(d) { 3 -> { - z = 34 + z = 34 } else -> z-- } var iff = if (true) { - z = 34 + z = 34 } val g = if (true) 4 val h = if (false) 4 else {} @@ -110,7 +110,7 @@ fun testImplicitCoercion() { 4 } else { - z = 342 + z = 342 }) } @@ -118,9 +118,9 @@ fun bar(a: Unit) {} fun testStatementInExpressionContext() { var z = 34 - val a1: Unit = z = 334 + val a1: Unit = z = 334 val f = for (i in 1..10) {} - if (true) return z = 34 + if (true) return z = 34 return while (true) {} } diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt786.kt b/compiler/testData/diagnostics/tests/controlStructures/kt786.kt index 9eebbedae50..0ef7cfe564e 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt786.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt786.kt @@ -6,7 +6,7 @@ fun foo() : Int { var z = 0 when(d) { 5, 3 -> z++ - else -> { z = -1000 } + else -> { z = -1000 } return z -> 34 } } diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt index e41ee3cd045..e6acb8f3e2f 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/smartcasts/SmartcastsForStableIdentifiers.kt @@ -23,40 +23,40 @@ val x : Any? = 1 fun Any?.vars(a: Any?) : Int { 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 (package.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 } @@ -80,16 +80,16 @@ open class C { fun foo() { 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/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt b/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt index 12d12e75a0c..3cb39dd9435 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt @@ -9,7 +9,7 @@ class A { fun foo(list: List) { for (var (c1, c2, c3) in list) { - c1 = 1 + c1 = 1 c3 + 1 } } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt index 50c4de5b042..a70e60a6ffc 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt2643MultiDeclInControlFlow.kt @@ -17,7 +17,7 @@ fun test2(c: C) { fun test3(c: C) { var (a, b) = c - a = 3 + a = 3 } fun test4(c: C) { diff --git a/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt b/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt index a5e3eb5832c..ad23ed115be 100644 --- a/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt +++ b/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt @@ -5,5 +5,5 @@ enum class E { fun foo() { var e = E.E1 - e = E.E2 + e = E.E2 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/infos/SmartCasts.kt b/compiler/testData/diagnostics/tests/infos/SmartCasts.kt index c4a76ffda9b..e24b4187a1f 100644 --- a/compiler/testData/diagnostics/tests/infos/SmartCasts.kt +++ b/compiler/testData/diagnostics/tests/infos/SmartCasts.kt @@ -169,7 +169,7 @@ fun declarations(a: Any?) { fun vars(a: Any?) { var b: Int = 0 if (a is Int) { - b = a + b = a } } fun returnFunctionLiteralBlock(a: Any?): Function0 { diff --git a/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt b/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt index a46c44e2ded..cb1def0c60b 100644 --- a/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt +++ b/compiler/testData/diagnostics/tests/labels/labelsMustBeNamed.kt @@ -14,7 +14,7 @@ fun foo(a: Any?): Int { var b = 1 - (@ b) = 2 + (@ b) = 2 return@ 1 } diff --git a/compiler/testData/diagnostics/tests/library/kt828.kt b/compiler/testData/diagnostics/tests/library/kt828.kt index 2b14c81a02c..366b7b454b2 100644 --- a/compiler/testData/diagnostics/tests/library/kt828.kt +++ b/compiler/testData/diagnostics/tests/library/kt828.kt @@ -2,11 +2,11 @@ fun test() { var res : Boolean = true res = (res and false) res = (res or false) - res = (res xor false) - res = (true and false) - res = (true or false) - res = (true xor false) - res = (!true) - res = (true && false) - res = (true || false) + res = (res xor false) + res = (true and false) + res = (true or false) + res = (true xor false) + res = (!true) + res = (true && false) + res = (true || false) } diff --git a/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt b/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt index 75cdff2cbb8..facd0830146 100644 --- a/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt +++ b/compiler/testData/diagnostics/tests/regressions/AssignmentsUnderOperators.kt @@ -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 } diff --git a/compiler/testData/diagnostics/tests/regressions/kt235.kt b/compiler/testData/diagnostics/tests/regressions/kt235.kt index b8cfe997aac..98626d92f20 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt235.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt235.kt @@ -13,7 +13,7 @@ fun main(args: Array) { } val h: () -> String = { var x = 1 - x = 2 //the same + x = 2 //the same } val array1 = MyArray1() val i: () -> String = { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt index f29786c46b4..8e1b92138a6 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/JetPsiChecker.kt @@ -45,6 +45,8 @@ import org.jetbrains.kotlin.psi.JetCodeFragment import org.jetbrains.kotlin.psi.JetFile import org.jetbrains.kotlin.psi.JetParameter import org.jetbrains.kotlin.psi.JetReferenceExpression +import org.jetbrains.kotlin.psi.psiUtil.endOffset +import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics import kotlin.platform.platformStatic @@ -93,7 +95,7 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension { assert(diagnostic.getPsiElement() == element) - val textRanges = diagnostic.getTextRanges() + var textRanges = diagnostic.getTextRanges() val factory = diagnostic.getFactory() when (diagnostic.getSeverity()) { Severity.ERROR -> { @@ -147,6 +149,7 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension { if (factory == Errors.UNUSED_PARAMETER && shouldSuppressUnusedParameter(diagnostic.getPsiElement() as JetParameter)) { return } + for (textRange in textRanges) { val annotation = holder.createWarningAnnotation(textRange, getDefaultMessage(diagnostic)) diff --git a/idea/testData/checker/IncDec.kt b/idea/testData/checker/IncDec.kt index b43ade29028..32d8e05f6d3 100644 --- a/idea/testData/checker/IncDec.kt +++ b/idea/testData/checker/IncDec.kt @@ -12,7 +12,7 @@ fun testIncDec() { x = x++ x = x-- x = ++x - x = --x + x = --x } class WrongIncDec() { @@ -42,5 +42,5 @@ fun testUnitIncDec() { x = x++ x = x-- x = ++x - x = --x + x = --x } \ No newline at end of file diff --git a/idea/testData/checker/Unused.kt b/idea/testData/checker/Unused.kt index c21a7877da4..593af6a6eb0 100644 --- a/idea/testData/checker/Unused.kt +++ b/idea/testData/checker/Unused.kt @@ -9,7 +9,7 @@ fun test(unusedParamunusedVar = ":(" // UNUSED_VARIABLE var neverAccessed: Int // ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE - neverAccessed = 2 + neverAccessed = 2 var redundantInitializer = 1 // VARIABLE_WITH_REDUNDANT_INITIALIZER redundantInitializer = 2 diff --git a/idea/testData/checker/infos/SmartCasts.kt b/idea/testData/checker/infos/SmartCasts.kt index a0945641470..72266b9ad49 100644 --- a/idea/testData/checker/infos/SmartCasts.kt +++ b/idea/testData/checker/infos/SmartCasts.kt @@ -165,7 +165,7 @@ fun declarations(a: Any?) { fun vars(a: Any?) { var b: Int = 0 if (a is Int) { - b = a + b = a } } fun returnFunctionLiteralBlock(a: Any?): Function0 { diff --git a/idea/testData/checker/regression/AssignmentsUnderOperators.kt b/idea/testData/checker/regression/AssignmentsUnderOperators.kt index c8825f90731..a92e8e3d10a 100644 --- a/idea/testData/checker/regression/AssignmentsUnderOperators.kt +++ b/idea/testData/checker/regression/AssignmentsUnderOperators.kt @@ -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