[NI] Complete contradictory candidates inside builder-inference
In this test `kotlin` was resolved to the extension `val Class<T>.kotlin` because it was saved in builder-inference. Usually, it's fine, but not for qualified expressions as they have fallback resolve in case of error
This commit is contained in:
+3
@@ -55,6 +55,9 @@ class CoroutineInferenceSession(
|
|||||||
|
|
||||||
override fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean {
|
override fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean {
|
||||||
val system = candidate.getSystem() as NewConstraintSystemImpl
|
val system = candidate.getSystem() as NewConstraintSystemImpl
|
||||||
|
|
||||||
|
if (system.hasContradiction) return true
|
||||||
|
|
||||||
val storage = system.getBuilder().currentStorage()
|
val storage = system.getBuilder().currentStorage()
|
||||||
fun ResolvedAtom.hasPostponed(): Boolean {
|
fun ResolvedAtom.hasPostponed(): Boolean {
|
||||||
if (this is PostponedResolvedAtom && !analyzed) return true
|
if (this is PostponedResolvedAtom && !analyzed) return true
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
flow {
|
||||||
|
emit(42)
|
||||||
|
kotlin.coroutines.coroutineContext
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalTypeInference::class)
|
||||||
|
fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit): Flow<T> = TODO()
|
||||||
|
|
||||||
|
interface Flow<out T>
|
||||||
|
|
||||||
|
interface FlowCollector<in T> {
|
||||||
|
suspend fun emit(value: T)
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> flow(/*0*/ @kotlin.BuilderInference block: suspend FlowCollector<T>.() -> kotlin.Unit): Flow<T>
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
public interface Flow</*0*/ out T> {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface FlowCollector</*0*/ in T> {
|
||||||
|
public abstract suspend fun emit(/*0*/ value: T): kotlin.Unit
|
||||||
|
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
|
||||||
|
}
|
||||||
+5
@@ -1992,6 +1992,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedSuspendCallInsideLambda.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedSuspendCallInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("qualifiedResolvedExpressionInsideBuilderInference.kt")
|
||||||
|
public void testQualifiedResolvedExpressionInsideBuilderInference() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/qualifiedResolvedExpressionInsideBuilderInference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("recursiveGenerators.kt")
|
@TestMetadata("recursiveGenerators.kt")
|
||||||
public void testRecursiveGenerators() throws Exception {
|
public void testRecursiveGenerators() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt");
|
||||||
|
|||||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -1992,6 +1992,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedSuspendCallInsideLambda.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedSuspendCallInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("qualifiedResolvedExpressionInsideBuilderInference.kt")
|
||||||
|
public void testQualifiedResolvedExpressionInsideBuilderInference() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/qualifiedResolvedExpressionInsideBuilderInference.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("recursiveGenerators.kt")
|
@TestMetadata("recursiveGenerators.kt")
|
||||||
public void testRecursiveGenerators() throws Exception {
|
public void testRecursiveGenerators() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators.kt");
|
||||||
|
|||||||
+1
-1
@@ -666,7 +666,7 @@ public class IrWriteSignatureTestGenerated extends AbstractIrWriteSignatureTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInSuspendMain() throws Exception {
|
public void testAllFilesPresentInSuspendMain() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/writeSignature/suspendMain"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeSignature/suspendMain"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("parameterlessSuspendMain.kt")
|
@TestMetadata("parameterlessSuspendMain.kt")
|
||||||
|
|||||||
+1
-1
@@ -665,7 +665,7 @@ public class WriteSignatureTestGenerated extends AbstractWriteSignatureTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInSuspendMain() throws Exception {
|
public void testAllFilesPresentInSuspendMain() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/writeSignature/suspendMain"), Pattern.compile("^(.+)\\.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeSignature/suspendMain"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("parameterlessSuspendMain.kt")
|
@TestMetadata("parameterlessSuspendMain.kt")
|
||||||
|
|||||||
Reference in New Issue
Block a user