[FIR] Add dynamic stages to callable reference resolution

This fixes an overload resolution ambiguity on callable references
in the presence of a dynamic extension receiver.

#KT-58143 Fixed
This commit is contained in:
Kirill Rakhman
2023-04-25 10:25:21 +02:00
committed by Space Team
parent c16f2f1067
commit d96c33e080
4 changed files with 39 additions and 0 deletions
@@ -92,6 +92,8 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
CheckCallableReferenceExpectedType,
CheckLowPriorityInOverloadResolution,
CheckIncompatibleTypeVariableUpperBounds,
ProcessDynamicExtensionAnnotation,
LowerPriorityIfDynamic,
)
object SyntheticIdForCallableReferencesResolution : CallKind(
@@ -0,0 +1,25 @@
// FIR_IDENTICAL
// DIAGNOSTICS: -UNUSED_PARAMETER
fun <T : Any> jso(): T =
js("({})")
fun <T : Any> jso(
block: T.() -> Unit,
): T = jso<T>().apply(block)
object FooBar {
fun buildNodes() = jso<dynamic> {
this["code_block"] = ParseRuleBuilder.create(getAttrs = ::readCodeBlockAttrs)
}
private fun readCodeBlockAttrs() {
}
}
object ParseRuleBuilder {
fun create(
getAttrs: Any? = null,
) {
}
}
@@ -229,6 +229,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/dynamicExtension.kt");
}
@Test
@TestMetadata("dynamicExtensionCallableReference.kt")
public void testDynamicExtensionCallableReference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/dynamicExtensionCallableReference.kt");
}
@Test
@TestMetadata("dynamicSafeCalls.kt")
public void testDynamicSafeCalls() throws Exception {
@@ -230,6 +230,12 @@ public class FirPsiJsOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiJ
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/dynamicExtension.kt");
}
@Test
@TestMetadata("dynamicExtensionCallableReference.kt")
public void testDynamicExtensionCallableReference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/dynamicExtensionCallableReference.kt");
}
@Test
@TestMetadata("dynamicSafeCalls.kt")
public void testDynamicSafeCalls() throws Exception {