"Inapplicable operator modifier" and "Inapplicable infix modifier" are now errors
This commit is contained in:
@@ -596,8 +596,8 @@ public interface Errors {
|
||||
DiagnosticFactory0<PsiElement> UNDERSCORE_IS_RESERVED = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, String> INVALID_CHARACTERS = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_OPERATOR_MODIFIER = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_INFIX_MODIFIER = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_OPERATOR_MODIFIER = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_INFIX_MODIFIER = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory2<PsiElement, FunctionDescriptor, String> OPERATOR_MODIFIER_REQUIRED = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<KtOperationReferenceExpression, FunctionDescriptor, String> INFIX_MODIFIER_REQUIRED = DiagnosticFactory2.create(ERROR);
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
var result = "Fail"
|
||||
|
||||
class A
|
||||
|
||||
operator fun A.plusAssign(a: A, s: String = "OK") {
|
||||
result = s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
A() += A()
|
||||
return result
|
||||
}
|
||||
Vendored
-14
@@ -1,14 +0,0 @@
|
||||
var result = "Fail"
|
||||
|
||||
class A
|
||||
|
||||
operator fun A.plus(a: A, s: String = "OK"): A {
|
||||
result = s
|
||||
return this
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var a = A()
|
||||
a += A()
|
||||
return result
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
infix fun Int.foo(o: String, k: String = "K") = o + k
|
||||
|
||||
fun box() = 42 foo "O"
|
||||
@@ -1,5 +0,0 @@
|
||||
class A
|
||||
|
||||
operator fun A.plus(i: A, ok: String = "OK") = ok
|
||||
|
||||
fun box() = A() + A()
|
||||
@@ -1,5 +0,0 @@
|
||||
class A
|
||||
|
||||
operator fun A.contains(i: A, actual: Boolean = true) = actual
|
||||
|
||||
fun box() = if (A() in A()) "OK" else "Fail"
|
||||
@@ -1,11 +0,0 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(t: Any?, p: KProperty<*>, s: String = ""): Int = 1
|
||||
}
|
||||
|
||||
val prop: Int by Delegate()
|
||||
|
||||
fun box(): String {
|
||||
return if(prop == 1) "OK" else "fail"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(t: Any?, vararg p: KProperty<*>): Int = 1
|
||||
}
|
||||
|
||||
val prop: Int by Delegate()
|
||||
|
||||
fun box(): String {
|
||||
return if(prop == 1) "OK" else "fail"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
open class T(var value: Int) {}
|
||||
|
||||
operator fun plusAssign(): T {
|
||||
fun plusAssign(): T {
|
||||
|
||||
operator fun T.plusAssign(s: Int) {
|
||||
value += s
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
class Z {}
|
||||
|
||||
fun box(): String {
|
||||
operator fun Z.plus(s : String, d : String = "K") : String {
|
||||
return s + d
|
||||
}
|
||||
return Z() + "O"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
class MyClass
|
||||
|
||||
// In principle it is not correct, MyClass? is not a subtype of MyClass
|
||||
operator fun MyClass.inc(): MyClass? = null
|
||||
|
||||
public fun box() : String {
|
||||
var i : MyClass?
|
||||
i = MyClass()
|
||||
val j = i++
|
||||
|
||||
return if (j is MyClass && null == i) "OK" else "fail i = $i j = $j"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
class MyClass
|
||||
|
||||
// In principle it is not correct, MyClass? is not a subtype of MyClass
|
||||
operator fun MyClass.inc(): MyClass? = null
|
||||
|
||||
public fun box() : String {
|
||||
var i : MyClass?
|
||||
i = MyClass()
|
||||
val j = ++i
|
||||
|
||||
return if (j == null && null == i) "OK" else "fail i = $i j = $j"
|
||||
}
|
||||
-60
@@ -2760,36 +2760,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/defaultArguments/function"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("augmentedAssignment.kt")
|
||||
public void testAugmentedAssignment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/augmentedAssignment.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("augmentedAssignmentViaBinaryExpression.kt")
|
||||
public void testAugmentedAssignmentViaBinaryExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/augmentedAssignmentViaBinaryExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("binaryCall.kt")
|
||||
public void testBinaryCall() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/binaryCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("binaryExpression.kt")
|
||||
public void testBinaryExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/binaryExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("contains.kt")
|
||||
public void testContains() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/contains.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("covariantOverride.kt")
|
||||
public void testCovariantOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/covariantOverride.kt");
|
||||
@@ -2998,12 +2968,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultArgs.kt")
|
||||
public void testDefaultArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/defaultArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegateAsInnerClass.kt")
|
||||
public void testDelegateAsInnerClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/delegateAsInnerClass.kt");
|
||||
@@ -3147,12 +3111,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/varInInnerClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/vararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/diagnostics")
|
||||
@@ -4523,12 +4481,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/functions/localFunctions/localFunctionInConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localWithDefault.kt")
|
||||
public void testLocalWithDefault() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/functions/localFunctions/localWithDefault.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4576,12 +4528,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("postfixNotnullClassIncrement.kt")
|
||||
public void testPostfixNotnullClassIncrement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/increment/postfixNotnullClassIncrement.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("postfixNullableClassIncrement.kt")
|
||||
public void testPostfixNullableClassIncrement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/increment/postfixNullableClassIncrement.kt");
|
||||
@@ -4612,12 +4558,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("prefixNotnullClassIncrement.kt")
|
||||
public void testPrefixNotnullClassIncrement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/increment/prefixNotnullClassIncrement.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("prefixNullableClassIncrement.kt")
|
||||
public void testPrefixNullableClassIncrement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/increment/prefixNullableClassIncrement.kt");
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ fun Int.foo() = this
|
||||
val foo : Int = 0
|
||||
}
|
||||
|
||||
<warning>operator</warning> fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
|
||||
<error>operator</error> fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any?.equals1(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any.equals2(<warning>other</warning> : Any?) : Boolean = true
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ abstract class NotRange4() {
|
||||
}
|
||||
|
||||
abstract class ImproperIterator3 {
|
||||
abstract <warning>operator</warning> fun hasNext() : Int
|
||||
abstract <error>operator</error> fun hasNext() : Int
|
||||
abstract operator fun next() : Int
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -16,8 +16,8 @@ fun testIncDec() {
|
||||
}
|
||||
|
||||
class WrongIncDec() {
|
||||
<warning>operator</warning> fun inc() : Int = 1
|
||||
<warning>operator</warning> fun dec() : Int = 1
|
||||
<error>operator</error> fun inc() : Int = 1
|
||||
<error>operator</error> fun dec() : Int = 1
|
||||
}
|
||||
|
||||
fun testWrongIncDec() {
|
||||
@@ -29,8 +29,8 @@ fun testWrongIncDec() {
|
||||
}
|
||||
|
||||
class UnitIncDec() {
|
||||
<warning>operator</warning> fun inc() : Unit {}
|
||||
<warning>operator</warning> fun dec() : Unit {}
|
||||
<error>operator</error> fun inc() : Unit {}
|
||||
<error>operator</error> fun dec() : Unit {}
|
||||
}
|
||||
|
||||
fun testUnitIncDec() {
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(a: Int, vararg b: Int, c: Int = 0) : Int = 0
|
||||
}
|
||||
val test = Test()
|
||||
test.p<caret>lus(1)
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(a: Int, vararg b: Int, c: Int = 0) : Int = 0
|
||||
}
|
||||
val test = Test()
|
||||
test + 1
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(vararg b: Int, c: Int = 0) : Int = 0
|
||||
}
|
||||
val test = Test()
|
||||
test.p<caret>lus(1)
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(vararg b: Int, c: Int = 0) : Int = 0
|
||||
}
|
||||
val test = Test()
|
||||
test + 1
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun plus(a: Int, b: Int=5): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
test.pl<caret>us(1)
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun plus(a: Int, b: Int=5): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
test + 1
|
||||
}
|
||||
idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/missingDefaultArgument.kt
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(a: Int=1, b: Int=2) : Int = 0
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun plus(a: Int, b: Int): Test = Test()
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(vararg b: Int, c: Int = 0): Int = 0
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun plus(vararg b: Int, c: Int = 0): Int = 0
|
||||
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(vararg a: Int): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
test.unaryPl<caret>us()
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(vararg a: Int): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
+test
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(a: Int=1): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
test.unaryPl<caret>us()
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(a: Int=1): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
+test
|
||||
}
|
||||
idea/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/functionLiteralArgument.kt
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(fn: () -> Unit): Test = Test()
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(a: Int): Test = Test()
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(vararg a: Int): Test = Test()
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
|
||||
fun test() {
|
||||
class Test {
|
||||
operator fun unaryPlus(a: Int): Test = Test()
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(vararg a: Int, b: Int = 0): Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
test.contai<caret>ns(1)
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(vararg a: Int, b: Int = 0): Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
1 in test
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(c: Int, vararg a: Int, b: Int = 0): Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
test.contai<caret>ns(1)
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(c: Int, vararg a: Int, b: Int = 0): Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
1 in test
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int, b: Int=5) : Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
test.c<caret>ontains(1)
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int, b: Int=5) : Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
1 in test
|
||||
}
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Cannot find a parameter with this name: c
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int=1, b: Int=2): Boolean = true
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: No value passed for parameter b
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int, b: Int): Boolean = true
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int, b: Int) : Boolean = true
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
test.c<caret>ontains(a=5)
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
|
||||
}
|
||||
val test = Test()
|
||||
5 in test
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have at least 1 value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun get() : Int = 0
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must have at least 2 value parameters
|
||||
|
||||
class C {
|
||||
operator fun set(){}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: last parameter must not have a default value or be a vararg
|
||||
|
||||
class C {
|
||||
operator fun set(s: String, vararg value: Int): Boolean = true
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: operator modifier is inapplicable on this function: must be a member or an extension
|
||||
|
||||
package p
|
||||
|
||||
operator fun get(s: String) = s
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WARNING: 'infix' modifier is inapplicable on this function
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
interface Foo {
|
||||
infix fun foo(a: Int, b: Int)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
fun foo(x: Foo) {
|
||||
x.<caret>foo(bar = x)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WARNING: 'infix' modifier is inapplicable on this function
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
package ppp
|
||||
|
||||
infix fun foo(p: String){}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
|
||||
class Foo {
|
||||
infix fun foo(x: Int = 0, y: Int = 0) {
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WARNING: 'infix' modifier is inapplicable on this function
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
|
||||
fun foo(x: Foo) {
|
||||
x.<caret>foo(1) { it * 2 }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// WARNING: 'infix' modifier is inapplicable on this function
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
|
||||
package demo
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// "Replace with 'newFun(p, this)'" "true"
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun(p, this)"))
|
||||
infix fun String.oldFun(p: Int) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// "Replace with 'newFun(p, this)'" "true"
|
||||
// ERROR: 'infix' modifier is inapplicable on this function
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun(p, this)"))
|
||||
infix fun String.oldFun(p: Int) {
|
||||
|
||||
@@ -2533,28 +2533,10 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ReplaceCallWithBinaryOperator extends AbstractIntentionTest {
|
||||
@TestMetadata("acceptableVararg1.kt")
|
||||
public void testAcceptableVararg1() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/acceptableVararg1.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("acceptableVararg2.kt")
|
||||
public void testAcceptableVararg2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/acceptableVararg2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInReplaceCallWithBinaryOperator() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("allowableDefaultArgument.kt")
|
||||
public void testAllowableDefaultArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/allowableDefaultArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("divSanityTest.kt")
|
||||
public void testDivSanityTest() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithBinaryOperator/divSanityTest.kt");
|
||||
@@ -2656,12 +2638,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ReplaceCallWithUnaryOperator extends AbstractIntentionTest {
|
||||
@TestMetadata("acceptableVararg.kt")
|
||||
public void testAcceptableVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/acceptableVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInReplaceCallWithUnaryOperator() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
||||
}
|
||||
@@ -2672,12 +2648,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultArgument.kt")
|
||||
public void testDefaultArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/defaultArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceCallWithUnaryOperator/extensionFunction.kt");
|
||||
@@ -2755,28 +2725,10 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ReplaceContains extends AbstractIntentionTest {
|
||||
@TestMetadata("acceptableVararg.kt")
|
||||
public void testAcceptableVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceContains/acceptableVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("acceptableVararg2.kt")
|
||||
public void testAcceptableVararg2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceContains/acceptableVararg2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInReplaceContains() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/conventionNameCalls/replaceContains"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("allowableDefaultArgument.kt")
|
||||
public void testAllowableDefaultArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceContains/allowableDefaultArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("containsInExpression.kt")
|
||||
public void testContainsInExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceContains/containsInExpression.kt");
|
||||
@@ -2878,12 +2830,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceContains/unacceptableVararg2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("validNamedArgument.kt")
|
||||
public void testValidNamedArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceContains/validNamedArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet")
|
||||
|
||||
+4
@@ -19,8 +19,10 @@ abstract class A {
|
||||
fun finalFlagRemovedFun() {}
|
||||
final fun finalFlagUnchangedFun() {}
|
||||
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagAddedFun() {}
|
||||
fun infixFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagUnchangedFun() {}
|
||||
|
||||
inline fun inlineFlagAddedFun() {}
|
||||
@@ -45,8 +47,10 @@ abstract class A {
|
||||
fun openFlagRemovedFun() {}
|
||||
open fun openFlagUnchangedFun() {}
|
||||
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagAddedFun() {}
|
||||
fun operatorFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagUnchangedFun() {}
|
||||
|
||||
private val privateFlagAddedVal = ""
|
||||
|
||||
+4
@@ -20,7 +20,9 @@ abstract class A {
|
||||
final fun finalFlagUnchangedFun() {}
|
||||
|
||||
fun infixFlagAddedFun() {}
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagUnchangedFun() {}
|
||||
|
||||
fun inlineFlagAddedFun() {}
|
||||
@@ -46,7 +48,9 @@ abstract class A {
|
||||
open fun openFlagUnchangedFun() {}
|
||||
|
||||
fun operatorFlagAddedFun() {}
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagUnchangedFun() {}
|
||||
|
||||
val privateFlagAddedVal = ""
|
||||
|
||||
@@ -8,8 +8,10 @@ external fun externalFlagAddedFun()
|
||||
fun externalFlagRemovedFun() {}
|
||||
external fun externalFlagUnchangedFun()
|
||||
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagAddedFun() {}
|
||||
fun infixFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagUnchangedFun() {}
|
||||
|
||||
inline fun inlineFlagAddedFun() {}
|
||||
@@ -23,8 +25,10 @@ internal fun internalFlagAddedFun() {}
|
||||
fun internalFlagRemovedFun() {}
|
||||
internal fun internalFlagUnchangedFun() {}
|
||||
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagAddedFun() {}
|
||||
fun operatorFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagUnchangedFun() {}
|
||||
|
||||
private val privateFlagAddedVal = ""
|
||||
|
||||
@@ -9,7 +9,9 @@ external fun externalFlagRemovedFun()
|
||||
external fun externalFlagUnchangedFun()
|
||||
|
||||
fun infixFlagAddedFun() {}
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_INFIX_MODIFIER")
|
||||
infix fun infixFlagUnchangedFun() {}
|
||||
|
||||
fun inlineFlagAddedFun() {}
|
||||
@@ -24,7 +26,9 @@ internal fun internalFlagRemovedFun() {}
|
||||
internal fun internalFlagUnchangedFun() {}
|
||||
|
||||
fun operatorFlagAddedFun() {}
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagRemovedFun() {}
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
operator fun operatorFlagUnchangedFun() {}
|
||||
|
||||
val privateFlagAddedVal = ""
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import kotlin.reflect./*p:kotlin.reflect*/KProperty
|
||||
}
|
||||
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.getValue(t: /*p:foo.bar*/Any?, p: KProperty<*>) = /*p:kotlin(Int)*/1
|
||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.propertyDelegated(p: /*p:foo.bar*/Any?) {}
|
||||
/*p:foo.bar*/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?) {}
|
||||
|
||||
@@ -960,6 +960,7 @@ public fun CharSequence.lastIndexOf(string: String, startIndex: Int = lastIndex,
|
||||
*
|
||||
* @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
|
||||
*/
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
public operator fun CharSequence.contains(other: CharSequence, ignoreCase: Boolean = false): Boolean =
|
||||
if (other is String)
|
||||
indexOf(other, ignoreCase = ignoreCase) >= 0
|
||||
@@ -973,6 +974,7 @@ public operator fun CharSequence.contains(other: CharSequence, ignoreCase: Boole
|
||||
*
|
||||
* @param ignoreCase `true` to ignore character case when comparing characters. By default `false`.
|
||||
*/
|
||||
@Suppress("INAPPLICABLE_OPERATOR_MODIFIER")
|
||||
public operator fun CharSequence.contains(char: Char, ignoreCase: Boolean = false): Boolean =
|
||||
indexOf(char, ignoreCase = ignoreCase) >= 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user