diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetFlowInformationProvider.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetFlowInformationProvider.java index 9be8dba2d50..ad2af02b337 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetFlowInformationProvider.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetFlowInformationProvider.java @@ -31,6 +31,7 @@ import org.jetbrains.jet.lang.cfg.PseudocodeVariablesData.VariableInitState; import org.jetbrains.jet.lang.cfg.PseudocodeVariablesData.VariableUseState; import org.jetbrains.jet.lang.cfg.pseudocode.PseudoValue; import org.jetbrains.jet.lang.cfg.pseudocode.Pseudocode; +import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodePackage; import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodeUtil; import org.jetbrains.jet.lang.cfg.pseudocode.instructions.Instruction; import org.jetbrains.jet.lang.cfg.pseudocode.instructions.InstructionVisitor; @@ -50,6 +51,7 @@ import org.jetbrains.jet.lang.diagnostics.DiagnosticFactory; import org.jetbrains.jet.lang.diagnostics.Errors; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.*; +import org.jetbrains.jet.lang.resolve.bindingContextUtil.BindingContextUtilPackage; import org.jetbrains.jet.lang.resolve.calls.TailRecursionKind; import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall; import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver; @@ -121,10 +123,10 @@ public class JetFlowInformationProvider { markUnusedVariables(); - markUnusedLiteralsInBlock(); - markStatements(); + markUnusedExpressions(); + markWhenWithoutElse(); } @@ -666,36 +668,28 @@ public class JetFlowInformationProvider { } //////////////////////////////////////////////////////////////////////////////// -// "Unused literals" in block +// "Unused expressions" in block - public void markUnusedLiteralsInBlock() { + public void markUnusedExpressions() { final Map> reportedDiagnosticMap = Maps.newHashMap(); PseudocodeTraverserPackage.traverse( - pseudocode, FORWARD, new FunctionVoid1() { + pseudocode, FORWARD, new JetFlowInformationProvider.FunctionVoid1() { @Override public void execute(@NotNull Instruction instruction) { - if (!(instruction instanceof ReadValueInstruction || instruction instanceof MagicInstruction)) return; + if (!(instruction instanceof JetElementInstruction)) return; - JetElement element = ((JetElementInstruction) instruction).getElement(); - if (!(element instanceof JetFunctionLiteralExpression - || element instanceof JetConstantExpression - || element instanceof JetStringTemplateExpression - || element instanceof JetSimpleNameExpression)) return; + JetElement element = ((JetElementInstruction)instruction).getElement(); + if (!(element instanceof JetExpression)) return; - if (!(element instanceof JetStringTemplateExpression || instruction instanceof ReadValueInstruction)) return; - - VariableContext ctxt = new VariableContext(instruction, reportedDiagnosticMap); - - PsiElement parent = element.getParent(); - if (parent instanceof JetBlockExpression) { - if (!JetPsiUtil.isImplicitlyUsed(element)) { - if (element instanceof JetFunctionLiteralExpression) { - report(Errors.UNUSED_FUNCTION_LITERAL.on((JetFunctionLiteralExpression) element), ctxt); - } - else { - report(Errors.UNUSED_EXPRESSION.on(element), ctxt); - } - } + if (BindingContextUtilPackage.isUsedAsStatement((JetExpression) element, trace.getBindingContext()) + && PseudocodePackage.getSideEffectFree(instruction)) { + VariableContext ctxt = new VariableContext(instruction, reportedDiagnosticMap); + report( + element instanceof JetFunctionLiteralExpression + ? Errors.UNUSED_FUNCTION_LITERAL.on((JetFunctionLiteralExpression) element) + : Errors.UNUSED_EXPRESSION.on(element), + ctxt + ); } } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/Pseudocode.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/Pseudocode.java index 6e52f330cdc..aeeefff6961 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/Pseudocode.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/Pseudocode.java @@ -64,4 +64,6 @@ public interface Pseudocode { @NotNull List getUsages(@Nullable PseudoValue value); + + boolean isSideEffectFree(@NotNull Instruction instruction); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java index f755edbc7d8..aea1e22e136 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/PseudocodeImpl.java @@ -18,13 +18,16 @@ package org.jetbrains.jet.lang.cfg.pseudocode; import com.google.common.collect.*; import com.intellij.util.containers.BidirectionalMap; +import jet.runtime.typeinfo.JetValueParameter; import kotlin.Function0; +import kotlin.Function1; import kotlin.KotlinPackage; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.cfg.Label; import org.jetbrains.jet.lang.cfg.LoopInfo; import org.jetbrains.jet.lang.cfg.pseudocode.instructions.*; +import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.InstructionWithValue; import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.MergeInstruction; import org.jetbrains.jet.lang.cfg.pseudocode.instructions.jumps.AbstractJumpInstruction; import org.jetbrains.jet.lang.cfg.pseudocode.instructions.jumps.ConditionalJumpInstruction; @@ -95,6 +98,7 @@ public class PseudocodeImpl implements Pseudocode { private final Map> valueUsages = Maps.newHashMap(); private final Map> mergedValues = Maps.newHashMap(); + private final Set sideEffectFree = Sets.newHashSet(); private Pseudocode parent = null; private Set localDeclarations = null; @@ -239,6 +243,9 @@ public class PseudocodeImpl implements Pseudocode { addValueUsage(mergedValue, instruction); } } + if (PseudocodePackage.calcSideEffectFree(instruction)) { + sideEffectFree.add(instruction); + } } /*package*/ void recordLoopInfo(JetExpression expression, LoopInfo blockInfo) { @@ -283,6 +290,11 @@ public class PseudocodeImpl implements Pseudocode { return result != null ? result : Collections.emptyList(); } + @Override + public boolean isSideEffectFree(@NotNull Instruction instruction) { + return sideEffectFree.contains(instruction); + } + /*package*/ void bindElementToValue(@NotNull JetElement element, @NotNull PseudoValue value) { elementsToValues.put(element, value); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt index 23b5d577751..7618bbcc5ae 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/instructions/eval/operationInstructions.kt @@ -131,25 +131,25 @@ public class MagicInstruction( } } -public enum class MagicKind { +public enum class MagicKind(val sideEffectFree: Boolean = false) { // builtin operations - STRING_TEMPLATE - AND - OR - NOT_NULL_ASSERTION - EQUALS_IN_WHEN_CONDITION - IS - CAST - CALLABLE_REFERENCE + STRING_TEMPLATE: MagicKind(true) + AND: MagicKind(true) + OR: MagicKind(true) + NOT_NULL_ASSERTION: MagicKind() + EQUALS_IN_WHEN_CONDITION: MagicKind() + IS: MagicKind() + CAST: MagicKind() + CALLABLE_REFERENCE: MagicKind(true) // implicit operations - LOOP_RANGE_ITERATION - IMPLICIT_RECEIVER - VALUE_CONSUMER + LOOP_RANGE_ITERATION: MagicKind() + IMPLICIT_RECEIVER: MagicKind() + VALUE_CONSUMER: MagicKind() // unrecognized operations - UNRESOLVED_CALL - UNSUPPORTED_ELEMENT - UNRECOGNIZED_WRITE_RHS - FAKE_INITIALIZER + UNRESOLVED_CALL: MagicKind() + UNSUPPORTED_ELEMENT: MagicKind() + UNRECOGNIZED_WRITE_RHS: MagicKind() + FAKE_INITIALIZER: MagicKind() } // Merges values produced by alternative control-flow paths (such as 'if' branches) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/pseudocodeUtil.kt b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/pseudocodeUtil.kt index 2cc1a11f002..6bb4197c948 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/pseudocodeUtil.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/pseudocodeUtil.kt @@ -16,7 +16,6 @@ package org.jetbrains.jet.lang.cfg.pseudocode -import org.jetbrains.jet.lang.cfg.pseudocodeTraverser.* import org.jetbrains.jet.lang.cfg.pseudocode.instructions.* import org.jetbrains.jet.lang.cfg.pseudocode.instructions.eval.* import org.jetbrains.jet.lang.cfg.pseudocode.instructions.jumps.* @@ -31,7 +30,7 @@ import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue import org.jetbrains.jet.lang.resolve.OverridingUtil import org.jetbrains.jet.lang.types.TypeUtils import org.jetbrains.jet.lang.types.JetType -import org.jetbrains.jet.lang.cfg.pseudocode.instructions.special.LocalFunctionDeclarationInstruction +import org.jetbrains.jet.lang.descriptors.impl.LocalVariableDescriptor fun getReceiverTypePredicate(resolvedCall: ResolvedCall<*>, receiverValue: ReceiverValue): TypePredicate? { val callableDescriptor = resolvedCall.getResultingDescriptor() @@ -134,4 +133,32 @@ public fun Instruction.getPrimaryDeclarationDescriptorIfAny(bindingContext: Bind is CallInstruction -> return resolvedCall.getResultingDescriptor() else -> PseudocodeUtil.extractVariableDescriptorIfAny(this, false, bindingContext) } +} + +public val Instruction.sideEffectFree: Boolean + get() = owner.isSideEffectFree(this) + +private fun Instruction.calcSideEffectFree(): Boolean { + if (this !is InstructionWithValue) return false + if (!inputValues.all { it.createdAt?.sideEffectFree ?: false }) return false + + return when (this) { + is ReadValueInstruction -> target.let { + when (it) { + is AccessTarget.Call -> when (it.resolvedCall.getResultingDescriptor()) { + is LocalVariableDescriptor, is ValueParameterDescriptor, is ReceiverParameterDescriptor -> true + else -> false + } + + else -> when (element) { + is JetConstantExpression, is JetFunctionLiteralExpression, is JetStringTemplateExpression -> true + else -> false + } + } + } + + is MagicInstruction -> kind.sideEffectFree + + else -> false + } } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java index eae6507a6c2..72c4c7653c4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiUtil.java @@ -282,29 +282,6 @@ public class JetPsiUtil { return null; } - public static boolean isImplicitlyUsed(@NotNull JetElement element) { - PsiElement parent = element.getParent(); - if (!(parent instanceof JetBlockExpression)) return true; - JetBlockExpression block = (JetBlockExpression) parent; - List statements = block.getStatements(); - if (statements.get(statements.size() - 1) == element) { - JetExpression expression = getDirectParentOfTypeForBlock(block, JetIfExpression.class); - if (expression == null) { - expression = getDirectParentOfTypeForBlock(block, JetWhenExpression.class); - } - if (expression == null) { - expression = getDirectParentOfTypeForBlock(block, JetFunctionLiteral.class); - } - if (expression == null) { - expression = getDirectParentOfTypeForBlock(block, JetTryExpression.class); - } - if (expression != null) { - return isImplicitlyUsed(expression); - } - } - return false; - } - public static void deleteClass(@NotNull JetClassOrObject clazz) { CheckUtil.checkWritable(clazz); JetFile file = clazz.getContainingJetFile(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java index 5a8db92d6d2..c07b946e1bd 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java @@ -265,7 +265,6 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { else { facade.getTypeInfo(body, context.replaceScope(context.scope)); } - context.trace.report(UNUSED_FUNCTION_LITERAL.on(function)); } else if (body != null) { WritableScope writableScope = newWritableScopeImpl(context, "do..while body scope"); diff --git a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt index 0dafd7cc23a..3e1c08355c0 100644 --- a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt +++ b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt @@ -25,7 +25,7 @@ fun f(): Unit { x in 1..2 val y : Boolean? = true - false || y - y && true - y && 1 -} + false || y + y && true + y && 1 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt index f3af710b86e..b7f3f2c2507 100644 --- a/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/FunctionReturnTypes.kt @@ -47,7 +47,7 @@ fun blockReturnValueTypeMatch() : Int {return 1} fun blockReturnValueTypeMismatchUnit() : Int {return Unit} fun blockAndAndMismatch() : Int { - true && false + true && false } fun blockAndAndMismatch1() : Int { return true && false @@ -57,7 +57,7 @@ fun blockAndAndMismatch2() : Int { } fun blockAndAndMismatch3() : Int { - true || false + true || false } fun blockAndAndMismatch4() : Int { return true || false @@ -91,18 +91,18 @@ fun blockReturnValueTypeMatch6() : Int { } fun blockReturnValueTypeMatch7() : Int { if (1 > 2) - 1.0 - else 2.0 + 1.0 + else 2.0 } fun blockReturnValueTypeMatch8() : Int { if (1 > 2) - 1.0 - else 2.0 + 1.0 + else 2.0 return 1 } fun blockReturnValueTypeMatch9() : Int { if (1 > 2) - 1.0 + 1.0 } fun blockReturnValueTypeMatch10() : Int { return if (1 > 2) @@ -110,7 +110,7 @@ fun blockReturnValueTypeMatch10() : Int { } fun blockReturnValueTypeMatch11() : Int { if (1 > 2) - else 1.0 + else 1.0 } fun blockReturnValueTypeMatch12() : Int { if (1 > 2) diff --git a/compiler/testData/diagnostics/tests/StringTemplates.kt b/compiler/testData/diagnostics/tests/StringTemplates.kt index b9471dba648..9ad14cef8e1 100644 --- a/compiler/testData/diagnostics/tests/StringTemplates.kt +++ b/compiler/testData/diagnostics/tests/StringTemplates.kt @@ -12,11 +12,11 @@ fun demo() { "$.$.asdf$\t" "asd\$" "asd$a\x" - "asd$a$asd$ $xxx" - "fosdfasdo${1 + bar + 100}}sdsdfgdsfsdf" - "foo${bar + map {foo}}sdfsdf" - "foo${bar + map { "foo" }}sdfsdf" - "foo${bar + map { - "foo$sdf${ buzz{}}" }}sdfsdf" + "asd$a$asd$ $xxx" + "fosdfasdo${1 + bar + 100}}sdsdfgdsfsdf" + "foo${bar + map {foo}}sdfsdf" + "foo${bar + map { "foo" }}sdfsdf" + "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/controlFlowAnalysis/deadCode/deadCodeInIf.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInIf.kt index 283281aecc3..70eb69309bd 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInIf.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInIf.kt @@ -3,7 +3,7 @@ fun testIf() { } fun testIf1(b: Boolean) { - if (b) todo() else 1 + if (b) todo() else 1 bar() } diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt b/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt index c02370c32be..7f7c701207d 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt1075.kt @@ -5,7 +5,7 @@ package kt1075 fun foo(b: String) { if (b in 1..10) {} //type mismatch when (b) { - in 1..10 -> 1 //no type mismatch, but it should be here - else -> 2 + in 1..10 -> 1 //no type mismatch, but it should be here + else -> 2 } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt786.kt b/compiler/testData/diagnostics/tests/controlStructures/kt786.kt index 773211813b6..9eebbedae50 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt786.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt786.kt @@ -15,7 +15,7 @@ fun foo() : Int { fun fff(): Int { var d = 3 when(d) { - 4 -> 21 + 4 -> 21 return 2 -> return 47 bar() -> 45 444 -> true diff --git a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt index c3bf067652b..5836f49dd90 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt @@ -21,7 +21,7 @@ fun test1(t : Pair) : Int { } //more tests -fun t1(x: Int) = when(x) { +fun t1(x: Int) = when(x) { else -> 1 } diff --git a/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt b/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt index f8f04bdadea..bdeb3b13eaa 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/WhenSubject.kt @@ -4,7 +4,7 @@ class BinOp(val operator : String) : Expr fun test(e : Expr) { if (e is BinOp) { when (e.operator) { - else -> 0 + else -> 0 } } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt index 0f4799b9755..f70ee3e4745 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/kt5155WhenBranches.kt @@ -2,13 +2,10 @@ fun foo(s: String?) { when { - s == null -> 1 - s.foo() -> 2 - else -> 3 + s == null -> 1 + s.foo() -> 2 + else -> 3 } } -fun String.foo() = true - - - +fun String.foo() = true \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index 3b4d5c9b005..7c6bf288f21 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -71,5 +71,5 @@ import outer.* val c = Command() c?.equals2(null) - if (command == null) 1 + if (command == null) 1 } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt index 10edbc1d7ee..0ee0afc0f92 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt @@ -9,4 +9,4 @@ fun unusedLiteralInDoWhile(){ do{() -> val i = 1 } while(false) -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt b/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt index a4510fc8b5d..07767db56ed 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION package d trait A diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt index e169c711d74..79c3cde1c46 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteWhen.kt @@ -1,3 +1,3 @@ fun test(a: Any) { - when (a) + when (a) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/incompleteCode/senselessComparisonWithNull.kt b/compiler/testData/diagnostics/tests/incompleteCode/senselessComparisonWithNull.kt index c68923aad7b..5cc693264b7 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/senselessComparisonWithNull.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/senselessComparisonWithNull.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION package d fun foo(a : IntArray) { diff --git a/compiler/testData/diagnostics/tests/inline/parenthesized.kt b/compiler/testData/diagnostics/tests/inline/parenthesized.kt index 2b86d3c4a0f..bb4e5514ae9 100644 --- a/compiler/testData/diagnostics/tests/inline/parenthesized.kt +++ b/compiler/testData/diagnostics/tests/inline/parenthesized.kt @@ -2,21 +2,21 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) { (s)(11) (s).invoke(11) (s) invoke 11 - (s) + (s) } inline fun Function1.inlineExt() { (this).invoke(11) (this) invoke 11 (this)(11) - (this) + (this) } inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) { (((s)))(11) (((s))).invoke(11) (((s))) invoke 11 - (((s))) + (((s))) } inline fun propagation(s: (p: Int) -> Unit) { diff --git a/compiler/testData/diagnostics/tests/inline/sam.kt b/compiler/testData/diagnostics/tests/inline/sam.kt index 6be31f27356..845263fd63b 100644 --- a/compiler/testData/diagnostics/tests/inline/sam.kt +++ b/compiler/testData/diagnostics/tests/inline/sam.kt @@ -51,7 +51,7 @@ inline fun Function1.inlineExt() { this invoke 11 this(11) - this + this 11 } diff --git a/compiler/testData/diagnostics/tests/inline/typed.kt b/compiler/testData/diagnostics/tests/inline/typed.kt index cbdba08de33..9faf006aa97 100644 --- a/compiler/testData/diagnostics/tests/inline/typed.kt +++ b/compiler/testData/diagnostics/tests/inline/typed.kt @@ -2,7 +2,7 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) { (s: (p: Int) -> Unit)(11) (s: (p: Int) -> Unit).invoke(11) (s: (p: Int) -> Unit) invoke 11 - (s) + (s) } inline fun Function1.inlineExt() { @@ -18,4 +18,4 @@ inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) { (((s: (p: Int) -> Unit): (p: Int) -> Unit): (p: Int) -> Unit).invoke(11) (((s: (p: Int) -> Unit): (p: Int) -> Unit): (p: Int) -> Unit) invoke 11 (((s: (p: Int) -> Unit))) -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/kt2619.kt b/compiler/testData/diagnostics/tests/j+k/kt2619.kt index 7930e7fb05e..8918e35a301 100644 --- a/compiler/testData/diagnostics/tests/j+k/kt2619.kt +++ b/compiler/testData/diagnostics/tests/j+k/kt2619.kt @@ -1,7 +1,7 @@ //FILE: foo.kt fun main(args: Array) { val c: Type - when (c) { + when (c) { } } diff --git a/compiler/testData/diagnostics/tests/labels/kt361.kt b/compiler/testData/diagnostics/tests/labels/kt361.kt index f0a4fef09f4..0a08e5df724 100644 --- a/compiler/testData/diagnostics/tests/labels/kt361.kt +++ b/compiler/testData/diagnostics/tests/labels/kt361.kt @@ -1,5 +1,5 @@ fun nonlocals(b : Boolean) { - @a{(): Int -> + @a{(): Int -> fun foo() { if (b) { return@a 1 // The label must be resolved, but an error should be reported for a non-local return @@ -7,6 +7,5 @@ fun nonlocals(b : Boolean) { } return@a 5 - } -} - + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/labels/labelReferencesInsideObjectExpressions.kt b/compiler/testData/diagnostics/tests/labels/labelReferencesInsideObjectExpressions.kt index 9e958a6906e..72eaf7d426c 100644 --- a/compiler/testData/diagnostics/tests/labels/labelReferencesInsideObjectExpressions.kt +++ b/compiler/testData/diagnostics/tests/labels/labelReferencesInsideObjectExpressions.kt @@ -15,11 +15,11 @@ fun B.b() { } fun test() { - @b { B.() -> + @b { B.() -> object : A { override fun foo() { this@b.bar() } } - } -} + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/Jet69.kt b/compiler/testData/diagnostics/tests/regressions/Jet69.kt index 7d5dc169de8..604c731552a 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet69.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet69.kt @@ -6,5 +6,5 @@ fun Any.equals(other : Any?) : Boolean = this === other fun main(args: Array) { val command = parse("") - if (command == null) 1 // error on this line, but must be OK -} + if (command == null) 1 // error on this line, but must be OK +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt847.kt b/compiler/testData/diagnostics/tests/regressions/kt847.kt index 883fcf63b79..0f9ecd9fca0 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt847.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt847.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION fun T.mustBe(t : T) { - "$this must be$as$t" -} + "$this must be$as$t" +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/unresolvedInvoke.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/unresolvedInvoke.kt index 2432933fe05..3d8d9bf59c2 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/unresolvedInvoke.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/unresolvedInvoke.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION fun foo(i: Int) { i() 1() diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt b/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt index 4a8aeefdc75..bffba2c0093 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/QualifiedThis.kt @@ -1,9 +1,9 @@ // FILE: f.kt class A() { fun foo() : Unit { - this@A + this@A this@a - this + this } val x = this@A.foo() diff --git a/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt b/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt index 2699424184f..35934fb79a4 100644 --- a/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt +++ b/compiler/testData/diagnostics/tests/thisAndSuper/superIsNotAnExpression.kt @@ -5,7 +5,7 @@ fun notAnExpression() { if (super) {} else {} // not an expression val x = super // not an expression when (1) { - super -> 1 // not an expression + super -> 1 // not an expression else -> {} } diff --git a/compiler/testData/diagnostics/tests/when/When.kt b/compiler/testData/diagnostics/tests/when/When.kt index ec84bc61415..f887f0ebb4b 100644 --- a/compiler/testData/diagnostics/tests/when/When.kt +++ b/compiler/testData/diagnostics/tests/when/When.kt @@ -4,15 +4,15 @@ fun foo() : Int { val s = "" val x = 1 when (x) { - is String -> 1 - !is Int -> 1 - is Any? -> 1 - s -> 1 - 1 -> 1 - 1 + a -> 1 - in 1..a -> 1 - !in 1..a -> 1 - else -> 1 + is String -> 1 + !is Int -> 1 + is Any? -> 1 + s -> 1 + 1 -> 1 + 1 + a -> 1 + in 1..a -> 1 + !in 1..a -> 1 + else -> 1 } return 0 @@ -25,20 +25,20 @@ fun test() { val s = ""; when (x) { - s -> 1 - "" -> 1 - x -> 1 - 1 -> 1 + s -> 1 + "" -> 1 + x -> 1 + 1 -> 1 } val z = 1 when (z) { - else -> 1 + else -> 1 1 -> 2 } - when (z) { - else -> 1 + when (z) { + else -> 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/abstractClassConstructors.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/abstractClassConstructors.kt index ffb028d4da8..d64483c26b0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/abstractClassConstructors.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/abstractClassConstructors.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION trait A abstract class B annotation class C @@ -8,4 +9,4 @@ fun main() { ::B ::C // KT-3465 ::D -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/ambiguityTopLevelVsTopLevel.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/ambiguityTopLevelVsTopLevel.kt index 1a6172619bd..56f505bec6a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/ambiguityTopLevelVsTopLevel.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/ambiguityTopLevelVsTopLevel.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION fun foo(x: Int, y: Any) = x fun foo(x: Any, y: Int) = y @@ -5,4 +6,4 @@ fun main() { ::foo ::foo : (Int, Any) -> Unit -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/differentPackageExtension.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/differentPackageExtension.kt index f38f0066a55..28ad3f4a0bd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/differentPackageExtension.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/differentPackageExtension.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION // FILE: a.kt package first @@ -23,4 +24,4 @@ fun main() { A::baz x : KExtensionFunction0 -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/extensionInClassDisallowed.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/extensionInClassDisallowed.kt index 7700ca2c22b..82fd291a47e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/extensionInClassDisallowed.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/extensionInClassDisallowed.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION class A { fun Int.extInt() = 42 fun A.extA(x: String) = x @@ -11,4 +12,4 @@ class A { fun main() { A::extInt A::extA -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/importedInnerConstructor.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/importedInnerConstructor.kt index a7d431a21e6..9fffdfbffdf 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/importedInnerConstructor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/importedInnerConstructor.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION import A.Inner class A { @@ -6,4 +7,4 @@ class A { fun main() { ::Inner -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromClass.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromClass.kt index d9054508aab..229f673e166 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromClass.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromClass.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION import kotlin.reflect.KMemberFunction0 class A { @@ -28,4 +29,4 @@ class B { y : KMemberFunction0 } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromExtension.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromExtension.kt index c5d6df1fda4..159ddefae5b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromExtension.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromExtension.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION import kotlin.reflect.KMemberFunction0 class A { @@ -17,4 +18,4 @@ fun Int.main() { val y = A::Inner y : KMemberFunction0 -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromTopLevel.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromTopLevel.kt index e34e9399877..681ed603574 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromTopLevel.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/innerConstructorFromTopLevel.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION import kotlin.reflect.KMemberFunction0 class A { @@ -9,4 +10,4 @@ fun main() { val y = A::Inner y : KMemberFunction0 -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromClass.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromClass.kt index 2cdcc7910eb..2884dfa3d30 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromClass.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromClass.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION import kotlin.reflect.KFunction0 class A { @@ -28,4 +29,4 @@ class B { y : KFunction0 } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromExtension.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromExtension.kt index 007cf137c21..e002f6de142 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromExtension.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/nestedConstructorFromExtension.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION import kotlin.reflect.KFunction0 class A { @@ -16,4 +17,4 @@ fun Int.main() { val y = A::Nested y : KFunction0 -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/noAmbiguityLocalVsTopLevel.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/noAmbiguityLocalVsTopLevel.kt index a94e4f406b4..77ed0bde41f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/noAmbiguityLocalVsTopLevel.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/noAmbiguityLocalVsTopLevel.kt @@ -1,7 +1,8 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION fun bar() = 42 fun main() { fun bar() = 239 ::bar -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/unresolved.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/unresolved.kt index 7f25900280f..f4659d296b6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/unresolved.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/function/unresolved.kt @@ -1,3 +1,4 @@ +// !DIAGNOSTICS: -UNUSED_EXPRESSION class A fun main() { @@ -8,4 +9,4 @@ fun main() { A::bar B::bar -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/callableReference/unused.kt b/compiler/testData/diagnostics/testsWithStdLib/callableReference/unused.kt new file mode 100644 index 00000000000..3ed2441492a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/callableReference/unused.kt @@ -0,0 +1,23 @@ +fun foo() { + +} + +class A { + fun foo() { + + } + + class B +} + +fun A.bar() { + +} + +fun test() { + ::foo + ::A + A::B + A::foo + A::bar +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithStdLibGenerated.java index 75d6fb5c3fa..714ea6aa889 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithStdLibGenerated.java @@ -111,6 +111,11 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/testsWithStdLib/callableReference"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("unused.kt") + public void testUnused() throws Exception { + doTest("compiler/testData/diagnostics/testsWithStdLib/callableReference/unused.kt"); + } + @TestMetadata("compiler/testData/diagnostics/testsWithStdLib/callableReference/function") public static class Function extends AbstractJetDiagnosticsTestWithStdLib { @TestMetadata("abstractClassConstructors.kt") diff --git a/idea/testData/checker/BinaryCallsOnNullableValues.kt b/idea/testData/checker/BinaryCallsOnNullableValues.kt index 8afde70b013..6b1cd9b8c20 100644 --- a/idea/testData/checker/BinaryCallsOnNullableValues.kt +++ b/idea/testData/checker/BinaryCallsOnNullableValues.kt @@ -25,7 +25,7 @@ fun f(): Unit { x in 1..2 val y : Boolean? = true - false || y - y && true - y && 1 + false || y + y && true + y && 1 } \ No newline at end of file diff --git a/idea/testData/checker/ExtensionFunctions.kt b/idea/testData/checker/ExtensionFunctions.kt index 6f0f7701ac7..3f4cf4ae19f 100644 --- a/idea/testData/checker/ExtensionFunctions.kt +++ b/idea/testData/checker/ExtensionFunctions.kt @@ -66,5 +66,5 @@ fun Int.foo() = this val c = Command() c?.equals2(null) - if (command == null) 1 + if (command == null) 1 } diff --git a/idea/testData/checker/FunctionReturnTypes.kt b/idea/testData/checker/FunctionReturnTypes.kt index 0a175e753be..a22d9559e38 100644 --- a/idea/testData/checker/FunctionReturnTypes.kt +++ b/idea/testData/checker/FunctionReturnTypes.kt @@ -42,7 +42,7 @@ fun blockReturnValueTypeMatch() : Int {return 1} fun blockReturnValueTypeMismatchUnit() : Int {return Unit} fun blockAndAndMismatch() : Int { - true && false + true && false } fun blockAndAndMismatch1() : Int { return true && false @@ -52,7 +52,7 @@ fun blockAndAndMismatch2() : Int { } fun blockAndAndMismatch3() : Int { - true || false + true || false } fun blockAndAndMismatch4() : Int { return true || false @@ -86,18 +86,18 @@ fun blockReturnValueTypeMatch6() : Int { } fun blockReturnValueTypeMatch7() : Int { if (1 > 2) - 1.0 - else 2.0 + 1.0 + else 2.0 } fun blockReturnValueTypeMatch8() : Int { if (1 > 2) - 1.0 - else 2.0 + 1.0 + else 2.0 return 1 } fun blockReturnValueTypeMatch9() : Int { if (1 > 2) - 1.0 + 1.0 } fun blockReturnValueTypeMatch10() : Int { return if (1 > 2) @@ -105,7 +105,7 @@ fun blockReturnValueTypeMatch10() : Int { } fun blockReturnValueTypeMatch11() : Int { if (1 > 2) - else 1.0 + else 1.0 } fun blockReturnValueTypeMatch12() : Int { if (1 > 2) diff --git a/idea/testData/checker/QualifiedThis.kt b/idea/testData/checker/QualifiedThis.kt index 5d35aa36d88..519a02e5723 100644 --- a/idea/testData/checker/QualifiedThis.kt +++ b/idea/testData/checker/QualifiedThis.kt @@ -6,9 +6,9 @@ class Dup { class A() { fun foo() : Unit { - this@A + this@A this@a - this + this } val x = this@A.foo() diff --git a/idea/testData/checker/When.kt b/idea/testData/checker/When.kt index 7b7afdebfc3..fade41566c0 100644 --- a/idea/testData/checker/When.kt +++ b/idea/testData/checker/When.kt @@ -4,15 +4,15 @@ fun foo() : Int { val s = "" val x = 1 when (x) { - is String -> 1 - !is Int -> 1 - is Any? -> 1 - s -> 1 - 1 -> 1 - 1 + a -> 1 - in 1..a -> 1 - !in 1..a -> 1 - else -> 1 + is String -> 1 + !is Int -> 1 + is Any? -> 1 + s -> 1 + 1 -> 1 + 1 + a -> 1 + in 1..a -> 1 + !in 1..a -> 1 + else -> 1 } return 0 @@ -25,21 +25,21 @@ fun test() { val s = ""; when (x) { - s -> 1 - "" -> 1 - x -> 1 - 1 -> 1 - else -> 1 + s -> 1 + "" -> 1 + x -> 1 + 1 -> 1 + else -> 1 } val z = 1 when (z) { - else -> 1 + else -> 1 1 -> 2 } - when (z) { - else -> 1 + when (z) { + else -> 1 } } \ No newline at end of file diff --git a/idea/testData/checker/regression/Jet69.kt b/idea/testData/checker/regression/Jet69.kt index 346a98fd25a..2768b807251 100644 --- a/idea/testData/checker/regression/Jet69.kt +++ b/idea/testData/checker/regression/Jet69.kt @@ -6,5 +6,5 @@ fun Any.equals(other : Any?) : Boolean = this === other fun main(args: Array) { val command = parse("") - if (command == null) 1 // error on this line, but must be OK + if (command == null) 1 // error on this line, but must be OK } diff --git a/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt b/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt index 8ecf6f18705..05a699b0156 100644 --- a/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt +++ b/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt @@ -1,8 +1,7 @@ // "Suppress 'UNUSED_EXPRESSION' for statement " "true" fun foo() { + val a = 1 [suppress("UNUSED_EXPRESSION")] a -} - -val a = 1 \ No newline at end of file +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt b/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt index adb23c57996..178b4ae00bb 100644 --- a/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt +++ b/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt @@ -1,7 +1,6 @@ // "Suppress 'UNUSED_EXPRESSION' for statement " "true" fun foo() { + val a = 1 a -} - -val a = 1 \ No newline at end of file +} \ No newline at end of file