[NI] Pass resulting constraint system for error candidate

This commit is contained in:
Mikhail Zarechenskiy
2017-08-24 02:25:18 +03:00
parent 6f397f8512
commit 51be629e13
4 changed files with 22 additions and 1 deletions
@@ -54,7 +54,8 @@ class KotlinCallCompleter(
candidateForCompletion.prepareForCompletion(expectedType)
runCompletion(candidateForCompletion.resolvedCall, ConstraintSystemCompletionMode.FULL, diagnosticHolder, candidateForCompletion.getSystem(), resolutionCallbacks)
return CallResolutionResult(CallResolutionResult.Type.ERROR, candidate?.resolvedCall, diagnosticHolder.getDiagnostics(), ConstraintStorage.Empty)
val systemStorage = candidate?.getSystem()?.asReadOnlyStorage() ?: ConstraintStorage.Empty
return CallResolutionResult(CallResolutionResult.Type.ERROR, candidate?.resolvedCall, diagnosticHolder.getDiagnostics(), systemStorage)
}
val completionType = candidate.prepareForCompletion(expectedType)
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test(a: Int, b: Boolean) {
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>(a.<!TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(<!TYPE_MISMATCH!>b<!>))
}
fun <T, R> T.foo(l: (T) -> R): R = TODO()
fun <S> bar(a: S) {}
@@ -0,0 +1,5 @@
package
public fun </*0*/ S> bar(/*0*/ a: S): kotlin.Unit
public fun test(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Boolean): kotlin.Unit
public fun </*0*/ T, /*1*/ R> T.foo(/*0*/ l: (T) -> R): R
@@ -16708,6 +16708,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("correctResultSubstitutorForErrorCandidate.kt")
public void testCorrectResultSubstitutorForErrorCandidate() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/correctResultSubstitutorForErrorCandidate.kt");
doTest(fileName);
}
@TestMetadata("delegationWithReceiver.kt")
public void testDelegationWithReceiver() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/delegationWithReceiver.kt");