From 6dd082592126c82f4ced8e92a6c605eaf388cffc Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Thu, 26 Nov 2015 15:56:56 +0300 Subject: [PATCH] Fix tests: "infix modifier required" and "operator modifier required" errors GitOrigin-RevId: 1abe9dbc56ccf5e2c31050ac25f0fb1480dd8926 --- .../intentions/IntentionTestGenerated.java | 48 ------------------- .../recursiveCall/conventionCall.kt | 16 +++---- .../classMembers/DelegatedProperty.kt | 2 +- .../packageMembers/DelegatedProperty.kt | 2 +- .../fromLoadJava/library/Max.kt | 2 +- .../compiledKotlin/prop/VarWithDelegated.kt | 4 +- .../compiledKotlin/prop/VarWithDelegated.txt | 4 +- .../imports/ExtensionAsInfixOrOperator.kt | 4 +- .../imports/ExtensionConflict.expected.kt | 14 +++--- .../imports/ExtensionConflict.expected.names | 2 +- .../copyPaste/imports/ExtensionConflict.kt | 6 +-- .../copyPaste/imports/ExtensionConflict.to.kt | 6 +-- .../testData/copyPaste/imports/ForLoop.kt | 6 +-- .../copyPaste/imports/GetExpression.kt | 2 +- .../testData/copyPaste/imports/Invoke.kt | 2 +- .../copyPaste/imports/MultiDeclaration.kt | 4 +- .../MultiReferencePartiallyCopied.expected.kt | 2 +- .../imports/MultiReferencePartiallyCopied.kt | 6 +-- .../testData/debugger/smartStepInto/unary.kt | 8 ++-- .../tinyApp/outs/delegatedPropertyInClass.out | 4 +- .../delegatedPropertyInClassWoRenderer.out | 2 +- .../withoutBodyTypeParameters.kt | 2 +- .../singleBreakpoint/dependentOnFile.kt | 2 +- .../extractVariablesFromCall.kt | 2 +- .../frame/delegatedPropertyInClass.kt | 4 +- .../delegatedPropertyInClassWoRenderer.kt | 2 +- .../singleBreakpoint/typeParameterRef.kt | 4 +- .../kotlin/conventions/unaryMinus.0.kt | 4 +- .../kotlin/conventions/unaryMinus.results.txt | 2 +- .../conditionInvalidBinaryExp.kt | 2 +- .../conditionInvalidBinaryExp.kt | 2 +- .../conditionInvalidBinaryExp.kt | 2 +- .../conditionNotBinaryExpr.kt | 2 +- .../complexPlus.kt | 8 ++-- .../complexPlus.kt.after | 8 ++-- .../extensionFunction.kt | 2 +- .../extensionFunction.kt.after | 2 +- .../minusSanityTest.kt | 2 +- .../minusSanityTest.kt.after | 2 +- .../replaceCallWithUnaryOperator/plusPlus.kt | 2 +- .../plusPlus.kt.after | 2 +- .../plusSanityTest.kt | 2 +- .../plusSanityTest.kt.after | 2 +- .../replaceCallWithUnaryOperator/qualifier.kt | 2 +- .../qualifier.kt.after | 2 +- .../replaceCallWithUnaryOperator/super.kt | 2 +- .../typeArguments.kt | 2 +- .../convertForEachToForLoop/infixCall.kt | 2 +- .../infixCallNotAvailable.kt | 2 +- .../parenthesizedExpression.kt | 5 +- .../parenthesizedExpression.kt.after | 5 +- .../convertFunctionToProperty/invoke.kt | 2 +- .../convertFunctionToProperty/iterator.kt | 2 +- .../convertFunctionToProperty/unaryOp.kt | 2 +- .../doubleNegation.kt | 2 +- .../doubleNegation.kt.after | 2 +- .../nonstandardPrefixOperator.kt | 2 +- .../nonstandardPrefixOperator.kt.after | 2 +- .../binaryExpressionLoopRange.kt | 2 +- .../binaryExpressionLoopRange.kt.after | 2 +- .../functionLiteralArgument.kt | 2 +- .../functionLiteralArgument.kt.after | 2 +- .../infixCallToOrdinary/nullAssertedCall.kt | 2 + .../nullAssertedCall.kt.after | 2 + .../parenthesesAroundRightHandArgument.kt | 4 +- ...arenthesesAroundRightHandArgument.kt.after | 4 +- .../simpleInfixFunctionCall.kt | 2 + .../simpleInfixFunctionCall.kt.after | 2 + .../arrayAccessMultipleIndex.kt | 2 +- .../arrayAccessMultipleIndex.kt.after | 2 +- .../operatorToFunction/binaryPlusEquals.kt | 2 +- .../binaryPlusEquals.kt.after | 2 +- .../functionCallMultipleArgument.kt | 2 +- .../functionCallMultipleArgument.kt.after | 2 +- ...allWithMultipleArgumentsAndSingleLambda.kt | 2 +- ...hMultipleArgumentsAndSingleLambda.kt.after | 2 +- .../functionCallWithSingleLambda.kt | 2 +- .../functionCallWithSingleLambda.kt.after | 2 +- .../necessaryParentheses5.kt | 4 +- .../unnecessaryParentheses3.kt | 2 +- .../unnecessaryParentheses3.kt.after | 2 +- .../unnecessaryParentheses4.kt | 4 +- .../unnecessaryParentheses4.kt.after | 4 +- .../unnecessaryParentheses8.kt | 2 +- .../unnecessaryParentheses8.kt.after | 2 +- .../simplifyNegatedBinaryExpression/in.kt | 2 +- .../in.kt.after | 2 +- .../inapplicableBinaryOperation.kt | 2 +- .../simplifyNegatedBinaryExpression/notIn.kt | 2 +- .../notIn.kt.after | 2 +- .../swapBinaryExpression/compareTo.kt | 4 -- .../swapBinaryExpression/divideLiteral.kt | 4 -- .../swapBinaryExpression/equalsLiteral.kt | 3 -- .../equalsLiteral.kt.after | 3 -- .../identityEqualsLiteral.kt | 3 -- .../identityEqualsLiteral.kt.after | 3 -- .../swapBinaryExpression/infixFunction.kt | 2 +- .../swapBinaryExpression/minusLiteral.kt | 4 -- .../swapBinaryExpression/plusLiteral.kt | 3 -- .../swapBinaryExpression/plusLiteral.kt.after | 3 -- .../swapBinaryExpression/rangeTo.kt | 2 +- .../swapBinaryExpression/rangeToLiteral.kt | 8 ---- .../swapBinaryExpression/timesLiteral.kt | 3 -- .../timesLiteral.kt.after | 3 -- .../autoImports/delegateExtensionSet.test | 4 +- ...ExtensionImportGetOnNoOperatorWarning.test | 2 + ...ExtensionImportSetOnNoOperatorWarning.test | 2 + .../addNameToArgument/invokeOnString.kt | 2 +- .../addNameToArgument/invokeOnString.kt.after | 2 +- .../customOperationOnUserType.kt | 1 + .../customOperationOnUserType.kt.after | 1 + .../binaryOperations/quotedName.kt | 2 + .../binaryOperations/quotedName.kt.after | 2 + .../component/createComponentFromUsage1.kt | 4 +- .../createComponentFromUsage1.kt.after | 4 +- .../component/createComponentFromUsage2.kt | 4 +- .../createComponentFromUsage2.kt.after | 4 +- .../component/createComponentFromUsage3.kt | 8 ++-- .../createComponentFromUsage3.kt.after | 8 ++-- .../delegateAccessors/varMissingGet.kt | 2 +- .../delegateAccessors/varMissingGet.kt.after | 2 +- .../delegateAccessors/varMissingSet.kt | 2 +- .../delegateAccessors/varMissingSet.kt.after | 2 +- .../createFunction/get/createGetFromUsage1.kt | 2 + .../get/createGetFromUsage1.kt.after | 2 + .../get/createGetFromUsage10.kt | 2 + .../get/createGetFromUsage10.kt.after | 2 + .../get/createGetFromUsage11.kt | 2 + .../get/createGetFromUsage11.kt.after | 2 + .../get/createGetFromUsage12.kt | 2 + .../get/createGetFromUsage12.kt.after | 2 + .../get/createGetFromUsage13.kt | 2 + .../get/createGetFromUsage13.kt.after | 2 + .../createFunction/get/createGetFromUsage2.kt | 2 + .../get/createGetFromUsage2.kt.after | 2 + .../createFunction/get/createGetFromUsage3.kt | 2 + .../get/createGetFromUsage3.kt.after | 2 + .../createFunction/get/createGetFromUsage4.kt | 2 + .../get/createGetFromUsage4.kt.after | 2 + .../createFunction/get/createGetFromUsage5.kt | 2 + .../get/createGetFromUsage5.kt.after | 2 + .../createFunction/get/createGetFromUsage7.kt | 2 + .../get/createGetFromUsage7.kt.after | 2 + .../createFunction/get/createGetFromUsage8.kt | 2 + .../get/createGetFromUsage8.kt.after | 2 + .../createFunction/get/createGetFromUsage9.kt | 2 + .../get/createGetFromUsage9.kt.after | 2 + .../hasNext/createHasNextFromUsage1.kt | 4 +- .../hasNext/createHasNextFromUsage1.kt.after | 4 +- .../hasNext/createHasNextFromUsage2.kt | 4 +- .../hasNext/createHasNextFromUsage2.kt.after | 4 +- .../iterator/createIteratorFromUsage3.kt | 8 ++-- .../createIteratorFromUsage3.kt.after | 8 ++-- .../next/createNextFromUsage1.kt | 4 +- .../next/createNextFromUsage1.kt.after | 4 +- .../next/createNextFromUsage2.kt | 4 +- .../next/createNextFromUsage2.kt.after | 4 +- .../createFunction/set/createSetFromUsage1.kt | 2 + .../set/createSetFromUsage1.kt.after | 2 + .../createFunction/set/createSetFromUsage2.kt | 1 + .../set/createSetFromUsage2.kt.after | 1 + .../createFunction/set/setterForIncrement.kt | 2 +- .../set/setterForIncrement.kt.after | 2 +- .../deprecatedSymbolUsage/infixCall.kt | 4 +- .../deprecatedSymbolUsage/infixCall.kt.after | 4 +- .../deprecatedSymbolUsage/keepInfixCall.kt | 4 +- .../keepInfixCall.kt.after | 4 +- .../deprecatedSymbolUsage/operatorCall.kt | 2 +- .../operatorCall.kt.after | 2 +- .../deprecatedSymbolUsage/operatorCall2.kt | 2 +- .../operatorCall2.kt.after | 2 +- .../changeThisSafeCallWithValue4Runtime.kt | 2 +- ...angeThisSafeCallWithValue4Runtime.kt.after | 2 +- .../deprecatedDelegatesGetSetMember.kt | 2 + .../deprecatedDelegatesGetSetMember.kt.after | 2 + .../modifiers/operatorModifierComponent.kt | 2 + .../operatorModifierComponent.kt.after | 2 + .../quickfix/suppress/forStatement/infix.kt | 4 +- .../suppress/forStatement/infix.kt.after | 4 +- .../anonymousObjectInInfixCall.kt | 2 +- .../anonymousObjectInInfixCall.kt.after | 2 +- .../casts/smartcastImpossible1.kt | 2 +- .../casts/smartcastImpossible1.kt.after | 2 +- .../casts/smartcastImpossible2.kt | 2 +- .../casts/smartcastImpossible2.kt.after | 2 +- .../typeMismatch/casts/typeMismatch3.kt | 2 +- .../typeMismatch/casts/typeMismatch3.kt.after | 4 +- ...eturnTypeWhenValueParameterListIsAbsent.kt | 6 +-- ...ypeWhenValueParameterListIsAbsent.kt.after | 6 +-- .../typeMismatch/compareToTypeMismatch.kt | 2 +- .../compareToTypeMismatch.kt.after | 2 +- .../componentFunctionReturnTypeMismatch1.kt | 4 +- ...ponentFunctionReturnTypeMismatch1.kt.after | 4 +- .../componentFunctionReturnTypeMismatch2.kt | 4 +- ...ponentFunctionReturnTypeMismatch2.kt.after | 4 +- .../componentFunctionReturnTypeMismatch3.kt | 4 +- ...ponentFunctionReturnTypeMismatch3.kt.after | 4 +- .../componentFunctionReturnTypeMismatch4.kt | 4 +- ...ponentFunctionReturnTypeMismatch4.kt.after | 4 +- .../componentFunctionReturnTypeMismatch5.kt | 6 +-- ...ponentFunctionReturnTypeMismatch5.kt.after | 6 +-- .../changeNotFunctionReturnType.kt | 4 +- .../changeNotFunctionReturnType.kt.after | 4 +- .../changePlusFunctionReturnType.kt | 2 +- .../changePlusFunctionReturnType.kt.after | 2 +- .../changeTimesFunctionParameterType.kt | 2 +- .../changeTimesFunctionParameterType.kt.after | 2 +- .../hasNextFunctionReturnTypeMismatch.kt | 6 +-- ...hasNextFunctionReturnTypeMismatch.kt.after | 6 +-- .../multiFakeOverrideForOperatorConvention.kt | 4 +- .../renameUnaryMinus/before/unaryMinus.kt | 4 +- .../rename/renameUnaryMinus/unaryMinus.test | 2 +- .../localCallables/multiDeclaration.kt | 2 +- .../calls/externalArgumentsRuntime.kt | 2 +- .../expressions/conventions/inc.kt | 2 +- .../expressions/conventions/infixCall.kt | 4 +- .../conventions/infixCall.kt.match | 4 +- .../jps/build/AbstractLookupTrackerTest.kt | 2 +- .../lookupTracker/conventions/comparison.kt | 16 +++---- .../lookupTracker/conventions/declarations.kt | 42 ++++++++-------- .../conventions/delegateProperty.kt | 22 ++++----- .../conventions/mathematicalLike.kt | 26 +++++----- .../lookupTracker/conventions/other.kt | 14 +++--- .../inlineGet.kt | 2 +- .../inlineGet.kt.new.1 | 2 +- .../inlineSet.kt | 2 +- .../inlineSet.kt.new.2 | 2 +- .../inline.kt | 4 +- .../inline.kt.new.1 | 4 +- .../inline.kt.new.2 | 4 +- 230 files changed, 422 insertions(+), 424 deletions(-) delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/compareTo.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/divideLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt.after delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt.after delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/minusLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt.after delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeToLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt delete mode 100644 plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt.after diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index a4efd9dcb9a1..5ad3af3c0c76 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -7759,12 +7759,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("compareTo.kt") - public void testCompareTo() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/compareTo.kt"); - doTest(fileName); - } - @TestMetadata("conjunction.kt") public void testConjunction() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/conjunction.kt"); @@ -7801,24 +7795,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("divideLiteral.kt") - public void testDivideLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/divideLiteral.kt"); - doTest(fileName); - } - @TestMetadata("equals.kt") public void testEquals() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/equals.kt"); doTest(fileName); } - @TestMetadata("equalsLiteral.kt") - public void testEqualsLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/equalsLiteral.kt"); - doTest(fileName); - } - @TestMetadata("greaterThan.kt") public void testGreaterThan() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/greaterThan.kt"); @@ -7837,12 +7819,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("identityEqualsLiteral.kt") - public void testIdentityEqualsLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt"); - doTest(fileName); - } - @TestMetadata("in.kt") public void testIn() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/in.kt"); @@ -7885,12 +7861,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("minusLiteral.kt") - public void testMinusLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/minusLiteral.kt"); - doTest(fileName); - } - @TestMetadata("multipleOperands.kt") public void testMultipleOperands() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/multipleOperands.kt"); @@ -7999,12 +7969,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("plusLiteral.kt") - public void testPlusLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/plusLiteral.kt"); - doTest(fileName); - } - @TestMetadata("plusMinus.kt") public void testPlusMinus() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/plusMinus.kt"); @@ -8017,12 +7981,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("rangeToLiteral.kt") - public void testRangeToLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/rangeToLiteral.kt"); - doTest(fileName); - } - @TestMetadata("remainder.kt") public void testRemainder() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/remainder.kt"); @@ -8047,12 +8005,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } - @TestMetadata("timesLiteral.kt") - public void testTimesLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/timesLiteral.kt"); - doTest(fileName); - } - @TestMetadata("xor.kt") public void testXor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/swapBinaryExpression/xor.kt"); diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/lineMarker/recursiveCall/conventionCall.kt b/plugins/kotlin/idea/tests/testData/codeInsight/lineMarker/recursiveCall/conventionCall.kt index e26b22b46017..282f2b8b30dc 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/lineMarker/recursiveCall/conventionCall.kt +++ b/plugins/kotlin/idea/tests/testData/codeInsight/lineMarker/recursiveCall/conventionCall.kt @@ -1,4 +1,4 @@ -fun Any.get(a: Int) { +operator fun Any.get(a: Int) { if (a > 0) { this[a - 1] } @@ -10,32 +10,32 @@ class A { return true } - fun inc(): A { + operator fun inc(): A { this++ ++this return this } - fun component1(): Int { + operator fun component1(): Int { // TODO: should be recursion marker too val (a) = this return 1 } - fun unaryPlus() { + operator fun unaryPlus() { +this } - fun unaryMinus() { + operator fun unaryMinus() { -this } - fun plus(a: Int) { + operator fun plus(a: Int) { this + 1 this += 1 } - fun invoke() { + operator fun invoke() { val a = A() a() a.invoke() @@ -46,7 +46,7 @@ class A { } class B -fun B.invoke() { +operator fun B.invoke() { this() invoke() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/classMembers/DelegatedProperty.kt b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/classMembers/DelegatedProperty.kt index 27d124fb4f37..d16b85917050 100644 --- a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/classMembers/DelegatedProperty.kt +++ b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/classMembers/DelegatedProperty.kt @@ -6,6 +6,6 @@ annotation class Anno class Class { @Anno val x: Int by object { - fun getValue(thiz: Class, data: KProperty<*>) = null!! + operator fun getValue(thiz: Class, data: KProperty<*>) = null!! } } diff --git a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/packageMembers/DelegatedProperty.kt b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/packageMembers/DelegatedProperty.kt index 32944f1998e7..0662beba5609 100644 --- a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/packageMembers/DelegatedProperty.kt +++ b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/annotations/packageMembers/DelegatedProperty.kt @@ -5,5 +5,5 @@ import kotlin.reflect.KProperty annotation class Anno @Anno val x: Int by object { - fun getValue(thiz: Any?, data: KProperty<*>) = null!! + operator fun getValue(thiz: Any?, data: KProperty<*>) = null!! } diff --git a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/fromLoadJava/library/Max.kt b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/fromLoadJava/library/Max.kt index 4c4fce88b503..2fd2ec91aac6 100644 --- a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/fromLoadJava/library/Max.kt +++ b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/fromLoadJava/library/Max.kt @@ -1,7 +1,7 @@ package test public open class Max { - public open fun max(p0 : Collection?): T? where T : Comparable? { + public open fun max(p0 : Collection?): T? where T : Comparable? { throw UnsupportedOperationException() } } diff --git a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.kt b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.kt index 83754b6bf3a0..19b04a271a42 100644 --- a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.kt +++ b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.kt @@ -8,6 +8,6 @@ class A { } class MyProperty { - fun getValue(t: T, p: KProperty<*>): Int = 42 - fun setValue(t: T, p: KProperty<*>, i: Int) {} + operator fun getValue(t: T, p: KProperty<*>): Int = 42 + operator fun setValue(t: T, p: KProperty<*>, i: Int) {} } diff --git a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.txt b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.txt index 1bd8ea99ba27..e818aeff9cbb 100644 --- a/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.txt +++ b/plugins/kotlin/idea/tests/testData/compiler/loadJava/compiledKotlin/prop/VarWithDelegated.txt @@ -9,6 +9,6 @@ public final class A { public final class MyProperty { /*primary*/ public constructor MyProperty() - public final fun getValue(/*0*/ t: T, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int - public final fun setValue(/*0*/ t: T, /*1*/ p: kotlin.reflect.KProperty<*>, /*2*/ i: kotlin.Int): kotlin.Unit + public final operator fun getValue(/*0*/ t: T, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int + public final operator fun setValue(/*0*/ t: T, /*1*/ p: kotlin.reflect.KProperty<*>, /*2*/ i: kotlin.Int): kotlin.Unit } diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionAsInfixOrOperator.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionAsInfixOrOperator.kt index 318b6c0e73fe..a467880ee82e 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionAsInfixOrOperator.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionAsInfixOrOperator.kt @@ -2,9 +2,9 @@ package a class A() {} -fun A.plus(a: A) = this +operator fun A.plus(a: A) = this -fun A.infix(i: Int) = i +infix fun A.infix(i: Int) = i fun f(a: A) { a + a diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.kt index 5a39e1b6097c..4f5016950652 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.kt @@ -1,27 +1,27 @@ // ERROR: Overload resolution ambiguity: public fun a.A.ext(): kotlin.Unit defined in a public fun a.A.ext(): kotlin.Unit defined in to -// ERROR: Overload resolution ambiguity: public fun a.A.plus(a: a.A): kotlin.Unit defined in a public fun a.A.plus(a: a.A): kotlin.Unit defined in to -// ERROR: Overload resolution ambiguity: public fun a.A.infix(a: a.A): kotlin.Unit defined in a public fun a.A.infix(a: a.A): kotlin.Unit defined in to -// ERROR: Overload resolution ambiguity: public fun a.A.minus(): kotlin.Unit defined in a public fun a.A.minus(): kotlin.Unit defined in to +// ERROR: Overload resolution ambiguity: public operator fun a.A.plus(a: a.A): kotlin.Unit defined in a public operator fun a.A.plus(a: a.A): kotlin.Unit defined in to +// ERROR: Overload resolution ambiguity: public infix fun a.A.infix(a: a.A): kotlin.Unit defined in a public infix fun a.A.infix(a: a.A): kotlin.Unit defined in to +// ERROR: Overload resolution ambiguity: public operator fun a.A.unaryMinus(): kotlin.Unit defined in a public operator fun a.A.unaryMinus(): kotlin.Unit defined in to // ERROR: Overload resolution ambiguity: public val a.A.p: kotlin.Int defined in a public val a.A.p: kotlin.Int defined in to package to import a.A import a.ext import a.infix -import a.minus import a.p import a.plus +import a.unaryMinus fun A.ext() { } -fun A.infix(a: A) { +infix fun A.infix(a: A) { } -fun A.plus(a: A) { +operator fun A.plus(a: A) { } -fun A.minus() { +operator fun A.unaryMinus() { } val A.p: Int diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.names b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.names index f514a914fd72..7c547955e7c2 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.names +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.expected.names @@ -1,5 +1,5 @@ a.ext a.infix -a.minus a.p a.plus +a.unaryMinus \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.kt index d239c2c1253f..5305d66b1aef 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.kt @@ -6,13 +6,13 @@ class A { fun A.ext() { } -fun A.infix(a: A) { +infix fun A.infix(a: A) { } -fun A.plus(a: A) { +operator fun A.plus(a: A) { } -fun A.minus() { +operator fun A.unaryMinus() { } val A.p: Int diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.to.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.to.kt index 44bd3a2b05a4..ef90af76c222 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.to.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ExtensionConflict.to.kt @@ -5,13 +5,13 @@ import a.A fun A.ext() { } -fun A.infix(a: A) { +infix fun A.infix(a: A) { } -fun A.plus(a: A) { +operator fun A.plus(a: A) { } -fun A.minus() { +operator fun A.unaryMinus() { } val A.p: Int diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ForLoop.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ForLoop.kt index dd8602b59574..850a47aa5f2d 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/ForLoop.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/ForLoop.kt @@ -6,11 +6,11 @@ class A() { class B() { } -fun B.next(): Int = 3 +operator fun B.next(): Int = 3 -fun B.hasNext(): Boolean = false +operator fun B.hasNext(): Boolean = false -fun A.iterator() = B() +operator fun A.iterator() = B() fun f() { for (i in A()) { diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/GetExpression.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/GetExpression.kt index 74683ce855a2..bfe6a4f95531 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/GetExpression.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/GetExpression.kt @@ -3,7 +3,7 @@ package a class A { } -fun A.get(s: String) { +operator fun A.get(s: String) { } fun f() { diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/Invoke.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/Invoke.kt index e69811560530..1e3761d5392e 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/Invoke.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/Invoke.kt @@ -3,7 +3,7 @@ package a class A { } -fun A.invoke() { +operator fun A.invoke() { } fun f(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiDeclaration.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiDeclaration.kt index b7c730c73c2d..e00832fb17bb 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiDeclaration.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiDeclaration.kt @@ -3,8 +3,8 @@ package a class A() { } -fun A.component1() = 1 -fun A.component2() = 2 +operator fun A.component1() = 1 +operator fun A.component2() = 2 fun f() { val (a, b) = A() diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.expected.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.expected.kt index 20f33e8a6112..2900af082f9d 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.expected.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.expected.kt @@ -5,7 +5,7 @@ import a.B import a.hasNext import a.next -fun A.iterator() = B() +operator fun A.iterator() = B() fun f() { for (i in A()) { diff --git a/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.kt b/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.kt index 6053b8a6122e..cca948a98e5a 100644 --- a/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.kt +++ b/plugins/kotlin/idea/tests/testData/copyPaste/imports/MultiReferencePartiallyCopied.kt @@ -6,11 +6,11 @@ class A() { class B() { } -fun B.next(): Int = 3 +operator fun B.next(): Int = 3 -fun B.hasNext(): Boolean = false +operator fun B.hasNext(): Boolean = false -fun A.iterator() = B() +operator fun A.iterator() = B() fun f() { for (i in A()) { diff --git a/plugins/kotlin/idea/tests/testData/debugger/smartStepInto/unary.kt b/plugins/kotlin/idea/tests/testData/debugger/smartStepInto/unary.kt index 34b4f9af166e..a6d49cde3d2a 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/smartStepInto/unary.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/smartStepInto/unary.kt @@ -1,9 +1,9 @@ class A { - fun plus() {} - fun minus() {} + operator fun unaryPlus() {} + operator fun unaryMinus() {} } fun foo() { - +A() || A()- + +A() || -A() } -// EXISTS: plus(), minus() \ No newline at end of file +// EXISTS: unaryPlus(), unaryMinus() \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClass.out b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClass.out index 6d0ab104f851..af8f4630fc50 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClass.out +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClass.out @@ -19,11 +19,11 @@ class A { } class MyDelegate { - fun getValue(t: Any?, p: KProperty<*>): Int = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 } class MyDelegateThrowsException { - fun getValue(t: Any?, p: KProperty<*>): Int = throw IllegalStateException() + operator fun getValue(t: Any?, p: KProperty<*>): Int = throw IllegalStateException() } // PRINT_FRAME diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClassWoRenderer.out b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClassWoRenderer.out index f82f11c5ce91..06d5c30a4693 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClassWoRenderer.out +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/outs/delegatedPropertyInClassWoRenderer.out @@ -18,7 +18,7 @@ class A { } class MyDelegate { - fun getValue(t: Any?, p: KProperty<*>): Int = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 } // RENDER_DELEGATED_PROPERTIES: false diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyTypeParameters.kt b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyTypeParameters.kt index b68a4cf777a6..af0d05f3483b 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyTypeParameters.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyTypeParameters.kt @@ -5,7 +5,7 @@ import kotlin.properties.Delegates // EXPRESSION: i // RESULT: instance of java.lang.Integer(id=ID): Ljava/lang/Integer; //Breakpoint! -fun foo(i: T) = i +fun foo(i: T) = i fun run(i: () -> Int) = 1 diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/dependentOnFile.kt b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/dependentOnFile.kt index 6135f2bbb64a..5e107fbca518 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/dependentOnFile.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/dependentOnFile.kt @@ -27,7 +27,7 @@ val Int.testExtVal: Int get() = 1 val testDelVal by Delegate() class Delegate { - fun getValue(a: Any?, b: KProperty<*>) = 1 + operator fun getValue(a: Any?, b: KProperty<*>) = 1 } // EXPRESSION: TestClass().testFun() diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/extractVariablesFromCall.kt b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/extractVariablesFromCall.kt index 5d2a18a1a535..e4acae7f27ea 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/extractVariablesFromCall.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/extractVariablesFromCall.kt @@ -9,7 +9,7 @@ fun main(args: Array) { } fun f1(i: Int, s: String) = i + s.length() -fun Int.f2(s: String) = this + s.length() +infix fun Int.f2(s: String) = this + s.length() class MyClass { fun f1(i: Int, s: String) = i + s.length() diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt index b2a9bdfeb52a..2a45266131ed 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt @@ -15,11 +15,11 @@ class A { } class MyDelegate { - fun getValue(t: Any?, p: KProperty<*>): Int = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 } class MyDelegateThrowsException { - fun getValue(t: Any?, p: KProperty<*>): Int = throw IllegalStateException() + operator fun getValue(t: Any?, p: KProperty<*>): Int = throw IllegalStateException() } // PRINT_FRAME diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClassWoRenderer.kt b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClassWoRenderer.kt index 5be6497a9b82..8a0864bd90e0 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClassWoRenderer.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClassWoRenderer.kt @@ -14,7 +14,7 @@ class A { } class MyDelegate { - fun getValue(t: Any?, p: KProperty<*>): Int = 1 + operator fun getValue(t: Any?, p: KProperty<*>): Int = 1 } // RENDER_DELEGATED_PROPERTIES: false diff --git a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/typeParameterRef.kt b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/typeParameterRef.kt index 416343cecd92..10ce2bea09d1 100644 --- a/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/typeParameterRef.kt +++ b/plugins/kotlin/idea/tests/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/typeParameterRef.kt @@ -4,11 +4,11 @@ fun main(args: Array) { test() } -fun foo(): Int { +fun foo(): Int { return 1 } -fun test() { +fun test() { //Breakpoint! val a = foo() } diff --git a/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.0.kt b/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.0.kt index c10d2b4e499b..92af03bdca23 100644 --- a/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.0.kt +++ b/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.0.kt @@ -2,10 +2,10 @@ // OPTIONS: usages class A(val n: Int) { - fun minus(): A = this + operator fun unaryMinus(): A = this } fun test() { - A(1).minus() + A(1).unaryMinus() -A(1) } diff --git a/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.results.txt b/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.results.txt index f38ad70bc7eb..706b8ce92ea2 100644 --- a/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.results.txt +++ b/plugins/kotlin/idea/tests/testData/findUsages/kotlin/conventions/unaryMinus.results.txt @@ -1,2 +1,2 @@ Function call (10: 5) -A(1) -Function call (9: 10) A(1).minus() \ No newline at end of file +Function call (9: 10) A(1).unaryMinus() \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt index 8822e66b74b3..4e93e95c323f 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToDoubleBang/conditionInvalidBinaryExp.kt @@ -1,7 +1,7 @@ // WITH_RUNTIME // IS_APPLICABLE: false -fun T.compareTo(a: T): Int = 0 +operator fun T.compareTo(a: T): Int = 0 fun main(args: Array) { val foo = null diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt index ffc885e542ef..d4c091bf323c 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToElvis/conditionInvalidBinaryExp.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false -fun T.compareTo(a: T): Int = 0 +operator fun T.compareTo(a: T): Int = 0 fun main(args: Array) { val foo = null diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt index f6432dc43825..c29ab881c3e7 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionInvalidBinaryExp.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false -fun T.compareTo(a: T): Int = 0 +operator fun T.compareTo(a: T): Int = 0 fun main(args: Array) { val foo = "foo" diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt index 681e65feeee5..23549502ede7 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifThenToSafeAccess/conditionNotBinaryExpr.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false -fun String?.times(a: Int): Boolean = a == 0 +operator fun String?.times(a: Int): Boolean = a == 0 fun main(args: Array) { val foo: String = "foo" diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt index 90584de7521b..1773e0aaaf4f 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt @@ -1,10 +1,10 @@ -fun doSomething(a: T) {} +fun doSomething(a: T) {} fun test() { class Test { - fun unaryPlus(): Test = Test() - fun plus(a: Test): Test = Test() - fun unaryMinus(): Test = Test() + operator fun unaryPlus(): Test = Test() + operator fun plus(a: Test): Test = Test() + operator fun unaryMinus(): Test = Test() } val test = Test() doSomething((-((test + test).unaryPlus())).toString()) diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt.after b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt.after index 175daac30737..39bb9fe77edb 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/complexPlus.kt.after @@ -1,10 +1,10 @@ -fun doSomething(a: T) {} +fun doSomething(a: T) {} fun test() { class Test { - fun unaryPlus(): Test = Test() - fun plus(a: Test): Test = Test() - fun unaryMinus(): Test = Test() + operator fun unaryPlus(): Test = Test() + operator fun plus(a: Test): Test = Test() + operator fun unaryMinus(): Test = Test() } val test = Test() doSomething((-(+(test + test))).toString()) diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt index 8e47f5e4e556..5f9d50cdd90e 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt @@ -1,7 +1,7 @@ fun test() { class Test() - fun Test.unaryPlus(): Test = Test() + operator fun Test.unaryPlus(): Test = Test() val test = Test() test.unaryPlus() diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt.after b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt.after index b3efb2dbaf8f..d48f923f20f1 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt.after @@ -1,7 +1,7 @@ fun test() { class Test() - fun Test.unaryPlus(): Test = Test() + operator fun Test.unaryPlus(): Test = Test() val test = Test() +test diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt index b3083f198a12..7cdd5ed5a2dd 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt @@ -1,7 +1,7 @@ // INTENTION_TEXT: Replace with '-' operator fun test() { class Test { - fun unaryMinus(): Test = Test() + operator fun unaryMinus(): Test = Test() } val test = Test() test.unaryMinus() diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt.after b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt.after index ccc39653c566..9fa986eaa2ba 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/minusSanityTest.kt.after @@ -1,7 +1,7 @@ // INTENTION_TEXT: Replace with '-' operator fun test() { class Test { - fun unaryMinus(): Test = Test() + operator fun unaryMinus(): Test = Test() } val test = Test() -test diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt index 1b5a568f7268..02d9a9936f6d 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt @@ -1,6 +1,6 @@ fun test() { class Test { - fun unaryPlus(): Test = Test() + operator fun unaryPlus(): Test = Test() } val test = Test() +test.unaryPlus() diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt.after b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt.after index c4213b3430f9..0267910c3542 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusPlus.kt.after @@ -1,6 +1,6 @@ fun test() { class Test { - fun unaryPlus(): Test = Test() + operator fun unaryPlus(): Test = Test() } val test = Test() +(+test) diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt index 3cc07d9d70c2..5a2a5dae3aa4 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt @@ -1,7 +1,7 @@ // INTENTION_TEXT: Replace with '+' operator fun test() { class Test { - fun unaryPlus(): Test = Test() + operator fun unaryPlus(): Test = Test() } val test = Test() test.unaryPlus() diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt.after b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt.after index 87046c7f5e3e..04355017b187 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/plusSanityTest.kt.after @@ -1,7 +1,7 @@ // INTENTION_TEXT: Replace with '+' operator fun test() { class Test { - fun unaryPlus(): Test = Test() + operator fun unaryPlus(): Test = Test() } val test = Test() +test diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt index 49b99081d5be..252f62839744 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt @@ -1,6 +1,6 @@ class C { companion object { - fun unaryMinus(): C = C() + operator fun unaryMinus(): C = C() } } diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt.after b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt.after index 63a45078ab66..9ad0a501be9b 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/qualifier.kt.after @@ -1,6 +1,6 @@ class C { companion object { - fun unaryMinus(): C = C() + operator fun unaryMinus(): C = C() } } diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/super.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/super.kt index 90f14507191c..2d77154562da 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/super.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/super.kt @@ -1,7 +1,7 @@ // IS_APPLICABLE: false open class Base { - open fun unaryMinus() = this + open operator fun unaryMinus() = this } class C : Base() { diff --git a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/typeArguments.kt b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/typeArguments.kt index bb92785b5131..d33ef248a67c 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/typeArguments.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/typeArguments.kt @@ -1,7 +1,7 @@ // IS_APPLICABLE: false fun test() { class Test { - fun unaryPlus(): T? = this as? T + operator fun unaryPlus(): T? = this as? T } val test = Test() test.unaryPlus() diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCall.kt b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCall.kt index cfb82e118d3d..34950f29c486 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCall.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCall.kt @@ -2,5 +2,5 @@ fun foo() { val x = 1..4 - x forEach { a -> a } + x.forEach { a -> a } } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCallNotAvailable.kt b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCallNotAvailable.kt index e4a9a07a8af4..78dd41741f6b 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCallNotAvailable.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/infixCallNotAvailable.kt @@ -3,5 +3,5 @@ fun foo() { val x = 1..4 - x forEach { a -> a } + x.forEach { a -> a } } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt index 67b40498721b..5241bbc0c74f 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt @@ -1,4 +1,7 @@ // WITH_RUNTIME + +infix fun Int.upTo(other: Int) = this.rangeTo(other) + fun main() { - (1 rangeTo 2).forEach { x -> x } + (1 upTo 2).forEach { x -> x } } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt.after b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt.after index 1d0cf3af3408..2f8f17c7e9e0 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt.after @@ -1,6 +1,9 @@ // WITH_RUNTIME + +infix fun Int.upTo(other: Int) = this.rangeTo(other) + fun main() { - for (x in 1 rangeTo 2) { + for (x in 1 upTo 2) { x } } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/invoke.kt b/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/invoke.kt index 7c5cad4f6b8e..85f3c7842c3f 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/invoke.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/invoke.kt @@ -1,7 +1,7 @@ // WITH_RUNTIME // IS_APPLICABLE: false class A(val n: Int) { - fun invoke(): Int = 1 + operator fun invoke(): Int = 1 } fun test(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/iterator.kt b/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/iterator.kt index e13485954fee..897b340522c8 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/iterator.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/iterator.kt @@ -1,7 +1,7 @@ // WITH_RUNTIME // IS_APPLICABLE: false class A(val n: Int) { - fun iterator(): Iterator = throw Exception("") + operator fun iterator(): Iterator = throw Exception("") } fun test() { diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/unaryOp.kt b/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/unaryOp.kt index b058aaa31cb6..c7bab8c25ac2 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/unaryOp.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertFunctionToProperty/unaryOp.kt @@ -1,7 +1,7 @@ // WITH_RUNTIME // IS_APPLICABLE: false class A(val n: Int) { - fun unaryMinus(): A = A(-n) + operator fun unaryMinus(): A = A(-n) } fun test() { diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt index 51ede2c0e1f4..82e75fd43ba4 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt @@ -1,4 +1,4 @@ -fun String.not(): Boolean { +operator fun String.not(): Boolean { return length == 0 } diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after index 5a36e3b8012b..f805056486b3 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/doubleNegation.kt.after @@ -1,4 +1,4 @@ -fun String.not(): Boolean { +operator fun String.not(): Boolean { return length == 0 } diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt index 37ba863a6490..a1070c18defb 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt @@ -1,4 +1,4 @@ -fun Boolean.plus(): Boolean { +operator fun Boolean.unaryPlus(): Boolean { return false } diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt.after b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt.after index dd4562c36ece..0168d30491d7 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/convertNegatedExpressionWithDemorgansLaw/nonstandardPrefixOperator.kt.after @@ -1,4 +1,4 @@ -fun Boolean.plus(): Boolean { +operator fun Boolean.unaryPlus(): Boolean { return false } diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt b/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt index fe47f57dbbfb..4714e5510b7b 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt @@ -1,6 +1,6 @@ // WITH_RUNTIME fun main() { - for (x in 1 rangeTo 2) { + for (x in 1.rangeTo(2)) { x } } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt.after b/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt.after index a0deecc549ec..c923c8bb2675 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/convertToForEachFunctionCall/binaryExpressionLoopRange.kt.after @@ -1,4 +1,4 @@ // WITH_RUNTIME fun main() { - (1 rangeTo 2).forEach { x -> x } + 1.rangeTo(2).forEach { x -> x } } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt index 57518537c718..2b3e997c6ac6 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt @@ -1,5 +1,5 @@ interface Foo { - fun foo(f: (Int) -> Unit) + infix fun foo(f: (Int) -> Unit) } fun foo(x: Foo) { x foo { it * 2 } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt.after b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt.after index 6eefdcc0907c..306dc3a5f4b0 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/functionLiteralArgument.kt.after @@ -1,5 +1,5 @@ interface Foo { - fun foo(f: (Int) -> Unit) + infix fun foo(f: (Int) -> Unit) } fun foo(x: Foo) { x.foo { it * 2 } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt index d15aa7aa570e..3fe7d2ca2473 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt @@ -1,3 +1,5 @@ +infix fun String.compareTo(other: String) = 0 + fun foo(x: String) { x!! compareTo "1" } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt.after b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt.after index 7eb0a544afe6..daffee382848 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/nullAssertedCall.kt.after @@ -1,3 +1,5 @@ +infix fun String.compareTo(other: String) = 0 + fun foo(x: String) { x!!.compareTo("1") } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt index 68934da493b2..ad141ed134ff 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt @@ -1,3 +1,5 @@ +infix fun String.add(other: String) = "" + fun foo(x: String) { - x plus ("1" + "2") + x add ("1" + "2") } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt.after b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt.after index e21575bb82fe..fa3f9940713c 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/parenthesesAroundRightHandArgument.kt.after @@ -1,3 +1,5 @@ +infix fun String.add(other: String) = "" + fun foo(x: String) { - x.plus("1" + "2") + x.add("1" + "2") } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt index 3905bb0ed64c..7b4116c034ea 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt @@ -1,3 +1,5 @@ +infix fun Int.compareTo(other: Int) = 0 + fun foo(x: Int) { x compareTo 1 } diff --git a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt.after b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt.after index 3f32bd9e9c42..1da32e561ab0 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/infixCallToOrdinary/simpleInfixFunctionCall.kt.after @@ -1,3 +1,5 @@ +infix fun Int.compareTo(other: Int) = 0 + fun foo(x: Int) { x.compareTo(1) } diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt index 88a8ec796177..f1afee6ce7b0 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt @@ -1,5 +1,5 @@ class Bar { - fun get(vararg args: Int) {} + operator fun get(vararg args: Int) {} } fun foo(a: Bar, i: Int) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt.after b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt.after index 66376895418b..befabd6654d6 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/arrayAccessMultipleIndex.kt.after @@ -1,5 +1,5 @@ class Bar { - fun get(vararg args: Int) {} + operator fun get(vararg args: Int) {} } fun foo(a: Bar, i: Int) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt index 6b4fd1a30e97..51968cfa3334 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt @@ -1,5 +1,5 @@ class Bar { - fun plusAssign(arg: Bar) {} + operator fun plusAssign(arg: Bar) {} } fun foo(b: Bar) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt.after b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt.after index e20ec04548fe..25818100c1a9 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/binaryPlusEquals.kt.after @@ -1,5 +1,5 @@ class Bar { - fun plusAssign(arg: Bar) {} + operator fun plusAssign(arg: Bar) {} } fun foo(b: Bar) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt index 92710592dde3..32d87d8ac745 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt @@ -1,5 +1,5 @@ class bar() { - fun invoke(i: Any?, j: Any?) : Boolean { + operator fun invoke(i: Any?, j: Any?) : Boolean { return true } } diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt.after b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt.after index 2b8528e8fd43..877b2b41913b 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallMultipleArgument.kt.after @@ -1,5 +1,5 @@ class bar() { - fun invoke(i: Any?, j: Any?) : Boolean { + operator fun invoke(i: Any?, j: Any?) : Boolean { return true } } diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt index 7874980140d4..6449c4e83f0b 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt @@ -1,5 +1,5 @@ class Mocha() { - fun invoke(x: Int, y: String, f: (Int) -> String) { + operator fun invoke(x: Int, y: String, f: (Int) -> String) { } } fun main() { diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after index f0b80c3eda71..d5496b8894d6 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithMultipleArgumentsAndSingleLambda.kt.after @@ -1,5 +1,5 @@ class Mocha() { - fun invoke(x: Int, y: String, f: (Int) -> String) { + operator fun invoke(x: Int, y: String, f: (Int) -> String) { } } fun main() { diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt index 89b97d719c4b..453df8edf604 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt @@ -1,5 +1,5 @@ class Mocha() { - fun invoke(f: (Int) -> String) {} + operator fun invoke(f: (Int) -> String) {} } fun main() { val mocha = Mocha() diff --git a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after index 89760fa36d87..3bbe35d4bfde 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/operatorToFunction/functionCallWithSingleLambda.kt.after @@ -1,5 +1,5 @@ class Mocha() { - fun invoke(f: (Int) -> String) {} + operator fun invoke(f: (Int) -> String) {} } fun main() { val mocha = Mocha() diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/necessaryParentheses5.kt b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/necessaryParentheses5.kt index 494b05895cac..0c2fa9578549 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/necessaryParentheses5.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/necessaryParentheses5.kt @@ -1,7 +1,7 @@ // IS_APPLICABLE: false interface Foo { - fun get(x : Any) : Foo - fun plus(x : Any) : Foo + operator fun get(x : Any) : Foo + operator fun plus(x : Any) : Foo } fun foo(x: Foo) { (x + x)[x] diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt index b96a13384822..1fcaff95c4a2 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt @@ -1,5 +1,5 @@ interface Foo { - fun get(x : Any) : Foo + operator fun get(x : Any) : Foo } fun foo(x: Foo) { (x[x])[x] diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt.after b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt.after index 50b541447d3b..61f5e1457db0 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses3.kt.after @@ -1,5 +1,5 @@ interface Foo { - fun get(x : Any) : Foo + operator fun get(x : Any) : Foo } fun foo(x: Foo) { x[x][x] diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt index afd088c2ec46..ac7f1b0e32c4 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt @@ -1,6 +1,6 @@ interface Foo { - fun inc() : Foo - fun not() : Foo + operator fun inc() : Foo + operator fun not() : Foo } fun foo(x: Foo) { !(x.inc()) diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt.after b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt.after index f4f0d4cc866f..c813dbd069c4 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses4.kt.after @@ -1,6 +1,6 @@ interface Foo { - fun inc() : Foo - fun not() : Foo + operator fun inc() : Foo + operator fun not() : Foo } fun foo(x: Foo) { !x.inc() diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt index 9a57e7ef813d..7ffaf9306491 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt @@ -1,5 +1,5 @@ class C() { - fun get(i: Int) = i + 1 + operator fun get(i: Int) = i + 1 // KT-4513: Unnecessary parenthesis around 'this' val foo = (this)[41] diff --git a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt.after b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt.after index 2b597c6f0f3b..47ed99246c37 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/removeUnnecessaryParentheses/unnecessaryParentheses8.kt.after @@ -1,5 +1,5 @@ class C() { - fun get(i: Int) = i + 1 + operator fun get(i: Int) = i + 1 // KT-4513: Unnecessary parenthesis around 'this' val foo = this[41] diff --git a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt index bd9c8ea4e950..ab89ede2a84e 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt @@ -1,6 +1,6 @@ // INTENTION_TEXT: Simplify negated 'in' expression to '!in' class A(val e: Int) { - fun contains(i: Int): Boolean = e == i + operator fun contains(i: Int): Boolean = e == i } fun test(n: Int) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt.after b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt.after index 0416942d8cc5..4ec59f269662 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/in.kt.after @@ -1,6 +1,6 @@ // INTENTION_TEXT: Simplify negated 'in' expression to '!in' class A(val e: Int) { - fun contains(i: Int): Boolean = e == i + operator fun contains(i: Int): Boolean = e == i } fun test(n: Int) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/inapplicableBinaryOperation.kt b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/inapplicableBinaryOperation.kt index 6ea57272a841..e59e1b4e6212 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/inapplicableBinaryOperation.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/inapplicableBinaryOperation.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false -fun Int.lt(b: Int): Boolean = this < b +infix fun Int.lt(b: Int): Boolean = this < b fun test(n: Int) { !(1 lt 2) } diff --git a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt index f046f9871197..44a913ccfa5c 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt @@ -1,6 +1,6 @@ // INTENTION_TEXT: Simplify negated '!in' expression to 'in' class A(val e: Int) { - fun contains(i: Int): Boolean = e == i + operator fun contains(i: Int): Boolean = e == i } fun test(n: Int) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt.after b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt.after index 601418786216..f6867ae2852e 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/simplifyNegatedBinaryExpression/notIn.kt.after @@ -1,6 +1,6 @@ // INTENTION_TEXT: Simplify negated '!in' expression to 'in' class A(val e: Int) { - fun contains(i: Int): Boolean = e == i + operator fun contains(i: Int): Boolean = e == i } fun test(n: Int) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/compareTo.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/compareTo.kt deleted file mode 100644 index 931f70c49d47..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/compareTo.kt +++ /dev/null @@ -1,4 +0,0 @@ -// IS_APPLICABLE: false -fun main() { - val testing = 5 compareTo 10 -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/divideLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/divideLiteral.kt deleted file mode 100644 index d640b4c2f57a..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/divideLiteral.kt +++ /dev/null @@ -1,4 +0,0 @@ -// IS_APPLICABLE: false -fun main() { - val test = 5 div 2 -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt deleted file mode 100644 index 930623054b60..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun neq(a: Int, b: Int) { - if (a equals b) {} -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt.after b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt.after deleted file mode 100644 index 2407d8ec4ed9..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/equalsLiteral.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -fun neq(a: Int, b: Int) { - if (b equals a) {} -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt deleted file mode 100644 index 8998a30a32d7..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun neq(a: Int, b: Int) { - if (a identityEquals b) {} -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt.after b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt.after deleted file mode 100644 index ca6f4f0ab462..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/identityEqualsLiteral.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -fun neq(a: Int, b: Int) { - if (b identityEquals a) {} -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/infixFunction.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/infixFunction.kt index 67fef9d2456e..738672ac1cd7 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/infixFunction.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/infixFunction.kt @@ -1,6 +1,6 @@ // IS_APPLICABLE: false class Foo() { - fun cat(x: Int): Int {return x} + infix fun cat(x: Int): Int {return x} } fun main() { diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/minusLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/minusLiteral.kt deleted file mode 100644 index 7dd7beb055e8..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/minusLiteral.kt +++ /dev/null @@ -1,4 +0,0 @@ -// IS_APPLICABLE: false -fun new(x: Int, y: Int): Int { - return y minus x -} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt deleted file mode 100644 index db5fbae1ba32..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun test(a: Int, b: Int): Int { - return a plus b -} diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt.after b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt.after deleted file mode 100644 index bcd1af9c7cae..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/plusLiteral.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -fun test(a: Int, b: Int): Int { - return b plus a -} diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeTo.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeTo.kt index 93713174fb82..912028c13e23 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeTo.kt +++ b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeTo.kt @@ -1,5 +1,5 @@ // IS_APPLICABLE: false -fun doSomething(a: T) {} +fun doSomething(a: T) {} fun main() { for (i in 1..10) { diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeToLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeToLiteral.kt deleted file mode 100644 index acd4506490a1..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/rangeToLiteral.kt +++ /dev/null @@ -1,8 +0,0 @@ -// IS_APPLICABLE: false -fun doSomething(a: T) {} - -fun main() { - for (i in 1 rangeTo 10) { - doSomething("Hello World") - } -} diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt deleted file mode 100644 index 02c2a61d0536..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun test(a: Int, b: Int): Int { - return a times b -} diff --git a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt.after b/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt.after deleted file mode 100644 index 90346fd81929..000000000000 --- a/plugins/kotlin/idea/tests/testData/intentions/swapBinaryExpression/timesLiteral.kt.after +++ /dev/null @@ -1,3 +0,0 @@ -fun test(a: Int, b: Int): Int { - return b times a -} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateExtensionSet.test b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateExtensionSet.test index 6eab383a7c00..cc3cb1e2c6aa 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateExtensionSet.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/delegateExtensionSet.test @@ -19,8 +19,8 @@ class DelegateImpl { val value: T = null!! } -public fun DelegateImpl.getValue(thisRef: Any?, property: PropertyMetadata): T = value -public fun DelegateImpl.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {} +operator fun DelegateImpl.getValue(thisRef: Any?, property: PropertyMetadata): T = value +operator fun DelegateImpl.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportGetOnNoOperatorWarning.test b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportGetOnNoOperatorWarning.test index ea7bcc0aa4de..3b640bd10224 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportGetOnNoOperatorWarning.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportGetOnNoOperatorWarning.test @@ -1,5 +1,6 @@ // FILE: first.before.kt // "Import" "true" +// ERROR: operator modifier is required on 'get' in 'some.Some' package testing @@ -26,6 +27,7 @@ operator fun Some.get(s: String) {} // FILE: first.after.kt // "Import" "true" +// ERROR: operator modifier is required on 'get' in 'some.Some' package testing diff --git a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportSetOnNoOperatorWarning.test b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportSetOnNoOperatorWarning.test index 2a69f346342c..51a3f47e6f58 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportSetOnNoOperatorWarning.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/autoImports/indexCallExtensionImportSetOnNoOperatorWarning.test @@ -1,5 +1,6 @@ // FILE: first.before.kt // "Import" "true" +// ERROR: operator modifier is required on 'set' in 'some.Some' package testing @@ -26,6 +27,7 @@ operator fun Some.set(s: String, i: Int) {} // FILE: first.after.kt // "Import" "true" +// ERROR: operator modifier is required on 'set' in 'some.Some' package testing diff --git a/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt b/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt index 73b6d2c21aae..180f69956cfe 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt @@ -1,5 +1,5 @@ // "Add name to argument: 'b = 42'" "true" -fun String.invoke(a: Int, b: Int) {} +operator fun String.invoke(a: Int, b: Int) {} fun g() { ""(a = 1, 42) diff --git a/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt.after index 13522e679479..7a1c8a6e2773 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/checkArguments/addNameToArgument/invokeOnString.kt.after @@ -1,5 +1,5 @@ // "Add name to argument: 'b = 42'" "true" -fun String.invoke(a: Int, b: Int) {} +operator fun String.invoke(a: Int, b: Int) {} fun g() { ""(a = 1, b = 42) diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt index ff542e35aa4c..12fd7bd90086 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt @@ -1,4 +1,5 @@ // "Create member function 'foo'" "true" +// ERROR: infix modifier is required on 'foo' in 'A' class A(val n: T) diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt.after index dc372ba65737..9cd7bee301d3 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/customOperationOnUserType.kt.after @@ -1,4 +1,5 @@ // "Create member function 'foo'" "true" +// ERROR: infix modifier is required on 'foo' in 'A' class A(val n: T) { infix fun foo(t: T): A { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt index 344eb33e65b8..ba958385eba8 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt @@ -1,4 +1,6 @@ // "Create extension function '!u00A0'" "true" +// ERROR: infix modifier is required on '!u00A0' in '' + fun test() { val t: Int = 1 `!u00A0` 2 } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt.after index 21b797677893..dca3908bc1dc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/binaryOperations/quotedName.kt.after @@ -1,4 +1,6 @@ // "Create extension function '!u00A0'" "true" +// ERROR: infix modifier is required on '!u00A0' in '' + fun test() { val t: Int = 1 `!u00A0` 2 } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt index 67da74bd0914..0dffde81f0ed 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt @@ -1,7 +1,7 @@ // "Create member function 'component3'" "true" class Foo { - fun component1(): Int { return 0 } - fun component2(): Int { return 0 } + operator fun component1(): Int { return 0 } + operator fun component2(): Int { return 0 } } fun foo() { val (a, b, c) = Foo() diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt.after index 64ec1b49dc6d..7f2bea156097 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage1.kt.after @@ -1,7 +1,7 @@ // "Create member function 'component3'" "true" class Foo { - fun component1(): Int { return 0 } - fun component2(): Int { return 0 } + operator fun component1(): Int { return 0 } + operator fun component2(): Int { return 0 } operator fun component3(): Any { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt index 3c5547cde90d..3fe003d3c27d 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt @@ -1,7 +1,7 @@ // "Create member function 'component3'" "true" class Foo { - fun component1(): Int { return 0 } - fun component2(): Int { return 0 } + operator fun component1(): Int { return 0 } + operator fun component2(): Int { return 0 } } fun foo() { val (a, b, c: String) = Foo() diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt.after index 936d15b4238c..de8ae858edda 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage2.kt.after @@ -1,7 +1,7 @@ // "Create member function 'component3'" "true" class Foo { - fun component1(): Int { return 0 } - fun component2(): Int { return 0 } + operator fun component1(): Int { return 0 } + operator fun component2(): Int { return 0 } operator fun component3(): String { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt index eb5917cf1d46..c31b754a2e75 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt @@ -1,16 +1,16 @@ // "Create extension function 'component2'" "true" class FooIterator { - fun hasNext(): Boolean { return false } - fun next(): Any { + operator fun hasNext(): Boolean { return false } + operator fun next(): Any { throw UnsupportedOperationException("not implemented") } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw UnsupportedOperationException("not implemented") } } -fun Any.component1(): Int { +operator fun Any.component1(): Int { return 0 } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt.after index f4fbe37ee2ed..21ae481f8d04 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/component/createComponentFromUsage3.kt.after @@ -1,16 +1,16 @@ // "Create extension function 'component2'" "true" class FooIterator { - fun hasNext(): Boolean { return false } - fun next(): Any { + operator fun hasNext(): Boolean { return false } + operator fun next(): Any { throw UnsupportedOperationException("not implemented") } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw UnsupportedOperationException("not implemented") } } -fun Any.component1(): Int { +operator fun Any.component1(): Int { return 0 } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt index 3688d4714d62..0069f811b551 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt @@ -2,7 +2,7 @@ import kotlin.reflect.KProperty class F { - fun setValue(x: X, property: KProperty<*>, i: Int) { } + operator fun setValue(x: X, property: KProperty<*>, i: Int) { } } class X { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt.after index cd6898aa8303..7bfccf79cd42 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingGet.kt.after @@ -2,7 +2,7 @@ import kotlin.reflect.KProperty class F { - fun setValue(x: X, property: KProperty<*>, i: Int) { } + operator fun setValue(x: X, property: KProperty<*>, i: Int) { } operator fun getValue(x: X, property: KProperty<*>): Int { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt index c7cb7ac972ca..60e3a0179c97 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt @@ -2,7 +2,7 @@ import kotlin.reflect.KProperty class F { - fun getValue(x: X, property: KProperty<*>): Int = 1 + operator fun getValue(x: X, property: KProperty<*>): Int = 1 } class X { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt.after index a6f7666592a8..fb23af9afad7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/delegateAccessors/varMissingSet.kt.after @@ -2,7 +2,7 @@ import kotlin.reflect.KProperty class F { - fun getValue(x: X, property: KProperty<*>): Int = 1 + operator fun getValue(x: X, property: KProperty<*>): Int = 1 operator fun setValue(x: X, property: KProperty<*>, i: Int) { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt index 3619ff1745c6..983c40f13df7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>) { val z: Iterable = y[""] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt.after index 4ed55c29a22c..3f8f3923370b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage1.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>) { val z: Iterable = y[""] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt index d839d088ac0a..118181a6c0dc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>, w: java.util.ArrayList) { val z: Iterable = y["", w] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt.after index 4fd4f3b54231..6a111575a7df 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage10.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>, w: java.util.ArrayList) { val z: Iterable = y["", w] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt index abe94a8db0fd..ab2de907abd9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo fun x (y: Foo>, w: java.util.ArrayList) { val z: Iterable = y["", w] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt.after index 26103fbdac7a..0e8fed35debd 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage11.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { operator fun get(s: String, w: T): T { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt index a63474e4cb07..6485b8f13fb2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo fun x (y: Foo>, w: java.util.ArrayList) { val z = y["", w] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt.after index f8ebf5638e8c..065a3daaabdc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage12.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { operator fun get(s: String, w: T): Any { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt index e86b7e7e17d2..dec607604d96 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt.after index 31dc448b12ff..17468ecfa0d6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage13.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt index b3722990f1a8..d3a0db8e66e5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt @@ -1,4 +1,6 @@ // "Create extension function 'get'" "true" +// ERROR: operator modifier is required on 'get' in '' + fun x (y: Any) { val z: Any = y[""] } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt.after index ae5baccb1b39..9484e3367d66 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage2.kt.after @@ -1,4 +1,6 @@ // "Create extension function 'get'" "true" +// ERROR: operator modifier is required on 'get' in '' + fun x (y: Any) { val z: Any = y[""] } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt index 71ec52209362..bb751079d2b2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>) { val z: Iterable = y[""] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt.after index c2fbd56ad631..e70e5680cc19 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage3.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>) { val z: Iterable = y[""] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt index ab908843b567..085152fc4c72 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo> { fun x (y: Foo>) { val z: U = y[""] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt.after index ad68666126e7..0e1af892a3c0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage4.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo> { fun x (y: Foo>) { val z: U = y[""] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt index 89997fde8c18..478fc12c8d5a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>, w: Iterable) { val z: Iterable = y["", w] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt.after index 7446233adbf0..abd9e447f150 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage5.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + class Foo { fun x (y: Foo>, w: Iterable) { val z: Iterable = y["", w] diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt index 218a622ea8d8..7be0b90fb866 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt.after index d1e45e2eee08..a8c18fac9819 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage7.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt index a6451c06d085..ad3b163e09ee 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt.after index 89a38b760a1e..a427fc0bd721 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage8.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt index 8f0c65e1bdbe..f3f008d3d879 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt.after index afd5035a6af8..7721c576544a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/get/createGetFromUsage9.kt.after @@ -1,4 +1,6 @@ // "Create member function 'get'" "true" +// ERROR: operator modifier is required on 'get' in 'Foo' + import java.util.ArrayList class Foo { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt index af54c8eebc23..c346a2ff1b55 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt @@ -1,11 +1,11 @@ // "Create member function 'hasNext'" "true" class FooIterator { - fun next(): Int { + operator fun next(): Int { throw Exception("not implemented") } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt.after index ffcede7997fe..558a379be211 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage1.kt.after @@ -1,6 +1,6 @@ // "Create member function 'hasNext'" "true" class FooIterator { - fun next(): Int { + operator fun next(): Int { throw Exception("not implemented") } @@ -9,7 +9,7 @@ class FooIterator { } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt index 990644a02694..18473c230468 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt @@ -1,11 +1,11 @@ // "Create member function 'hasNext'" "true" class FooIterator { - fun next(): T { + operator fun next(): T { throw Exception("not implemented") } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt.after index 553ed85848cb..7afe5dd82490 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/hasNext/createHasNextFromUsage2.kt.after @@ -1,6 +1,6 @@ // "Create member function 'hasNext'" "true" class FooIterator { - fun next(): T { + operator fun next(): T { throw Exception("not implemented") } @@ -9,7 +9,7 @@ class FooIterator { } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt index 8c1bc5bb117d..1b2c310d9d29 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt @@ -1,16 +1,16 @@ // "Create member function 'next'" "true" class FooIterator { - fun hasNext(): Boolean { return false } + operator fun hasNext(): Boolean { return false } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw UnsupportedOperationException("not implemented") } } -fun Any.component1(): Int { +operator fun Any.component1(): Int { return 0 } -fun Any.component2(): Int { +operator fun Any.component2(): Int { return 0 } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt.after index 10a731e7cbcf..467be063edbf 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/iterator/createIteratorFromUsage3.kt.after @@ -1,20 +1,20 @@ // "Create member function 'next'" "true" class FooIterator { - fun hasNext(): Boolean { return false } + operator fun hasNext(): Boolean { return false } operator fun next(): Any { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw UnsupportedOperationException("not implemented") } } -fun Any.component1(): Int { +operator fun Any.component1(): Int { return 0 } -fun Any.component2(): Int { +operator fun Any.component2(): Int { return 0 } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt index b1f8035b2b4e..aba536225140 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt @@ -1,9 +1,9 @@ // "Create member function 'next'" "true" class FooIterator { - fun hasNext(): Boolean { return false } + operator fun hasNext(): Boolean { return false } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt.after index 81b0b4c92944..db247c274560 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage1.kt.after @@ -1,13 +1,13 @@ // "Create member function 'next'" "true" class FooIterator { - fun hasNext(): Boolean { return false } + operator fun hasNext(): Boolean { return false } operator fun next(): Int { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt index 34f740acb56b..67794a26d1aa 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt @@ -1,9 +1,9 @@ // "Create member function 'next'" "true" class FooIterator { - fun hasNext(): Boolean { return false } + operator fun hasNext(): Boolean { return false } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt.after index bb369dce559f..38cdae353ccb 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/next/createNextFromUsage2.kt.after @@ -1,13 +1,13 @@ // "Create member function 'next'" "true" class FooIterator { - fun hasNext(): Boolean { return false } + operator fun hasNext(): Boolean { return false } operator fun next(): T { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } class Foo { - fun iterator(): FooIterator { + operator fun iterator(): FooIterator { throw Exception("not implemented") } } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt index be677ce850bd..2ce48512d690 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt @@ -1,4 +1,6 @@ // "Create member function 'set'" "true" +// ERROR: operator modifier is required on 'set' in 'Foo' + class Foo { fun x (y: Foo>, w: java.util.ArrayList) { y["", w] = w diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt.after index 355f1e154b1f..528ba2c3fac4 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage1.kt.after @@ -1,4 +1,6 @@ // "Create member function 'set'" "true" +// ERROR: operator modifier is required on 'set' in 'Foo' + class Foo { fun x (y: Foo>, w: java.util.ArrayList) { y["", w] = w diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt index 5cfb1848508b..672d7f842b3f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt @@ -1,4 +1,5 @@ // "Create extension function 'set'" "true" +// ERROR: operator modifier is required on 'set' in '' class Foo { fun x (y: Any, w: java.util.ArrayList) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt.after index 21a12da8b76f..057f482e0efc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/createSetFromUsage2.kt.after @@ -1,6 +1,7 @@ import java.util.ArrayList // "Create extension function 'set'" "true" +// ERROR: operator modifier is required on 'set' in '' class Foo { fun x (y: Any, w: java.util.ArrayList) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt index 0ef85f51599e..99e411cc933e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt @@ -1,6 +1,6 @@ // "Create member function 'set'" "true" class A { - fun get(s: String): Int = 1 + operator fun get(s: String): Int = 1 } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt.after index 5da19a2a03c5..8189d0c7195c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/createFromUsage/createFunction/set/setterForIncrement.kt.after @@ -1,6 +1,6 @@ // "Create member function 'set'" "true" class A { - fun get(s: String): Int = 1 + operator fun get(s: String): Int = 1 operator fun set(s: String, value: Int) { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt index 3d79856285b4..6891907895c3 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt @@ -1,11 +1,11 @@ // "Replace with 'newFun(p, this)'" "true" @Deprecated("", ReplaceWith("newFun(p, this)")) -fun String.oldFun(p: Int) { +infix fun String.oldFun(p: Int) { newFun(p, this) } -fun newFun(p: Int, s: String){} +infix fun newFun(p: Int, s: String){} fun foo() { "" oldFun 1 diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt.after index e08e8ac9bfb8..992a2c011c4c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/infixCall.kt.after @@ -1,11 +1,11 @@ // "Replace with 'newFun(p, this)'" "true" @Deprecated("", ReplaceWith("newFun(p, this)")) -fun String.oldFun(p: Int) { +infix fun String.oldFun(p: Int) { newFun(p, this) } -fun newFun(p: Int, s: String){} +infix fun newFun(p: Int, s: String){} fun foo() { newFun(1, "") diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt index 287ed8f232cf..773e8b68329a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt @@ -1,11 +1,11 @@ // "Replace with 'newFun(p)'" "true" @Deprecated("", ReplaceWith("newFun(p)")) -fun String.oldFun(p: Int) { +infix fun String.oldFun(p: Int) { newFun(p) } -fun String.newFun(p: Int) { +infix fun String.newFun(p: Int) { } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt.after index 30e13b775afe..47d9ae9b7a31 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/keepInfixCall.kt.after @@ -1,11 +1,11 @@ // "Replace with 'newFun(p)'" "true" @Deprecated("", ReplaceWith("newFun(p)")) -fun String.oldFun(p: Int) { +infix fun String.oldFun(p: Int) { newFun(p) } -fun String.newFun(p: Int) { +infix fun String.newFun(p: Int) { } fun foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt index 752382dd590b..5eb5d3964487 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt @@ -3,7 +3,7 @@ interface I @Deprecated("", ReplaceWith("newFun(p, this)")) -fun I.plus(p: Int) { +operator fun I.plus(p: Int) { newFun(p, this) } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt.after index 032462576f8c..ad3a8c5c57d5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall.kt.after @@ -3,7 +3,7 @@ interface I @Deprecated("", ReplaceWith("newFun(p, this)")) -fun I.plus(p: Int) { +operator fun I.plus(p: Int) { newFun(p, this) } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt index b66bed1e17dd..52ce8247c213 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt @@ -3,7 +3,7 @@ interface I @Deprecated("", ReplaceWith("newFun(p)")) -fun I.plus(p: Int) { +operator fun I.plus(p: Int) { newFun(p) } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt.after index 7bbc85fe57e3..67628ba2f49b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/operatorCall2.kt.after @@ -3,7 +3,7 @@ interface I @Deprecated("", ReplaceWith("newFun(p)")) -fun I.plus(p: Int) { +operator fun I.plus(p: Int) { newFun(p) } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt index 1aad28563d3e..9b807a4ad441 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt @@ -13,4 +13,4 @@ fun foo(s: String, t: X) { } } -fun X.plus(x: X): X? = null \ No newline at end of file +operator fun X.plus(x: X): X? = null \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt.after index fdddb49ab3c1..fb53686a27b3 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/deprecatedSymbolUsage/safeCall/changeThisSafeCallWithValue4Runtime.kt.after @@ -13,4 +13,4 @@ fun foo(s: String, t: X) { } } -fun X.plus(x: X): X? = null \ No newline at end of file +operator fun X.plus(x: X): X? = null \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt index 7118faeb80d9..737c9d7c871c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt @@ -1,4 +1,6 @@ // "Rename to 'setValue'" "true" +// ERROR: 'get' method convention on type 'CustomDelegate' is deprecated. Rename to 'getValue' + class CustomDelegate { operator fun get(thisRef: Any?, prop: PropertyMetadata): String = "" operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt.after index a026f1eca945..485ed7e9dbf0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/deprecatedDelegatesGetSetMember.kt.after @@ -1,4 +1,6 @@ // "Rename to 'setValue'" "true" +// ERROR: 'get' method convention on type 'CustomDelegate' is deprecated. Rename to 'getValue' + class CustomDelegate { operator fun get(thisRef: Any?, prop: PropertyMetadata): String = "" operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt index bb8d4ccf362d..a75e03ccaf48 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt @@ -1,4 +1,6 @@ // "Add 'operator' modifier" "true" +// ERROR: operator modifier is required on 'component2' in 'A' + class A { fun component1(): Int = 0 fun component2(): Int = 1 diff --git a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt.after index 5352a016eabf..a8783f40f3bf 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/operatorModifierComponent.kt.after @@ -1,4 +1,6 @@ // "Add 'operator' modifier" "true" +// ERROR: operator modifier is required on 'component2' in 'A' + class A { operator fun component1(): Int = 0 fun component2(): Int = 1 diff --git a/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt b/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt index 4175a8a4d54e..978ec50c27f5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt @@ -1,5 +1,7 @@ // "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" +infix fun Int.add(other: Int) = this + other + fun foo() { - 1!! plus 2 + 1!! add 2 } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt.after index bcef56f2ee60..0fe0d0a2b83b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/suppress/forStatement/infix.kt.after @@ -1,6 +1,8 @@ // "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" +infix fun Int.add(other: Int) = this + other + fun foo() { @Suppress("UNNECESSARY_NOT_NULL_ASSERTION") - (1!! plus 2) + (1!! add 2) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt index 36a7dc422b1d..3cf3fa65fe0b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt @@ -1,7 +1,7 @@ // "Change parameter 't' type of function 'foo' to 'T'" "true" interface T -fun Int.foo(t: Int) = this +infix fun Int.foo(t: Int) = this fun foo() { 1 foo object: T{} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt.after index 5f1e665ad0a4..af30fb5b3871 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/anonymousObjectInInfixCall.kt.after @@ -1,7 +1,7 @@ // "Change parameter 't' type of function 'foo' to 'T'" "true" interface T -fun Int.foo(t: T) = this +infix fun Int.foo(t: T) = this fun foo() { 1 foo object: T{} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt index 02e238fab022..cb1326959f1c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt @@ -1,7 +1,7 @@ // "Cast expression 'a' to 'Foo'" "true" interface Foo { - fun plus(x: Any) : Foo + operator fun plus(x: Any) : Foo } open class MyClass { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt.after index 366f5681c6c9..7561148297a0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible1.kt.after @@ -1,7 +1,7 @@ // "Cast expression 'a' to 'Foo'" "true" interface Foo { - fun plus(x: Any) : Foo + operator fun plus(x: Any) : Foo } open class MyClass { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt index 2034e55a1e7b..34d769df8c5a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt @@ -1,7 +1,7 @@ // "Cast expression 'a' to 'Foo'" "true" interface Foo { - fun not() : Foo + operator fun not() : Foo } open class MyClass { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt.after index 2756f99ef686..c7cbaa2e31f6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/smartcastImpossible2.kt.after @@ -1,7 +1,7 @@ // "Cast expression 'a' to 'Foo'" "true" interface Foo { - fun not() : Foo + operator fun not() : Foo } open class MyClass { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt index 47c3bc48e669..fa7a00140588 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt @@ -1,6 +1,6 @@ // "Cast expression 'a + a' to 'B'" "true" interface A { - fun plus(x: Any): A + operator fun plus(x: Any): A } interface B : A diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt.after index 491082178d1c..1591c8d4ab5b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/casts/typeMismatch3.kt.after @@ -1,9 +1,9 @@ // "Cast expression 'a + a' to 'B'" "true" interface A { - fun plus(x: Any): A + operator fun plus(x: Any): A } interface B : A fun foo(a: A): B { - return (a + a) as B + return (a + a) as B } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt index 1d71468c8d1d..fc311c4a57ee 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt @@ -1,8 +1,8 @@ // "Change 'A.hasNext' function return type to 'Boolean'" "true" abstract class A { - abstract fun hasNext - abstract fun next(): Int - abstract fun iterator(): A + abstract operator fun hasNext + abstract operator fun next(): Int + abstract operator fun iterator(): A } fun test(notRange: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt.after index 9f6681c1b479..66a361bacc29 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/changeReturnTypeWhenValueParameterListIsAbsent.kt.after @@ -1,8 +1,8 @@ // "Change 'A.hasNext' function return type to 'Boolean'" "true" abstract class A { - abstract fun hasNext: Boolean - abstract fun next(): Int - abstract fun iterator(): A + abstract operator fun hasNext: Boolean + abstract operator fun next(): Int + abstract operator fun iterator(): A } fun test(notRange: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt index b8028798e72b..132f6a4be8bf 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt @@ -1,6 +1,6 @@ // "Change 'A.compareTo' function return type to 'Int'" "true" interface A { - fun compareTo(other: Any): String + operator fun compareTo(other: Any): String } fun foo(x: A) { if (x < 0) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt.after index 2e6777b4499e..1cccdee3d6b1 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/compareToTypeMismatch.kt.after @@ -1,6 +1,6 @@ // "Change 'A.compareTo' function return type to 'Int'" "true" interface A { - fun compareTo(other: Any): Int + operator fun compareTo(other: Any): Int } fun foo(x: A) { if (x < 0) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt index 717cfed960f6..2ae9beb442fc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt @@ -1,7 +1,7 @@ // "Change 'A.component1' function return type to 'Int'" "true" abstract class A { - abstract fun component1() - abstract fun component2(): Int + abstract operator fun component1() + abstract operator fun component2(): Int } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt.after index 3dcd795171a8..2397a242778e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch1.kt.after @@ -1,7 +1,7 @@ // "Change 'A.component1' function return type to 'Int'" "true" abstract class A { - abstract fun component1(): Int - abstract fun component2(): Int + abstract operator fun component1(): Int + abstract operator fun component2(): Int } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt index e076e74cef61..d6938e1ce65d 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt @@ -1,7 +1,7 @@ // "Change 'A.component2' function return type to 'Int'" "true" abstract class A { - abstract fun component1(): Int - abstract fun component2(): String + abstract operator fun component1(): Int + abstract operator fun component2(): String } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt.after index c83364f3b65e..d71e0c760e61 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch2.kt.after @@ -1,7 +1,7 @@ // "Change 'A.component2' function return type to 'Int'" "true" abstract class A { - abstract fun component1(): Int - abstract fun component2(): Int + abstract operator fun component1(): Int + abstract operator fun component2(): Int } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt index abadafb49e34..89b7b25c5d33 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt @@ -1,7 +1,7 @@ // "Remove explicitly specified return type in 'A.component2' function" "true" abstract class A { - abstract fun component1(): Int - abstract fun component2(): Int + abstract operator fun component1(): Int + abstract operator fun component2(): Int } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt.after index 7d89eb6eaedb..9afa29bf3821 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch3.kt.after @@ -1,7 +1,7 @@ // "Remove explicitly specified return type in 'A.component2' function" "true" abstract class A { - abstract fun component1(): Int - abstract fun component2() + abstract operator fun component1(): Int + abstract operator fun component2() } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt index 7fcf869866ce..825aa7343b1a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt @@ -1,8 +1,8 @@ // "Change 'A.component2' function return type to 'Unit'" "true" // ERROR: The integer literal does not conform to the expected type kotlin.Unit abstract class A { - abstract fun component1(): Int - fun component2() = 42 + abstract operator fun component1(): Int + operator fun component2() = 42 } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt.after index abbe2300836c..7ac9da58cae1 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch4.kt.after @@ -1,8 +1,8 @@ // "Change 'A.component2' function return type to 'Unit'" "true" // ERROR: The integer literal does not conform to the expected type kotlin.Unit abstract class A { - abstract fun component1(): Int - fun component2(): Unit = 42 + abstract operator fun component1(): Int + operator fun component2(): Unit = 42 } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt index 822bc91c700c..3160166aa1a2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt @@ -1,8 +1,8 @@ // "Change 'y' type to 'Int'" "true" class A { - fun component1() = 42 - fun component2() = 42 - fun component3() = 42 + operator fun component1() = 42 + operator fun component2() = 42 + operator fun component3() = 42 } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after index 503d3e31f01e..ea925d1d9063 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/componentFunctionReturnTypeMismatch/componentFunctionReturnTypeMismatch5.kt.after @@ -1,8 +1,8 @@ // "Change 'y' type to 'Int'" "true" class A { - fun component1() = 42 - fun component2() = 42 - fun component3() = 42 + operator fun component1() = 42 + operator fun component2() = 42 + operator fun component3() = 42 } fun foo(a: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt index 28c05b878bac..f2dcf7f7f724 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt @@ -1,7 +1,7 @@ // "Change 'A.not' function return type to 'A'" "true" interface A { - fun not(): String - fun times(a: A): A + operator fun not(): String + operator fun times(a: A): A } fun foo(a: A): A = a * !(if (true) a else a) \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt.after index ce0594d5c617..d71164d274c6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeNotFunctionReturnType.kt.after @@ -1,7 +1,7 @@ // "Change 'A.not' function return type to 'A'" "true" interface A { - fun not(): A - fun times(a: A): A + operator fun not(): A + operator fun times(a: A): A } fun foo(a: A): A = a * !(if (true) a else a) \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt index e3915d9e301e..fdd335c4799b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt @@ -1,6 +1,6 @@ // "Change 'A.plus' function return type to '() -> Int'" "true" interface A { - fun plus(a: A): String + operator fun plus(a: A): String } fun foo(a: A): () -> Int { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt.after index 38a92aec5e00..ddea04b0eb8b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changePlusFunctionReturnType.kt.after @@ -1,6 +1,6 @@ // "Change 'A.plus' function return type to '() -> Int'" "true" interface A { - fun plus(a: A): () -> Int + operator fun plus(a: A): () -> Int } fun foo(a: A): () -> Int { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt index bc2f8b03cc24..5bed2b41d005 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt @@ -1,6 +1,6 @@ // "Change parameter 'a' type of function 'A.times' to 'String'" "true" interface A { - fun times(a: A): A + operator fun times(a: A): A } fun foo(a: A): A = a * "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after index 252bb1d98bd9..0de4ca504ad3 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/fixOverloadedOperator/changeTimesFunctionParameterType.kt.after @@ -1,6 +1,6 @@ // "Change parameter 'a' type of function 'A.times' to 'String'" "true" interface A { - fun times(a: String): A + operator fun times(a: String): A } fun foo(a: A): A = a * "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt index 379fec3240d4..76bc2b5b3f9f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt @@ -1,8 +1,8 @@ // "Change 'A.hasNext' function return type to 'Boolean'" "true" abstract class A { - abstract fun hasNext(): Int - abstract fun next(): Int - abstract fun iterator(): A + abstract operator fun hasNext(): Int + abstract operator fun next(): Int + abstract operator fun iterator(): A } fun test(notRange: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt.after index 6804ef6ca95f..7ad688006240 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt.after @@ -1,8 +1,8 @@ // "Change 'A.hasNext' function return type to 'Boolean'" "true" abstract class A { - abstract fun hasNext(): Boolean - abstract fun next(): Int - abstract fun iterator(): A + abstract operator fun hasNext(): Boolean + abstract operator fun next(): Int + abstract operator fun iterator(): A } fun test(notRange: A) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt index e29145d52327..4ac9f26bf4e1 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverrideForOperatorConvention.kt @@ -4,11 +4,11 @@ // ACTION: Replace overloaded operator with function call // ERROR: Type mismatch: inferred type is kotlin.Boolean but kotlin.Int was expected interface A { - fun contains(i: Int): Boolean + operator fun contains(i: Int): Boolean } open class AA { - fun contains(i: Int) = true + operator fun contains(i: Int) = true } class AAA: AA(), A { diff --git a/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/before/unaryMinus.kt b/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/before/unaryMinus.kt index 62ed0d6422a7..5fedd867f33a 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/before/unaryMinus.kt +++ b/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/before/unaryMinus.kt @@ -1,8 +1,8 @@ class A(val n: Int) { - operator fun minus(): A = this + operator fun unaryMinus(): A = this } fun test() { - A(1).minus() + A(1).unaryMinus() -A(1) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/unaryMinus.test b/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/unaryMinus.test index 93e0b1a2a6a9..5f7b563ae650 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/unaryMinus.test +++ b/plugins/kotlin/idea/tests/testData/refactoring/rename/renameUnaryMinus/unaryMinus.test @@ -1,7 +1,7 @@ { "type": "KOTLIN_FUNCTION", "classId": "/A", - "oldName": "minus", + "oldName": "unaryMinus", "newName": "foo", "mainFile": "unaryMinus.kt" } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt b/plugins/kotlin/idea/tests/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt index d1a10ada3a63..648498afe340 100644 --- a/plugins/kotlin/idea/tests/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt +++ b/plugins/kotlin/idea/tests/testData/unifier/equivalence/declarations/localCallables/multiDeclaration.kt @@ -7,7 +7,7 @@ fun foo1() { } fun foo2() { - fun A.component1(): Int = a + 1 + operator fun A.component1(): Int = a + 1 val (aa, bb) = A(1, "2") val (uu, vv) = A(2, "2") diff --git a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/calls/externalArgumentsRuntime.kt b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/calls/externalArgumentsRuntime.kt index df57bd50da87..77f05467ded0 100644 --- a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/calls/externalArgumentsRuntime.kt +++ b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/calls/externalArgumentsRuntime.kt @@ -1,4 +1,4 @@ -fun Int.contains(n: Int): Boolean = n < this +operator fun Int.contains(n: Int): Boolean = n < this fun foo(n: Int): Int { if (n in 1) { diff --git a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/inc.kt b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/inc.kt index 37e8876bf457..01aaad84ed6c 100644 --- a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/inc.kt +++ b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/inc.kt @@ -1,4 +1,4 @@ -fun String.inc() = this + "+" +operator fun String.inc() = this + "+" class Foo { init { diff --git a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt index 82dd4f76110a..15f2285347f2 100644 --- a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt +++ b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt @@ -1,3 +1 @@ -val a = 1 + 2 -val b = 1 plus 2 -val d = 2 plus 1 \ No newline at end of file +val a = 1 + 2 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match index e78ceb3c4883..193df0b550b7 100644 --- a/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match +++ b/plugins/kotlin/idea/tests/testData/unifier/equivalence/expressions/conventions/infixCall.kt.match @@ -1,3 +1 @@ -1 + 2 - -1 plus 2 \ No newline at end of file +1 + 2 \ No newline at end of file diff --git a/plugins/kotlin/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt b/plugins/kotlin/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt index f9f40951b8a6..28455f8773ab 100644 --- a/plugins/kotlin/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt +++ b/plugins/kotlin/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractLookupTrackerTest.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File import java.util.* -private val DECLARATION_KEYWORDS = listOf("interface", "class", "enum class", "object", "fun", "val", "var") +private val DECLARATION_KEYWORDS = listOf("interface", "class", "enum class", "object", "fun", "operator fun", "val", "var") private val DECLARATION_STARTS_WITH = DECLARATION_KEYWORDS.map { it + " " } abstract class AbstractLookupTrackerTest : AbstractIncrementalJpsTest( diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/comparison.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/comparison.kt index 02cae7f1a1fb..d7f73c68b455 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/comparison.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/comparison.kt @@ -6,13 +6,13 @@ package foo.bar na /*c:foo.bar.A(equals)*/== a na /*c:foo.bar.A(equals)*/== null - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/> b - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/< b - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/>= b - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/<= b + a /*c:foo.bar.A(compareTo)*/> b + a /*c:foo.bar.A(compareTo)*/< b + a /*c:foo.bar.A(compareTo)*/>= b + a /*c:foo.bar.A(compareTo)*/<= b - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/> c - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/< c - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/>= c - a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo) c:foo.bar.A(getCompareTo) c:foo.bar.A(getCOMPARETo)*/<= c + a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo)*/> c + a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo)*/< c + a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo)*/>= c + a /*c:foo.bar.A(compareTo) p:foo.bar(compareTo) p:java.lang(compareTo) p:kotlin(compareTo) p:kotlin.annotation(compareTo) p:kotlin.jvm(compareTo) p:kotlin.io(compareTo)*/<= c } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/declarations.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/declarations.kt index e0dc43739f22..0dc0141f4f52 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/declarations.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/declarations.kt @@ -1,35 +1,35 @@ package foo.bar /*p:foo.bar*/class A { - fun plus(a: /*c:foo.bar.A p:foo.bar*/Int) = this - fun timesAssign(a: /*c:foo.bar.A p:foo.bar*/Any?) {} - fun inc(): /*c:foo.bar.A p:foo.bar*/A = this + operator fun plus(a: /*c:foo.bar.A p:foo.bar*/Int) = this + operator fun timesAssign(a: /*c:foo.bar.A p:foo.bar*/Any?) {} + operator fun inc(): /*c:foo.bar.A p:foo.bar*/A = this - fun get(i: /*c:foo.bar.A p:foo.bar*/Int) = 1 - fun contains(a: /*c:foo.bar.A p:foo.bar*/Int): /*c:foo.bar.A p:foo.bar*/Boolean = false - fun invoke() {} + operator fun get(i: /*c:foo.bar.A p:foo.bar*/Int) = 1 + operator fun contains(a: /*c:foo.bar.A p:foo.bar*/Int): /*c:foo.bar.A p:foo.bar*/Boolean = false + operator fun invoke() {} - fun compareTo(a: /*c:foo.bar.A p:foo.bar*/Int) = 0 + operator fun compareTo(a: /*c:foo.bar.A p:foo.bar*/Int) = 0 - fun component1() = this + operator fun component1() = this - fun iterator() = this - fun next() = this + operator fun iterator() = this + operator fun next() = this } -/*p:foo.bar*/fun /*p:foo.bar*/A.minus(a: /*p:foo.bar*/Int) = this -/*p:foo.bar*/fun /*p:foo.bar*/A.divAssign(a: /*p:foo.bar*/Any?) {} -/*p:foo.bar*/fun /*p:foo.bar*/A.dec(): /*p:foo.bar*/A = this +/*p:foo.bar*/operator fun /*p:foo.bar*/A.minus(a: /*p:foo.bar*/Int) = this +/*p:foo.bar*/operator fun /*p:foo.bar*/A.divAssign(a: /*p:foo.bar*/Any?) {} +/*p:foo.bar*/operator fun /*p:foo.bar*/A.dec(): /*p:foo.bar*/A = this -/*p:foo.bar*/fun /*p:foo.bar*/A.not() {} +/*p:foo.bar*/operator fun /*p:foo.bar*/A.not() {} -/*p:foo.bar*/fun /*p:foo.bar*/A.set(i: /*p:foo.bar*/Int, v: /*p:foo.bar*/Int) {} -/*p:foo.bar*/fun /*p:foo.bar*/A.contains(a: /*p:foo.bar*/Any): /*p:foo.bar*/Boolean = true -/*p:foo.bar*/fun /*p:foo.bar*/A.invoke(i: /*p:foo.bar*/Int) {} +/*p:foo.bar*/operator fun /*p:foo.bar*/A.set(i: /*p:foo.bar*/Int, v: /*p:foo.bar*/Int) {} +/*p:foo.bar*/operator fun /*p:foo.bar*/A.contains(a: /*p:foo.bar*/Any): /*p:foo.bar*/Boolean = true +/*p:foo.bar*/operator fun /*p:foo.bar*/A.invoke(i: /*p:foo.bar*/Int) {} -/*p:foo.bar*/fun /*p:foo.bar*/A.compareTo(a: /*p:foo.bar*/Any) = 0 +/*p:foo.bar*/operator fun /*p:foo.bar*/A.compareTo(a: /*p:foo.bar*/Any) = 0 -/*p:foo.bar*/fun /*p:foo.bar*/A.component2() = this +/*p:foo.bar*/operator fun /*p:foo.bar*/A.component2() = this -/*p:foo.bar*/fun /*p:foo.bar*/A?.iterator() = this!! -/*p:foo.bar*/fun /*p:foo.bar*/A.hasNext(): /*p:foo.bar*/Boolean = false +/*p:foo.bar*/operator fun /*p:foo.bar*/A?.iterator() = this!! +/*p:foo.bar*/operator fun /*p:foo.bar*/A.hasNext(): /*p:foo.bar*/Boolean = false diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/delegateProperty.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/delegateProperty.kt index 80e5fb200f1b..d444859d8775 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/delegateProperty.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/delegateProperty.kt @@ -3,28 +3,28 @@ package foo.bar import kotlin.reflect./*p:kotlin.reflect*/KProperty /*p:foo.bar*/class D1 { - fun get(t: /*c:foo.bar.D1 p:foo.bar*/Any?, p: /*c:foo.bar.D1*/KProperty<*>) = 1 + operator fun getValue(t: /*c:foo.bar.D1 p:foo.bar*/Any?, p: /*c:foo.bar.D1*/KProperty<*>) = 1 } -/*p:foo.bar*/fun /*p:foo.bar*/D1.set(t: /*p:foo.bar*/Any?, p: KProperty<*>, v: /*p:foo.bar*/Int) {} +/*p:foo.bar*/operator fun /*p:foo.bar*/D1.setValue(t: /*p:foo.bar*/Any?, p: KProperty<*>, v: /*p:foo.bar*/Int) {} /*p:foo.bar(D2)*/open class D2 { - fun set(t: /*c:foo.bar.D2 p:foo.bar*/Any?, p: /*c:foo.bar.D2*/KProperty<*>, v: /*c:foo.bar.D2 p:foo.bar*/Int) {} + operator fun setValue(t: /*c:foo.bar.D2 p:foo.bar*/Any?, p: /*c:foo.bar.D2*/KProperty<*>, v: /*c:foo.bar.D2 p:foo.bar*/Int) {} } -/*p:foo.bar*/fun /*p:foo.bar*/D2.get(t: /*p:foo.bar*/Any?, p: KProperty<*>) = 1 -/*p:foo.bar*/fun /*p:foo.bar*/D2.propertyDelegated(p: /*p:foo.bar*/Any?) {} +/*p:foo.bar*/operator fun /*p:foo.bar*/D2.getValue(t: /*p:foo.bar*/Any?, p: KProperty<*>) = 1 +/*p:foo.bar*/operator fun /*p:foo.bar*/D2.propertyDelegated(p: /*p:foo.bar*/Any?) {} /*p:foo.bar*/class D3 : /*p:foo.bar*/D2() { fun propertyDelegated(p: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar*/Any?) {} } -/*p:foo.bar*/val x1 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D1(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D1(getGetValue) c:foo.bar.D1(getGETValue) c:foo.bar.D1(get) c:foo.bar.D1(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated) c:foo.bar.D1(getPropertyDelegated) c:foo.bar.D1(getPROPERTYDelegated)*/D1() -/*p:foo.bar*/var y1 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D1(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D1(getGetValue) c:foo.bar.D1(getGETValue) c:foo.bar.D1(get) c:foo.bar.D1(setValue) p:foo.bar(setValue) p:java.lang(setValue) p:kotlin(setValue) p:kotlin.annotation(setValue) p:kotlin.jvm(setValue) p:kotlin.io(setValue) c:foo.bar.D1(getSetValue) c:foo.bar.D1(getSETValue) c:foo.bar.D1(set) p:foo.bar(set) p:java.lang(set) p:kotlin(set) p:kotlin.annotation(set) p:kotlin.jvm(set) p:kotlin.io(set) c:foo.bar.D1(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated) c:foo.bar.D1(getPropertyDelegated) c:foo.bar.D1(getPROPERTYDelegated)*/D1() +/*p:foo.bar*/val x1 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D1(getValue) c:foo.bar.D1(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated) c:foo.bar.D1(getPropertyDelegated) c:foo.bar.D1(getPROPERTYDelegated)*/D1() +/*p:foo.bar*/var y1 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D1(getValue) c:foo.bar.D1(setValue) p:foo.bar(setValue) p:java.lang(setValue) p:kotlin(setValue) p:kotlin.annotation(setValue) p:kotlin.jvm(setValue) p:kotlin.io(setValue) c:foo.bar.D1(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated) c:foo.bar.D1(getPropertyDelegated) c:foo.bar.D1(getPROPERTYDelegated)*/D1() -/*p:foo.bar*/val x2 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D2(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D2(getGetValue) c:foo.bar.D2(getGETValue) c:foo.bar.D2(get) p:foo.bar(get) p:java.lang(get) p:kotlin(get) p:kotlin.annotation(get) p:kotlin.jvm(get) p:kotlin.io(get) c:foo.bar.D2(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated)*/D2() -/*p:foo.bar*/var y2 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D2(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D2(getGetValue) c:foo.bar.D2(getGETValue) c:foo.bar.D2(get) p:foo.bar(get) p:java.lang(get) p:kotlin(get) p:kotlin.annotation(get) p:kotlin.jvm(get) p:kotlin.io(get) c:foo.bar.D2(setValue) p:foo.bar(setValue) p:java.lang(setValue) p:kotlin(setValue) p:kotlin.annotation(setValue) p:kotlin.jvm(setValue) p:kotlin.io(setValue) c:foo.bar.D2(getSetValue) c:foo.bar.D2(getSETValue) c:foo.bar.D2(set) c:foo.bar.D2(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated)*/D2() +/*p:foo.bar*/val x2 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D2(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D2(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated)*/D2() +/*p:foo.bar*/var y2 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D2(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D2(setValue) c:foo.bar.D2(propertyDelegated) p:foo.bar(propertyDelegated) p:java.lang(propertyDelegated) p:kotlin(propertyDelegated) p:kotlin.annotation(propertyDelegated) p:kotlin.jvm(propertyDelegated) p:kotlin.io(propertyDelegated)*/D2() -/*p:foo.bar*/val x3 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D3(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D3(getGetValue) c:foo.bar.D3(getGETValue) c:foo.bar.D3(get) p:foo.bar(get) p:java.lang(get) p:kotlin(get) p:kotlin.annotation(get) p:kotlin.jvm(get) p:kotlin.io(get) c:foo.bar.D3(propertyDelegated)*/D3() -/*p:foo.bar*/var y3 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D3(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D3(getGetValue) c:foo.bar.D3(getGETValue) c:foo.bar.D3(get) p:foo.bar(get) p:java.lang(get) p:kotlin(get) p:kotlin.annotation(get) p:kotlin.jvm(get) p:kotlin.io(get) c:foo.bar.D3(setValue) p:foo.bar(setValue) p:java.lang(setValue) p:kotlin(setValue) p:kotlin.annotation(setValue) p:kotlin.jvm(setValue) p:kotlin.io(setValue) c:foo.bar.D3(getSetValue) c:foo.bar.D3(getSETValue) c:foo.bar.D3(set) c:foo.bar.D3(propertyDelegated)*/D3() +/*p:foo.bar*/val x3 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D3(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D3(propertyDelegated)*/D3() +/*p:foo.bar*/var y3 by /*p:foo.bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io c:foo.bar.D3(getValue) p:foo.bar(getValue) p:java.lang(getValue) p:kotlin(getValue) p:kotlin.annotation(getValue) p:kotlin.jvm(getValue) p:kotlin.io(getValue) c:foo.bar.D3(setValue) c:foo.bar.D3(propertyDelegated)*/D3() diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/mathematicalLike.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/mathematicalLike.kt index 07fad84d3bf2..69c457b8ef94 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/mathematicalLike.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/mathematicalLike.kt @@ -3,22 +3,22 @@ package foo.bar /*p:foo.bar*/fun testOperators(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int) { var d = a - d/*c:foo.bar.A(inc) p:foo.bar(inc) p:java.lang(inc) p:kotlin(inc) p:kotlin.annotation(inc) p:kotlin.jvm(inc) p:kotlin.io(inc) c:foo.bar.A(getInc) c:foo.bar.A(getINC)*/++ - /*c:foo.bar.A(inc) p:foo.bar(inc) p:java.lang(inc) p:kotlin(inc) p:kotlin.annotation(inc) p:kotlin.jvm(inc) p:kotlin.io(inc) c:foo.bar.A(getInc) c:foo.bar.A(getINC)*/++d - d/*c:foo.bar.A(dec) p:foo.bar(dec) p:java.lang(dec) p:kotlin(dec) p:kotlin.annotation(dec) p:kotlin.jvm(dec) p:kotlin.io(dec) c:foo.bar.A(getDec) c:foo.bar.A(getDEC)*/-- - /*c:foo.bar.A(dec) p:foo.bar(dec) p:java.lang(dec) p:kotlin(dec) p:kotlin.annotation(dec) p:kotlin.jvm(dec) p:kotlin.io(dec) c:foo.bar.A(getDec) c:foo.bar.A(getDEC)*/--d + d/*c:foo.bar.A(inc)*/++ + /*c:foo.bar.A(inc)*/++d + d/*c:foo.bar.A(dec) p:foo.bar(dec) p:java.lang(dec) p:kotlin(dec) p:kotlin.annotation(dec) p:kotlin.jvm(dec) p:kotlin.io(dec)*/-- + /*c:foo.bar.A(dec) p:foo.bar(dec) p:java.lang(dec) p:kotlin(dec) p:kotlin.annotation(dec) p:kotlin.jvm(dec) p:kotlin.io(dec)*/--d - a /*c:foo.bar.A(plus) p:foo.bar(plus) p:java.lang(plus) p:kotlin(plus) p:kotlin.annotation(plus) p:kotlin.jvm(plus) p:kotlin.io(plus) c:foo.bar.A(getPlus) c:foo.bar.A(getPLUS)*/+ b - a /*c:foo.bar.A(minus) p:foo.bar(minus) p:java.lang(minus) p:kotlin(minus) p:kotlin.annotation(minus) p:kotlin.jvm(minus) p:kotlin.io(minus) c:foo.bar.A(getMinus) c:foo.bar.A(getMINUS)*/- b - /*c:foo.bar.A(not) p:foo.bar(not) p:java.lang(not) p:kotlin(not) p:kotlin.annotation(not) p:kotlin.jvm(not) p:kotlin.io(not) c:foo.bar.A(getNot) c:foo.bar.A(getNOT)*/!a + a /*c:foo.bar.A(plus)*/+ b + a /*c:foo.bar.A(minus) p:foo.bar(minus) p:java.lang(minus) p:kotlin(minus) p:kotlin.annotation(minus) p:kotlin.jvm(minus) p:kotlin.io(minus)*/- b + /*c:foo.bar.A(not) p:foo.bar(not) p:java.lang(not) p:kotlin(not) p:kotlin.annotation(not) p:kotlin.jvm(not) p:kotlin.io(not)*/!a // for val - a /*c:foo.bar.A(timesAssign) p:foo.bar(timesAssign) p:java.lang(timesAssign) p:kotlin(timesAssign) p:kotlin.annotation(timesAssign) p:kotlin.jvm(timesAssign) p:kotlin.io(timesAssign) c:foo.bar.A(getTimesAssign) c:foo.bar.A(getTIMESAssign)*/*= b - a /*c:foo.bar.A(divAssign) p:foo.bar(divAssign) p:java.lang(divAssign) p:kotlin(divAssign) p:kotlin.annotation(divAssign) p:kotlin.jvm(divAssign) p:kotlin.io(divAssign) c:foo.bar.A(getDivAssign) c:foo.bar.A(getDIVAssign)*//= b + a /*c:foo.bar.A(timesAssign)*/*= b + a /*c:foo.bar.A(divAssign) p:foo.bar(divAssign) p:java.lang(divAssign) p:kotlin(divAssign) p:kotlin.annotation(divAssign) p:kotlin.jvm(divAssign) p:kotlin.io(divAssign)*//= b // for var - d /*c:foo.bar.A(plusAssign) p:foo.bar(plusAssign) p:java.lang(plusAssign) p:kotlin(plusAssign) p:kotlin.annotation(plusAssign) p:kotlin.jvm(plusAssign) p:kotlin.io(plusAssign) c:foo.bar.A(getPlusAssign) c:foo.bar.A(getPLUSAssign) c:foo.bar.A(plus) p:foo.bar(plus) p:java.lang(plus) p:kotlin(plus) p:kotlin.annotation(plus) p:kotlin.jvm(plus) p:kotlin.io(plus) c:foo.bar.A(getPlus) c:foo.bar.A(getPLUS)*/+= b - d /*c:foo.bar.A(minusAssign) p:foo.bar(minusAssign) p:java.lang(minusAssign) p:kotlin(minusAssign) p:kotlin.annotation(minusAssign) p:kotlin.jvm(minusAssign) p:kotlin.io(minusAssign) c:foo.bar.A(getMinusAssign) c:foo.bar.A(getMINUSAssign) c:foo.bar.A(minus) p:foo.bar(minus) p:java.lang(minus) p:kotlin(minus) p:kotlin.annotation(minus) p:kotlin.jvm(minus) p:kotlin.io(minus) c:foo.bar.A(getMinus) c:foo.bar.A(getMINUS)*/-= b - d /*c:foo.bar.A(timesAssign) p:foo.bar(timesAssign) p:java.lang(timesAssign) p:kotlin(timesAssign) p:kotlin.annotation(timesAssign) p:kotlin.jvm(timesAssign) p:kotlin.io(timesAssign) c:foo.bar.A(getTimesAssign) c:foo.bar.A(getTIMESAssign) c:foo.bar.A(times) p:foo.bar(times) p:java.lang(times) p:kotlin(times) p:kotlin.annotation(times) p:kotlin.jvm(times) p:kotlin.io(times) c:foo.bar.A(getTimes) c:foo.bar.A(getTIMES)*/*= b - d /*c:foo.bar.A(divAssign) p:foo.bar(divAssign) p:java.lang(divAssign) p:kotlin(divAssign) p:kotlin.annotation(divAssign) p:kotlin.jvm(divAssign) p:kotlin.io(divAssign) c:foo.bar.A(getDivAssign) c:foo.bar.A(getDIVAssign) c:foo.bar.A(div) p:foo.bar(div) p:java.lang(div) p:kotlin(div) p:kotlin.annotation(div) p:kotlin.jvm(div) p:kotlin.io(div) c:foo.bar.A(getDiv) c:foo.bar.A(getDIV)*//= b + d /*c:foo.bar.A(plusAssign) p:foo.bar(plusAssign) p:java.lang(plusAssign) p:kotlin(plusAssign) p:kotlin.annotation(plusAssign) p:kotlin.jvm(plusAssign) p:kotlin.io(plusAssign) c:foo.bar.A(getPlusAssign) c:foo.bar.A(getPLUSAssign) c:foo.bar.A(plus)*/+= b + d /*c:foo.bar.A(minusAssign) p:foo.bar(minusAssign) p:java.lang(minusAssign) p:kotlin(minusAssign) p:kotlin.annotation(minusAssign) p:kotlin.jvm(minusAssign) p:kotlin.io(minusAssign) c:foo.bar.A(getMinusAssign) c:foo.bar.A(getMINUSAssign) c:foo.bar.A(minus) p:foo.bar(minus) p:java.lang(minus) p:kotlin(minus) p:kotlin.annotation(minus) p:kotlin.jvm(minus) p:kotlin.io(minus)*/-= b + d /*c:foo.bar.A(timesAssign) c:foo.bar.A(times) p:foo.bar(times) p:java.lang(times) p:kotlin(times) p:kotlin.annotation(times) p:kotlin.jvm(times) p:kotlin.io(times) c:foo.bar.A(getTimes) c:foo.bar.A(getTIMES)*/*= b + d /*c:foo.bar.A(divAssign) p:foo.bar(divAssign) p:java.lang(divAssign) p:kotlin(divAssign) p:kotlin.annotation(divAssign) p:kotlin.jvm(divAssign) p:kotlin.io(divAssign) c:foo.bar.A(div) p:foo.bar(div) p:java.lang(div) p:kotlin(div) p:kotlin.annotation(div) p:kotlin.jvm(div) p:kotlin.io(div) c:foo.bar.A(getDiv) c:foo.bar.A(getDIV)*//= b } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/other.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/other.kt index d6d7481e2a16..9e9e8aa46d44 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/other.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/lookupTracker/conventions/other.kt @@ -1,16 +1,16 @@ package foo.bar /*p:foo.bar*/fun testOther(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int, c: /*p:foo.bar*/Any, na: /*p:foo.bar*/A?) { - /*c:foo.bar.A(set) p:foo.bar(set) p:java.lang(set) p:kotlin(set) p:kotlin.annotation(set) p:kotlin.jvm(set) p:kotlin.io(set) c:foo.bar.A(getSet) c:foo.bar.A(getSET)*/a[1] = /*c:foo.bar.A(get) p:foo.bar(get) p:java.lang(get) p:kotlin(get) p:kotlin.annotation(get) p:kotlin.jvm(get) p:kotlin.io(get) c:foo.bar.A(getGet) c:foo.bar.A(getGET)*/a[2] + /*c:foo.bar.A(set) p:foo.bar(set) p:java.lang(set) p:kotlin(set) p:kotlin.annotation(set) p:kotlin.jvm(set) p:kotlin.io(set)*/a[1] = /*c:foo.bar.A(get)*/a[2] - b /*c:foo.bar.A(contains) p:foo.bar(contains) p:java.lang(contains) p:kotlin(contains) p:kotlin.annotation(contains) p:kotlin.jvm(contains) p:kotlin.io(contains) c:foo.bar.A(getContains) c:foo.bar.A(getCONTAINS)*/in a - "s" /*c:foo.bar.A(contains) p:foo.bar(contains) p:java.lang(contains) p:kotlin(contains) p:kotlin.annotation(contains) p:kotlin.jvm(contains) p:kotlin.io(contains) c:foo.bar.A(getContains) c:foo.bar.A(getCONTAINS)*/!in a + b /*c:foo.bar.A(contains)*/in a + "s" /*c:foo.bar.A(contains) p:foo.bar(contains) p:java.lang(contains) p:kotlin(contains) p:kotlin.annotation(contains) p:kotlin.jvm(contains) p:kotlin.io(contains)*/!in a - /*c:foo.bar.A(invoke) p:foo.bar(invoke) p:java.lang(invoke) p:kotlin(invoke) p:kotlin.annotation(invoke) p:kotlin.jvm(invoke) p:kotlin.io(invoke)*/a() + /*c:foo.bar.A(invoke)*/a() /*c:foo.bar.A(invoke) p:foo.bar(invoke) p:java.lang(invoke) p:kotlin(invoke) p:kotlin.annotation(invoke) p:kotlin.jvm(invoke) p:kotlin.io(invoke)*/a(1) - val (/*c:foo.bar.A(component1) p:foo.bar(component1) p:java.lang(component1) p:kotlin(component1) p:kotlin.annotation(component1) p:kotlin.jvm(component1) p:kotlin.io(component1) c:foo.bar.A(getComponent1)*/h, /*c:foo.bar.A(component2) p:foo.bar(component2) p:java.lang(component2) p:kotlin(component2) p:kotlin.annotation(component2) p:kotlin.jvm(component2) p:kotlin.io(component2) c:foo.bar.A(getComponent2)*/t) = a; + val (/*c:foo.bar.A(component1)*/h, /*c:foo.bar.A(component2) p:foo.bar(component2) p:java.lang(component2) p:kotlin(component2) p:kotlin.annotation(component2) p:kotlin.jvm(component2) p:kotlin.io(component2)*/t) = a; - for ((/*c:foo.bar.A(component1) p:foo.bar(component1) p:java.lang(component1) p:kotlin(component1) p:kotlin.annotation(component1) p:kotlin.jvm(component1) p:kotlin.io(component1) c:foo.bar.A(getComponent1)*/f, /*c:foo.bar.A(component2) p:foo.bar(component2) p:java.lang(component2) p:kotlin(component2) p:kotlin.annotation(component2) p:kotlin.jvm(component2) p:kotlin.io(component2) c:foo.bar.A(getComponent2)*/s) in /*c:foo.bar.A(iterator) c:foo.bar.A(hasNext) p:foo.bar(hasNext) p:java.lang(hasNext) p:kotlin(hasNext) p:kotlin.annotation(hasNext) p:kotlin.jvm(hasNext) p:kotlin.io(hasNext) c:foo.bar.A(next)*/a); - for ((/*c:foo.bar.A(component1) p:foo.bar(component1) p:java.lang(component1) p:kotlin(component1) p:kotlin.annotation(component1) p:kotlin.jvm(component1) p:kotlin.io(component1) c:foo.bar.A(getComponent1)*/f, /*c:foo.bar.A(component2) p:foo.bar(component2) p:java.lang(component2) p:kotlin(component2) p:kotlin.annotation(component2) p:kotlin.jvm(component2) p:kotlin.io(component2) c:foo.bar.A(getComponent2)*/s) in /*c:foo.bar.A(iterator) p:foo.bar(iterator) p:java.lang(iterator) p:kotlin(iterator) p:kotlin.annotation(iterator) p:kotlin.jvm(iterator) p:kotlin.io(iterator) c:foo.bar.A(hasNext) p:foo.bar(hasNext) p:java.lang(hasNext) p:kotlin(hasNext) p:kotlin.annotation(hasNext) p:kotlin.jvm(hasNext) p:kotlin.io(hasNext) c:foo.bar.A(next)*/na); + for ((/*c:foo.bar.A(component1)*/f, /*c:foo.bar.A(component2) p:foo.bar(component2) p:java.lang(component2) p:kotlin(component2) p:kotlin.annotation(component2) p:kotlin.jvm(component2) p:kotlin.io(component2)*/s) in /*c:foo.bar.A(iterator) c:foo.bar.A(hasNext) p:foo.bar(hasNext) p:java.lang(hasNext) p:kotlin(hasNext) p:kotlin.annotation(hasNext) p:kotlin.jvm(hasNext) p:kotlin.io(hasNext) c:foo.bar.A(next)*/a); + for ((/*c:foo.bar.A(component1)*/f, /*c:foo.bar.A(component2) p:foo.bar(component2) p:java.lang(component2) p:kotlin(component2) p:kotlin.annotation(component2) p:kotlin.jvm(component2) p:kotlin.io(component2)*/s) in /*c:foo.bar.A(iterator) p:foo.bar(iterator) p:java.lang(iterator) p:kotlin(iterator) p:kotlin.annotation(iterator) p:kotlin.jvm(iterator) p:kotlin.io(iterator) c:foo.bar.A(hasNext) p:foo.bar(hasNext) p:java.lang(hasNext) p:kotlin(hasNext) p:kotlin.annotation(hasNext) p:kotlin.jvm(hasNext) p:kotlin.io(hasNext) c:foo.bar.A(next)*/na); } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt index a5ca9157e97c..310ee0540d5e 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt @@ -2,6 +2,6 @@ package inline import kotlin.reflect.KProperty -inline fun Inline.getValue(receiver: Any?, prop: KProperty<*>): Int { +inline operator fun Inline.getValue(receiver: Any?, prop: KProperty<*>): Int { return 0 } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt.new.1 b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt.new.1 index c1e548cf52c5..48363763f128 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt.new.1 +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineGet.kt.new.1 @@ -2,6 +2,6 @@ package inline import kotlin.reflect.KProperty -inline fun Inline.getValue(receiver: Any?, prop: KProperty<*>): Int { +inline operator fun Inline.getValue(receiver: Any?, prop: KProperty<*>): Int { return 1 } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt index 36754dd7b0ef..6f6684e1595c 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt @@ -2,6 +2,6 @@ package inline import kotlin.reflect.KProperty -inline fun Inline.setValue(receiver: Any?, prop: KProperty<*>, value: Int) { +inline operator fun Inline.setValue(receiver: Any?, prop: KProperty<*>, value: Int) { println(value) } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt.new.2 b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt.new.2 index bec3dc030478..d85c786fbf53 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt.new.2 +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineExtensionAccessor/inlineSet.kt.new.2 @@ -2,6 +2,6 @@ package inline import kotlin.reflect.KProperty -inline fun Inline.setValue(receiver: Any?, prop: KProperty<*>, value: Int) { +inline operator fun Inline.setValue(receiver: Any?, prop: KProperty<*>, value: Int) { println(value * 2) } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt index 059a1a9379d0..4e82a0cda3f4 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt @@ -3,11 +3,11 @@ package inline import kotlin.reflect.KProperty class Inline { - inline fun getValue(receiver: Any?, prop: KProperty<*>): Int { + inline operator fun getValue(receiver: Any?, prop: KProperty<*>): Int { return 0 } - inline fun setValue(receiver: Any?, prop: KProperty<*>, value: Int) { + inline operator fun setValue(receiver: Any?, prop: KProperty<*>, value: Int) { println(value) } } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.1 b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.1 index b983f8237cbd..fcf08146bf55 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.1 +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.1 @@ -3,11 +3,11 @@ package inline import kotlin.reflect.KProperty class Inline { - inline fun getValue(receiver: Any?, prop: KProperty<*>): Int { + inline operator fun getValue(receiver: Any?, prop: KProperty<*>): Int { return 1 } - inline fun setValue(receiver: Any?, prop: KProperty<*>, value: Int) { + inline operator fun setValue(receiver: Any?, prop: KProperty<*>, value: Int) { println(value) } } diff --git a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.2 b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.2 index f65f3c2cf627..05c7f9e1835d 100644 --- a/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.2 +++ b/plugins/kotlin/jps/jps-plugin/testData/incremental/pureKotlin/delegatedPropertyInlineMethodAccessor/inline.kt.new.2 @@ -3,11 +3,11 @@ package inline import kotlin.reflect.KProperty class Inline { - inline fun getValue(receiver: Any?, prop: KProperty<*>): Int { + inline operator fun getValue(receiver: Any?, prop: KProperty<*>): Int { return 1 } - inline fun setValue(receiver: Any?, prop: KProperty<*>, value: Int) { + inline operator fun setValue(receiver: Any?, prop: KProperty<*>, value: Int) { println(value * 2) } }