Forbid provideDelegate, setValue and getValue suspend operators
#KT-24866 Fixed
This commit is contained in:
Vendored
+1
-1
@@ -4,5 +4,5 @@ fun bar(d: Delegate): String {
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
suspend operator fun getValue(thisRef: Any?, property: Any?): String = ""
|
||||
suspend <!UNSUPPORTED!>operator<!> fun getValue(thisRef: Any?, property: Any?): String = ""
|
||||
}
|
||||
|
||||
@@ -1,11 +1,43 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
suspend <!UNSUPPORTED!>operator<!> fun get(x: Int) = 1
|
||||
suspend <!UNSUPPORTED!>operator<!> fun set(x: Int, v: String) {}
|
||||
|
||||
<!UNSUPPORTED!>operator<!> suspend fun contains(y: String): Boolean = true
|
||||
|
||||
suspend operator fun unaryPlus() = this
|
||||
suspend operator fun unaryMinus() = this
|
||||
suspend operator fun not() = this
|
||||
suspend operator fun inc() = this
|
||||
suspend operator fun dec() = this
|
||||
|
||||
suspend operator fun plus(a: A) = a
|
||||
suspend operator fun minus(a: A) = a
|
||||
suspend operator fun times(a: A) = a
|
||||
suspend operator fun div(a: A) = a
|
||||
suspend operator fun rem(a: A) = a
|
||||
suspend operator fun rangeTo(a: A) = a
|
||||
|
||||
suspend operator fun invoke(a: A) = a
|
||||
|
||||
suspend operator fun compareTo(a: A) = hashCode().compareTo(a.hashCode())
|
||||
|
||||
suspend operator fun iterator() = this
|
||||
suspend operator fun hasNext() = false
|
||||
suspend operator fun next() = this
|
||||
|
||||
suspend <!UNSUPPORTED!>operator<!> fun contains(b: A) = this == b
|
||||
suspend <!UNSUPPORTED!>operator<!> fun get(a: A) = a
|
||||
suspend <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(a: A) = a === this
|
||||
suspend <!UNSUPPORTED!>operator<!> fun set(a: A, b: A) {}
|
||||
|
||||
suspend <!UNSUPPORTED!>operator<!> fun provideDelegate(a: A, p: KProperty<*>) = a
|
||||
suspend <!UNSUPPORTED!>operator<!> fun getValue(a: A, p: KProperty<*>) = a
|
||||
suspend <!UNSUPPORTED!>operator<!> fun setValue(a: A, p: KProperty<*>, b: A) {}
|
||||
}
|
||||
|
||||
class B
|
||||
|
||||
Reference in New Issue
Block a user