K2: Fix invokeExtension resolution when property type is implicit

^KT-57947 Fixed
This commit is contained in:
Denis.Zharkov
2023-04-12 13:28:53 +02:00
committed by Space Team
parent f0aa6c6d32
commit fa8eca7a7b
7 changed files with 42 additions and 1 deletions
@@ -26785,6 +26785,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
}
@Test
@TestMetadata("implicitPropertyType.kt")
public void testImplicitPropertyType() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitPropertyType.kt");
}
@Test
@TestMetadata("invokeAndSmartCast.kt")
public void testInvokeAndSmartCast() throws Exception {
@@ -26785,6 +26785,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
}
@Test
@TestMetadata("implicitPropertyType.kt")
public void testImplicitPropertyType() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitPropertyType.kt");
}
@Test
@TestMetadata("invokeAndSmartCast.kt")
public void testInvokeAndSmartCast() throws Exception {
@@ -26785,6 +26785,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
}
@Test
@TestMetadata("implicitPropertyType.kt")
public void testImplicitPropertyType() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitPropertyType.kt");
}
@Test
@TestMetadata("invokeAndSmartCast.kt")
public void testInvokeAndSmartCast() throws Exception {
@@ -26797,6 +26797,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
}
@Test
@TestMetadata("implicitPropertyType.kt")
public void testImplicitPropertyType() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitPropertyType.kt");
}
@Test
@TestMetadata("invokeAndSmartCast.kt")
public void testInvokeAndSmartCast() throws Exception {
@@ -160,7 +160,8 @@ internal class FirInvokeResolveTowerExtension(
if (symbol !is FirCallableSymbol<*> && symbol !is FirClassLikeSymbol<*>) continue
val isExtensionFunctionType =
(symbol as? FirCallableSymbol<*>)?.fir?.returnTypeRef?.isExtensionFunctionType(components.session) == true
symbol is FirCallableSymbol<*> &&
components.returnTypeCalculator.tryCalculateReturnType(symbol).isExtensionFunctionType(components.session)
if (invokeBuiltinExtensionMode && !isExtensionFunctionType) {
continue
@@ -0,0 +1,10 @@
// FIR_IDENTICAL
// ISSUE: KT-57947
class A
fun A.bar() = baz("")
val baz = foo()
fun foo(): A.(String) -> Unit = TODO()
@@ -27563,6 +27563,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
}
@Test
@TestMetadata("implicitPropertyType.kt")
public void testImplicitPropertyType() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitPropertyType.kt");
}
@Test
@TestMetadata("invokeAndSmartCast.kt")
public void testInvokeAndSmartCast() throws Exception {