Don't report missing getValue/setValue method error when it's was impossible to finish resolve
#KT-9803 Fixed
This commit is contained in:
@@ -189,13 +189,10 @@ public class DelegatedPropertyResolver {
|
|||||||
|
|
||||||
if (!functionResults.isSuccess()) {
|
if (!functionResults.isSuccess()) {
|
||||||
String expectedFunction = renderCall(call, trace.getBindingContext());
|
String expectedFunction = renderCall(call, trace.getBindingContext());
|
||||||
if (functionResults.isIncomplete()) {
|
if (functionResults.isSingleResult() || functionResults.isIncomplete() ||
|
||||||
trace.report(DELEGATE_SPECIAL_FUNCTION_MISSING.on(delegateExpression, expectedFunction, delegateType));
|
|
||||||
}
|
|
||||||
else if (functionResults.isSingleResult() ||
|
|
||||||
functionResults.getResultCode() == OverloadResolutionResults.Code.MANY_FAILED_CANDIDATES) {
|
functionResults.getResultCode() == OverloadResolutionResults.Code.MANY_FAILED_CANDIDATES) {
|
||||||
trace.report(DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
|
trace.report(DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
|
||||||
.on(delegateExpression, expectedFunction, functionResults.getResultingCalls()));
|
.on(delegateExpression, expectedFunction, functionResults.getResultingCalls()));
|
||||||
}
|
}
|
||||||
else if (functionResults.isAmbiguity()) {
|
else if (functionResults.isAmbiguity()) {
|
||||||
trace.report(DELEGATE_SPECIAL_FUNCTION_AMBIGUITY
|
trace.report(DELEGATE_SPECIAL_FUNCTION_AMBIGUITY
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
var a: Int by A()
|
var a: Int by A()
|
||||||
var a1 by <!DELEGATE_SPECIAL_FUNCTION_MISSING, DELEGATE_SPECIAL_FUNCTION_MISSING!>A()<!>
|
var a1 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!>A()<!>
|
||||||
|
|
||||||
var b: Int by B()
|
var b: Int by B()
|
||||||
|
|
||||||
|
|||||||
Vendored
+25
@@ -0,0 +1,25 @@
|
|||||||
|
// FILE: main.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
import first.*
|
||||||
|
import second.*
|
||||||
|
|
||||||
|
val a12 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!>A()<!>
|
||||||
|
|
||||||
|
// FILE: first.kt
|
||||||
|
package first
|
||||||
|
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class A
|
||||||
|
|
||||||
|
public operator fun <T> A.getValue(thisRef: Any?, property: KProperty<*>): T = null!!
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: second.kt
|
||||||
|
package second
|
||||||
|
|
||||||
|
import first.A
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
public operator fun <T> A.getValue(thisRef: Any?, property: KProperty<*>): T = null!!
|
||||||
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package first {
|
||||||
|
public operator fun </*0*/ T> first.A.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): T
|
||||||
|
|
||||||
|
public final class A {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package second {
|
||||||
|
public operator fun </*0*/ T> first.A.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): T
|
||||||
|
}
|
||||||
|
|
||||||
|
package test {
|
||||||
|
public val a12: [ERROR : Type from delegate]
|
||||||
|
}
|
||||||
@@ -4589,6 +4589,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("manyIncompleteCandidates.kt")
|
||||||
|
public void testManyIncompleteCandidates() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("noErrorsForImplicitConstraints.kt")
|
@TestMetadata("noErrorsForImplicitConstraints.kt")
|
||||||
public void testNoErrorsForImplicitConstraints() throws Exception {
|
public void testNoErrorsForImplicitConstraints() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user