choose the most specific candidate after type inference
This commit is contained in:
@@ -325,15 +325,6 @@ public class CallResolver {
|
|||||||
}
|
}
|
||||||
completeTypeInferenceDependentOnExpectedTypeForCall(resolvedCall, context, tracing, successful, failed);
|
completeTypeInferenceDependentOnExpectedTypeForCall(resolvedCall, context, tracing, successful, failed);
|
||||||
}
|
}
|
||||||
if (resultsWithIncompleteTypeInference.getResultingCalls().size() > 1) {
|
|
||||||
for (ResolvedCallWithTrace<D> call : successful) {
|
|
||||||
if (call instanceof ResolvedCallImpl) {
|
|
||||||
((ResolvedCallImpl)call).addStatus(ResolutionStatus.TYPE_INFERENCE_ERROR);
|
|
||||||
failed.add(call);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
successful.clear();
|
|
||||||
}
|
|
||||||
OverloadResolutionResultsImpl<D> results = computeResultAndReportErrors(context.trace, tracing, successful, failed);
|
OverloadResolutionResultsImpl<D> results = computeResultAndReportErrors(context.trace, tracing, successful, failed);
|
||||||
if (!results.isSingleResult()) {
|
if (!results.isSingleResult()) {
|
||||||
checkTypesWithNoCallee(context);
|
checkTypesWithNoCallee(context);
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package i
|
||||||
|
|
||||||
|
//+JDK
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun <T, R> Collection<T>.map1(<!UNUSED_PARAMETER!>f<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||||
|
fun <T, R> java.lang.Iterable<T>.map1(<!UNUSED_PARAMETER!>f<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||||
|
|
||||||
|
fun test(list: List<Int>) {
|
||||||
|
val res = list.map1 { it }
|
||||||
|
//check res is not of error type
|
||||||
|
<!TYPE_MISMATCH!>res<!> : String
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> Collection<T>.foo() {}
|
||||||
|
fun <T> java.lang.Iterable<T>.foo() {}
|
||||||
|
|
||||||
|
fun test1(list: List<Int>) {
|
||||||
|
val res = list.foo()
|
||||||
|
//check res is not of error type
|
||||||
|
<!TYPE_MISMATCH!>res<!> : String
|
||||||
|
}
|
||||||
@@ -1309,6 +1309,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
|||||||
doTest("compiler/testData/diagnostics/tests/inference/mapFunction.kt");
|
doTest("compiler/testData/diagnostics/tests/inference/mapFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("mostSpecificAfterInference.kt")
|
||||||
|
public void testMostSpecificAfterInference() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/inference/mostSpecificAfterInference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("NoInferenceFromDeclaredBounds.kt")
|
@TestMetadata("NoInferenceFromDeclaredBounds.kt")
|
||||||
public void testNoInferenceFromDeclaredBounds() throws Exception {
|
public void testNoInferenceFromDeclaredBounds() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt");
|
doTest("compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user