[NI] Restore missing call checker errors in coroutine inference
Reported diagnostics from the call checkers didn't get to a top-level trace, if an intermediate wrapping call was a lambda call. Use of the top-level trace in call completer is a workaround for the unreliable commit order of common calls' temporary traces. ^KT-33542 Fixed
This commit is contained in:
+4
-1
@@ -242,7 +242,10 @@ class CoroutineInferenceSession(
|
||||
val resultingSubstitutor =
|
||||
NewTypeSubstitutorByConstructorMap((resultingCallSubstitutor + nonFixedTypesToResult).cast()) // TODO: SUB
|
||||
|
||||
val atomCompleter = createResolvedAtomCompleter(resultingSubstitutor, completedCall.context)
|
||||
val atomCompleter = createResolvedAtomCompleter(
|
||||
resultingSubstitutor,
|
||||
completedCall.context.replaceBindingTrace(topLevelCallContext.trace)
|
||||
)
|
||||
|
||||
completeCall(completedCall, atomCompleter)
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface In<in E> {
|
||||
fun send(element: E)
|
||||
}
|
||||
|
||||
class InImpl<E> : In<E> {
|
||||
override fun send(element: E) {}
|
||||
}
|
||||
|
||||
@<!DEPRECATION, EXPERIMENTAL_IS_NOT_ENABLED!>UseExperimental<!>(ExperimentalTypeInference::class)
|
||||
public fun <T> builder(@BuilderInference block: In<T>.() -> Unit) {
|
||||
InImpl<T>().block()
|
||||
}
|
||||
|
||||
suspend fun yield() {}
|
||||
|
||||
fun test() {
|
||||
builder {
|
||||
send(run {
|
||||
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>yield<!>() // No error but `yield` is not inside "suspension" context actually
|
||||
})
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> builder(/*0*/ @kotlin.BuilderInference block: In<T>.() -> kotlin.Unit): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
public suspend fun yield(): kotlin.Unit
|
||||
|
||||
public interface In</*0*/ in E> {
|
||||
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 abstract fun send(/*0*/ element: E): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class InImpl</*0*/ E> : In<E> {
|
||||
public constructor InImpl</*0*/ E>()
|
||||
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*/ fun send(/*0*/ element: E): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+5
@@ -1962,6 +1962,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt33542.kt")
|
||||
public void testKt33542() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt33542.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35684.kt")
|
||||
public void testKt35684() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.kt");
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -1962,6 +1962,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt33542.kt")
|
||||
public void testKt33542() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt33542.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35684.kt")
|
||||
public void testKt35684() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.kt");
|
||||
|
||||
Reference in New Issue
Block a user