Add 'Change to val' quickfix for delegates without setValue
So #KT-13688 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
3292137acb
commit
2427406a8f
+12
@@ -0,0 +1,12 @@
|
||||
// "Change to val" "true"
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun test() {
|
||||
var foo: String by <caret>Delegate()
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Change to val" "true"
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun test() {
|
||||
val foo: String by <caret>Delegate()
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Change to val" "false"
|
||||
// ACTION: Create extension function 'Delegate.getValue'
|
||||
// ACTION: Create member function 'Delegate.getValue'
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'Delegate'
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun test() {
|
||||
var foo: String by <caret>Delegate()
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Change to val" "false"
|
||||
// ACTION: Create extension function 'Delegate.getValue', function 'Delegate.setValue'
|
||||
// ACTION: Create member function 'Delegate.getValue', function 'Delegate.setValue'
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'Delegate'
|
||||
// ERROR: Missing 'setValue(Nothing?, KProperty<*>, String)' method on delegate of type 'Delegate'
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun test() {
|
||||
var foo: String by <caret>Delegate()
|
||||
}
|
||||
|
||||
class Delegate
|
||||
Reference in New Issue
Block a user