mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix tests: "infix modifier required" and "operator modifier required" errors
GitOrigin-RevId: 1abe9dbc56ccf5e2c31050ac25f0fb1480dd8926
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3cc5ae0090
commit
6dd0825921
-48
@@ -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");
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
fun Any.get(a: Int) {
|
||||
operator fun Any.get(a: Int) {
|
||||
if (a > 0) {
|
||||
<lineMarker descr="Recursive call">this[a - 1]</lineMarker>
|
||||
}
|
||||
@@ -10,32 +10,32 @@ class A {
|
||||
return true
|
||||
}
|
||||
|
||||
fun inc(): A {
|
||||
operator fun inc(): A {
|
||||
this<lineMarker descr="Recursive call">++</lineMarker>
|
||||
<lineMarker descr="Recursive call">++</lineMarker>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() {
|
||||
<lineMarker descr="Recursive call">+</lineMarker>this
|
||||
}
|
||||
|
||||
fun unaryMinus() {
|
||||
operator fun unaryMinus() {
|
||||
<lineMarker descr="Recursive call">-</lineMarker>this
|
||||
}
|
||||
|
||||
fun plus(a: Int) {
|
||||
operator fun plus(a: Int) {
|
||||
this <lineMarker descr="Recursive call">+</lineMarker> 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() {
|
||||
<lineMarker descr="Recursive call">this</lineMarker>()
|
||||
<lineMarker descr="Recursive call">invoke</lineMarker>()
|
||||
}
|
||||
+1
-1
@@ -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!!
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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!!
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package test
|
||||
|
||||
public open class Max {
|
||||
public open fun max<T : Any?>(p0 : Collection<T>?): T? where T : Comparable<T>? {
|
||||
public open fun <T : Any?> max(p0 : Collection<T>?): T? where T : Comparable<T>? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,6 +8,6 @@ class A {
|
||||
}
|
||||
|
||||
class MyProperty<T> {
|
||||
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) {}
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,6 +9,6 @@ public final class A {
|
||||
|
||||
public final class MyProperty</*0*/ T> {
|
||||
/*primary*/ public constructor MyProperty</*0*/ T>()
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
<selection>fun f(a: A) {
|
||||
a + a
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
a.ext
|
||||
a.infix
|
||||
a.minus
|
||||
a.p
|
||||
a.plus
|
||||
a.unaryMinus
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
<selection>fun f() {
|
||||
for (i in A()) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package a
|
||||
class A {
|
||||
}
|
||||
|
||||
fun A.get(s: String) {
|
||||
operator fun A.get(s: String) {
|
||||
}
|
||||
|
||||
<selection>fun f() {
|
||||
|
||||
@@ -3,7 +3,7 @@ package a
|
||||
class A {
|
||||
}
|
||||
|
||||
fun A.invoke() {
|
||||
operator fun A.invoke() {
|
||||
}
|
||||
|
||||
<selection>fun f(a: A) {
|
||||
|
||||
@@ -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
|
||||
|
||||
<selection>fun f() {
|
||||
val (a, b) = A()
|
||||
|
||||
+1
-1
@@ -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()) {
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
<selection>fun A.iterator() = B()
|
||||
<selection>operator fun A.iterator() = B()
|
||||
|
||||
fun f() {
|
||||
for (i in A()) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class A {
|
||||
fun plus() {}
|
||||
fun minus() {}
|
||||
operator fun unaryPlus() {}
|
||||
operator fun unaryMinus() {}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
+A() || A()-<caret>
|
||||
<caret>+A() || -A()
|
||||
}
|
||||
// EXISTS: plus(), minus()
|
||||
// EXISTS: unaryPlus(), unaryMinus()
|
||||
+2
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import kotlin.properties.Delegates
|
||||
// EXPRESSION: i
|
||||
// RESULT: instance of java.lang.Integer(id=ID): Ljava/lang/Integer;
|
||||
//Breakpoint!
|
||||
fun foo<T>(i: T) = i
|
||||
fun <T> foo(i: T) = i
|
||||
|
||||
fun run(i: () -> Int) = 1
|
||||
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@ fun main(args: Array<String>) {
|
||||
test<Int>()
|
||||
}
|
||||
|
||||
fun foo<U>(): Int {
|
||||
fun <U> foo(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
fun test<T>() {
|
||||
fun <T> test() {
|
||||
//Breakpoint!
|
||||
val a = foo<T>()
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// OPTIONS: usages
|
||||
|
||||
class A(val n: Int) {
|
||||
fun <caret>minus(): A = this
|
||||
operator fun <caret>unaryMinus(): A = this
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A(1).minus()
|
||||
A(1).unaryMinus()
|
||||
-A(1)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
Function call (10: 5) -A(1)
|
||||
Function call (9: 10) A(1).minus()
|
||||
Function call (9: 10) A(1).unaryMinus()
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun <T> T.compareTo(a: T): Int = 0
|
||||
operator fun <T> T.compareTo(a: T): Int = 0
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val foo = null
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun <T> T.compareTo(a: T): Int = 0
|
||||
operator fun <T> T.compareTo(a: T): Int = 0
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val foo = null
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun <T> T.compareTo(a: T): Int = 0
|
||||
operator fun <T> T.compareTo(a: T): Int = 0
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val foo = "foo"
|
||||
|
||||
+1
-1
@@ -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<String>) {
|
||||
val foo: String = "foo"
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
fun doSomething<T>(a: T) {}
|
||||
fun <T> 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).unaryPl<caret>us())).toString())
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
fun doSomething<T>(a: T) {}
|
||||
fun <T> 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())
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
fun test() {
|
||||
class Test()
|
||||
|
||||
fun Test.unaryPlus(): Test = Test()
|
||||
operator fun Test.unaryPlus(): Test = Test()
|
||||
|
||||
val test = Test()
|
||||
test.unaryPl<caret>us()
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
fun test() {
|
||||
class Test()
|
||||
|
||||
fun Test.unaryPlus(): Test = Test()
|
||||
operator fun Test.unaryPlus(): Test = Test()
|
||||
|
||||
val test = Test()
|
||||
+test
|
||||
|
||||
+1
-1
@@ -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.unaryMin<caret>us()
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
fun unaryPlus(): Test = Test()
|
||||
operator fun unaryPlus(): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
+test.unaryP<caret>lus()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun test() {
|
||||
class Test {
|
||||
fun unaryPlus(): Test = Test()
|
||||
operator fun unaryPlus(): Test = Test()
|
||||
}
|
||||
val test = Test()
|
||||
+(+test)
|
||||
|
||||
+1
-1
@@ -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.unaryPl<caret>us()
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class C {
|
||||
companion object {
|
||||
fun unaryMinus(): C = C()
|
||||
operator fun unaryMinus(): C = C()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class C {
|
||||
companion object {
|
||||
fun unaryMinus(): C = C()
|
||||
operator fun unaryMinus(): C = C()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
open class Base {
|
||||
open fun unaryMinus() = this
|
||||
open operator fun unaryMinus() = this
|
||||
}
|
||||
|
||||
class C : Base() {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun test() {
|
||||
class Test {
|
||||
fun unaryPlus<T>(): T? = this as? T
|
||||
operator fun <T> unaryPlus(): T? = this as? T
|
||||
}
|
||||
val test = Test()
|
||||
test.unaryP<caret>lus<Int>()
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
fun foo() {
|
||||
val x = 1..4
|
||||
|
||||
x <caret>forEach { a -> a }
|
||||
x.<caret>forEach { a -> a }
|
||||
}
|
||||
+1
-1
@@ -3,5 +3,5 @@
|
||||
fun foo() {
|
||||
val x = 1..4
|
||||
|
||||
<caret>x forEach { a -> a }
|
||||
<caret>x.forEach { a -> a }
|
||||
}
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
infix fun Int.upTo(other: Int) = this.rangeTo(other)
|
||||
|
||||
fun main() {
|
||||
(1 rangeTo 2).<caret>forEach { x -> x }
|
||||
(1 upTo 2).<caret>forEach { x -> x }
|
||||
}
|
||||
+4
-1
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
class A(val n: Int) {
|
||||
fun <caret>invoke(): Int = 1
|
||||
operator fun <caret>invoke(): Int = 1
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
class A(val n: Int) {
|
||||
fun <caret>iterator(): Iterator<Int> = throw Exception("")
|
||||
operator fun <caret>iterator(): Iterator<Int> = throw Exception("")
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
class A(val n: Int) {
|
||||
fun <caret>unaryMinus(): A = A(-n)
|
||||
operator fun <caret>unaryMinus(): A = A(-n)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun String.not(): Boolean {
|
||||
operator fun String.not(): Boolean {
|
||||
return length == 0
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun String.not(): Boolean {
|
||||
operator fun String.not(): Boolean {
|
||||
return length == 0
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun Boolean.plus(): Boolean {
|
||||
operator fun Boolean.unaryPlus(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun Boolean.plus(): Boolean {
|
||||
operator fun Boolean.unaryPlus(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun main() {
|
||||
<caret>for (x in 1 rangeTo 2) {
|
||||
<caret>for (x in 1.rangeTo(2)) {
|
||||
x
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun main() {
|
||||
(1 rangeTo 2).forEach { x -> x }
|
||||
1.rangeTo(2).forEach { x -> x }
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface Foo {
|
||||
fun foo(f: (Int) -> Unit)
|
||||
infix fun foo(f: (Int) -> Unit)
|
||||
}
|
||||
fun foo(x: Foo) {
|
||||
x <caret>foo { it * 2 }
|
||||
|
||||
+1
-1
@@ -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 }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
infix fun String.compareTo(other: String) = 0
|
||||
|
||||
fun foo(x: String) {
|
||||
x!! <caret>compareTo "1"
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
infix fun String.compareTo(other: String) = 0
|
||||
|
||||
fun foo(x: String) {
|
||||
x!!.compareTo("1")
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
infix fun String.add(other: String) = ""
|
||||
|
||||
fun foo(x: String) {
|
||||
x plus<caret> ("1" + "2")
|
||||
x add<caret> ("1" + "2")
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
infix fun String.add(other: String) = ""
|
||||
|
||||
fun foo(x: String) {
|
||||
x.plus("1" + "2")
|
||||
x.add("1" + "2")
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
infix fun Int.compareTo(other: Int) = 0
|
||||
|
||||
fun foo(x: Int) {
|
||||
x <caret>compareTo 1
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
infix fun Int.compareTo(other: Int) = 0
|
||||
|
||||
fun foo(x: Int) {
|
||||
x.compareTo(1)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Bar {
|
||||
fun get(vararg args: Int) {}
|
||||
operator fun get(vararg args: Int) {}
|
||||
}
|
||||
|
||||
fun foo(a: Bar, i: Int) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Bar {
|
||||
fun get(vararg args: Int) {}
|
||||
operator fun get(vararg args: Int) {}
|
||||
}
|
||||
|
||||
fun foo(a: Bar, i: Int) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Bar {
|
||||
fun plusAssign(arg: Bar) {}
|
||||
operator fun plusAssign(arg: Bar) {}
|
||||
}
|
||||
|
||||
fun foo(b: Bar) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Bar {
|
||||
fun plusAssign(arg: Bar) {}
|
||||
operator fun plusAssign(arg: Bar) {}
|
||||
}
|
||||
|
||||
fun foo(b: Bar) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class bar() {
|
||||
fun invoke(i: Any?, j: Any?) : Boolean {
|
||||
operator fun invoke(i: Any?, j: Any?) : Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class bar() {
|
||||
fun invoke(i: Any?, j: Any?) : Boolean {
|
||||
operator fun invoke(i: Any?, j: Any?) : Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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() {
|
||||
|
||||
+1
-1
@@ -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() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Mocha() {
|
||||
fun invoke(f: (Int) -> String) {}
|
||||
operator fun invoke(f: (Int) -> String) {}
|
||||
}
|
||||
fun main() {
|
||||
val mocha = Mocha()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Mocha() {
|
||||
fun invoke(f: (Int) -> String) {}
|
||||
operator fun invoke(f: (Int) -> String) {}
|
||||
}
|
||||
fun main() {
|
||||
val mocha = Mocha()
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
<caret>(x + x)[x]
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface Foo {
|
||||
fun get(x : Any) : Foo
|
||||
operator fun get(x : Any) : Foo
|
||||
}
|
||||
fun foo(x: Foo) {
|
||||
<caret>(x[x])[x]
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface Foo {
|
||||
fun get(x : Any) : Foo
|
||||
operator fun get(x : Any) : Foo
|
||||
}
|
||||
fun foo(x: Foo) {
|
||||
x[x][x]
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
interface Foo {
|
||||
fun inc() : Foo
|
||||
fun not() : Foo
|
||||
operator fun inc() : Foo
|
||||
operator fun not() : Foo
|
||||
}
|
||||
fun foo(x: Foo) {
|
||||
!(<caret>x.inc())
|
||||
|
||||
+2
-2
@@ -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()
|
||||
|
||||
+1
-1
@@ -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<caret>)[41]
|
||||
|
||||
+1
-1
@@ -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]
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
<caret>!(1 lt 2)
|
||||
}
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun main() {
|
||||
val testing = 5 compareTo 10
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun main() {
|
||||
val test = 5<caret> div 2
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fun neq(a: Int, b: Int) {
|
||||
if (a equals<caret> b) {}
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
fun neq(a: Int, b: Int) {
|
||||
if (b equals a) {}
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
fun neq(a: Int, b: Int) {
|
||||
if (a identityEquals<caret> b) {}
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
fun neq(a: Int, b: Int) {
|
||||
if (b identityEquals a) {}
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun new(x: Int, y: Int): Int {
|
||||
return y <caret>minus x
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fun test(a: Int, b: Int): Int {
|
||||
return a <caret>plus b
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
fun test(a: Int, b: Int): Int {
|
||||
return b plus a
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user