Provide better error messages for read-only delegate
Split error reporting into two parts for incorrect and missing candidates. Missing function error is not reported on provideDelegate. Update error factory and default message for error. Update error texts in quick fix test data. #KT-16526 Fixed
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Missing 'getValue(BigTest, KProperty<*>)' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Missing 'setValue(BigTest, KProperty<*>, [ERROR : Type from delegate])' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'getValue(BigTest, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'setValue(BigTest, KProperty<*>, [ERROR : Type from delegate])' and thus it cannot serve as a delegate for var (read-write property)
|
||||
|
||||
package testing
|
||||
|
||||
@@ -27,8 +27,8 @@ public operator fun <T> DelegateImpl<T>.setValue(thisRef: Any, property: KProper
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Missing 'getValue(BigTest, KProperty<*>)' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Missing 'setValue(BigTest, KProperty<*>, [ERROR : Type from delegate])' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'getValue(BigTest, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'setValue(BigTest, KProperty<*>, [ERROR : Type from delegate])' and thus it cannot serve as a delegate for var (read-write property)
|
||||
|
||||
package testing
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Missing 'getValue(BigTest, KProperty<*>)' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'getValue(BigTest, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
|
||||
package testing
|
||||
|
||||
@@ -27,7 +27,7 @@ public operator fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: KPrope
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Missing 'getValue(BigTest, KProperty<*>)' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'getValue(BigTest, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
|
||||
package testing
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Missing 'setValue(BigTest, KProperty<*>, Int)' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'setValue(BigTest, KProperty<*>, Int)' and thus it cannot serve as a delegate for var (read-write property)
|
||||
|
||||
package testing
|
||||
|
||||
@@ -28,7 +28,7 @@ operator fun <T> DelegateImpl<T>.setValue(thisRef: Any, property: KProperty<*>,
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: Missing 'setValue(BigTest, KProperty<*>, Int)' method on delegate of type 'DelegateImpl<Int>'
|
||||
// ERROR: Type 'DelegateImpl<Int>' has no method 'setValue(BigTest, KProperty<*>, Int)' and thus it cannot serve as a delegate for var (read-write property)
|
||||
|
||||
package testing
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// FILE: first.before.kt
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.ImportFix" "false"
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'String'
|
||||
// ERROR: Type 'String' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
// ACTION: To raw string literal
|
||||
|
||||
package b
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// ACTION: Create extension function 'Delegate.getValue'
|
||||
// ACTION: Create member function 'Delegate.getValue'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'Delegate'
|
||||
// ERROR: Type 'Delegate' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun test() {
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
// ACTION: Create extension function 'Delegate.getValue', function 'Delegate.setValue'
|
||||
// ACTION: Create member function 'Delegate.getValue', function 'Delegate.setValue'
|
||||
// ACTION: Introduce import alias
|
||||
// ERROR: Missing 'getValue(Nothing?, KProperty<*>)' method on delegate of type 'Delegate'
|
||||
// ERROR: Missing 'setValue(Nothing?, KProperty<*>, String)' method on delegate of type 'Delegate'
|
||||
// ERROR: Type 'Delegate' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
|
||||
// ERROR: Type 'Delegate' has no method 'setValue(Nothing?, KProperty<*>, String)' and thus it cannot serve as a delegate for var (read-write property)
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
fun test() {
|
||||
|
||||
Reference in New Issue
Block a user