Fix tests: "infix modifier required" and "operator modifier required" errors
This commit is contained in:
@@ -19,8 +19,8 @@ class DelegateImpl<T> {
|
||||
val value: T = null!!
|
||||
}
|
||||
|
||||
public fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
|
||||
public fun <T> DelegateImpl<T>.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {}
|
||||
operator fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
|
||||
operator fun <T> DelegateImpl<T>.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {}
|
||||
|
||||
|
||||
|
||||
|
||||
+2
@@ -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
|
||||
|
||||
|
||||
+2
@@ -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
|
||||
|
||||
|
||||
@@ -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, <caret>42)
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// "Create member function 'foo'" "true"
|
||||
// ERROR: infix modifier is required on 'foo' in 'A'
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Create member function 'foo'" "true"
|
||||
// ERROR: infix modifier is required on 'foo' in 'A'
|
||||
|
||||
class A<T>(val n: T) {
|
||||
infix fun foo(t: T): A<T> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create extension function '!u00A0'" "true"
|
||||
// ERROR: infix modifier is required on '!u00A0' in ''
|
||||
|
||||
fun test() {
|
||||
val t: Int = 1 <caret>`!u00A0` 2
|
||||
}
|
||||
+2
@@ -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
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'component3'" "true"
|
||||
class Foo<T> {
|
||||
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<caret><Int>()
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'component3'" "true"
|
||||
class Foo<T> {
|
||||
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.
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'component3'" "true"
|
||||
class Foo<T> {
|
||||
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<caret><Int>()
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// "Create member function 'component3'" "true"
|
||||
class Foo<T> {
|
||||
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.
|
||||
|
||||
Vendored
+4
-4
@@ -1,16 +1,16 @@
|
||||
// "Create extension function 'component2'" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
fun next(): Any {
|
||||
operator fun hasNext(): Boolean { return false }
|
||||
operator fun next(): Any {
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
}
|
||||
fun Any.component1(): Int {
|
||||
operator fun Any.component1(): Int {
|
||||
return 0
|
||||
}
|
||||
fun foo() {
|
||||
|
||||
Vendored
+4
-4
@@ -1,16 +1,16 @@
|
||||
// "Create extension function 'component2'" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
fun next(): Any {
|
||||
operator fun hasNext(): Boolean { return false }
|
||||
operator fun next(): Any {
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
}
|
||||
fun Any.component1(): Int {
|
||||
operator fun Any.component1(): Int {
|
||||
return 0
|
||||
}
|
||||
fun foo() {
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
Vendored
+1
-1
@@ -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.
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
Vendored
+1
-1
@@ -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.
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun x (y: Foo<Iterable<T>>) {
|
||||
val z: Iterable<T> = y<caret>[""]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun x (y: Foo<Iterable<T>>) {
|
||||
val z: Iterable<T> = y[""]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T>
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
operator fun get(s: String, w: T): T {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T>
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
val z = y<caret>["", w]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
operator fun get(s: String, w: T): Any {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
+2
@@ -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<caret>[""]
|
||||
}
|
||||
|
||||
+2
@@ -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[""]
|
||||
}
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <S> x (y: Foo<Iterable<S>>) {
|
||||
val z: Iterable<S> = y<caret>[""]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <S> x (y: Foo<Iterable<S>>) {
|
||||
val z: Iterable<S> = y[""]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T, S: Iterable<T>> {
|
||||
fun <U> x (y: Foo<U, Iterable<U>>) {
|
||||
val z: U = y<caret>[""]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T, S: Iterable<T>> {
|
||||
fun <U> x (y: Foo<U, Iterable<U>>) {
|
||||
val z: U = y[""]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
|
||||
val z: Iterable<T> = y<caret>["", w]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
|
||||
val z: Iterable<T> = y["", w]
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<T> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<S> {
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'get'" "true"
|
||||
// ERROR: operator modifier is required on 'get' in 'Foo'
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo<S> {
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
// "Create member function 'hasNext'" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): Int {
|
||||
operator fun next(): Int {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// "Create member function 'hasNext'" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): Int {
|
||||
operator fun next(): Int {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class FooIterator<T> {
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
// "Create member function 'hasNext'" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): T {
|
||||
operator fun next(): T {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
operator fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// "Create member function 'hasNext'" "true"
|
||||
class FooIterator<T> {
|
||||
fun next(): T {
|
||||
operator fun next(): T {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class FooIterator<T> {
|
||||
}
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
operator fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
// "Create member function 'next'" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
operator fun hasNext(): Boolean { return false }
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
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() {
|
||||
|
||||
Vendored
+4
-4
@@ -1,20 +1,20 @@
|
||||
// "Create member function 'next'" "true"
|
||||
class FooIterator<T> {
|
||||
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<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
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() {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Create member function 'next'" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
operator fun hasNext(): Boolean { return false }
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
// "Create member function 'next'" "true"
|
||||
class FooIterator<T> {
|
||||
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<T> {
|
||||
fun iterator(): FooIterator<String> {
|
||||
operator fun iterator(): FooIterator<String> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Create member function 'next'" "true"
|
||||
class FooIterator<T> {
|
||||
fun hasNext(): Boolean { return false }
|
||||
operator fun hasNext(): Boolean { return false }
|
||||
}
|
||||
class Foo<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
operator fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
// "Create member function 'next'" "true"
|
||||
class FooIterator<T> {
|
||||
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<T> {
|
||||
fun iterator(): FooIterator<T> {
|
||||
operator fun iterator(): FooIterator<T> {
|
||||
throw Exception("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'set'" "true"
|
||||
// ERROR: operator modifier is required on 'set' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
y<caret>["", w] = w
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// "Create member function 'set'" "true"
|
||||
// ERROR: operator modifier is required on 'set' in 'Foo'
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||
y["", w] = w
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Create extension function 'set'" "true"
|
||||
// ERROR: operator modifier is required on 'set' in ''
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
// "Create extension function 'set'" "true"
|
||||
// ERROR: operator modifier is required on 'set' in ''
|
||||
|
||||
class Foo<T> {
|
||||
fun <T> x (y: Any, w: java.util.ArrayList<T>) {
|
||||
|
||||
+1
-1
@@ -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() {
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
@@ -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() {
|
||||
"" <caret>oldFun 1
|
||||
|
||||
@@ -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() {
|
||||
<caret>newFun(1, "")
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
interface I
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun(p)"))
|
||||
fun I.plus(p: Int) {
|
||||
operator fun I.plus(p: Int) {
|
||||
newFun(p)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
interface I
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun(p)"))
|
||||
fun I.plus(p: Int) {
|
||||
operator fun I.plus(p: Int) {
|
||||
newFun(p)
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -13,4 +13,4 @@ fun foo(s: String, t: X) {
|
||||
}
|
||||
}
|
||||
|
||||
fun X.plus(x: X): X? = null
|
||||
operator fun X.plus(x: X): X? = null
|
||||
Vendored
+1
-1
@@ -13,4 +13,4 @@ fun foo(s: String, t: X) {
|
||||
}
|
||||
}
|
||||
|
||||
fun X.plus(x: X): X? = null
|
||||
operator fun X.plus(x: X): X? = null
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true"
|
||||
|
||||
infix fun Int.add(other: Int) = this + other
|
||||
|
||||
fun foo() {
|
||||
1<caret>!! plus 2
|
||||
1<caret>!! add 2
|
||||
}
|
||||
@@ -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<caret>!! plus 2)
|
||||
(1!! add 2)
|
||||
}
|
||||
@@ -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 <caret>object: T{}
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// "Cast expression 'a' to 'Foo'" "true"
|
||||
|
||||
interface Foo {
|
||||
fun not() : Foo
|
||||
operator fun not() : Foo
|
||||
}
|
||||
|
||||
open class MyClass {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// "Cast expression 'a' to 'Foo'" "true"
|
||||
|
||||
interface Foo {
|
||||
fun not() : Foo
|
||||
operator fun not() : Foo
|
||||
}
|
||||
|
||||
open class MyClass {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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<caret>
|
||||
return (a + a) as B
|
||||
}
|
||||
+3
-3
@@ -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) {
|
||||
|
||||
Vendored
+3
-3
@@ -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) {
|
||||
|
||||
@@ -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 <<caret> 0) {}
|
||||
|
||||
@@ -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 <<caret> 0) {}
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+3
-3
@@ -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) {
|
||||
|
||||
+3
-3
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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 * <caret>!(if (true) a else a)
|
||||
Vendored
+2
-2
@@ -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 * <caret>!(if (true) a else a)
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user