K2: Fix invokeExtension resolution when property type is implicit
^KT-57947 Fixed
This commit is contained in:
committed by
Space Team
parent
f0aa6c6d32
commit
fa8eca7a7b
+6
@@ -26785,6 +26785,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
|
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
|
@Test
|
||||||
@TestMetadata("invokeAndSmartCast.kt")
|
@TestMetadata("invokeAndSmartCast.kt")
|
||||||
public void testInvokeAndSmartCast() throws Exception {
|
public void testInvokeAndSmartCast() throws Exception {
|
||||||
|
|||||||
+6
@@ -26785,6 +26785,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
|
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
|
@Test
|
||||||
@TestMetadata("invokeAndSmartCast.kt")
|
@TestMetadata("invokeAndSmartCast.kt")
|
||||||
public void testInvokeAndSmartCast() throws Exception {
|
public void testInvokeAndSmartCast() throws Exception {
|
||||||
|
|||||||
+6
@@ -26785,6 +26785,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
|
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
|
@Test
|
||||||
@TestMetadata("invokeAndSmartCast.kt")
|
@TestMetadata("invokeAndSmartCast.kt")
|
||||||
public void testInvokeAndSmartCast() throws Exception {
|
public void testInvokeAndSmartCast() throws Exception {
|
||||||
|
|||||||
+6
@@ -26797,6 +26797,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
|
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
|
@Test
|
||||||
@TestMetadata("invokeAndSmartCast.kt")
|
@TestMetadata("invokeAndSmartCast.kt")
|
||||||
public void testInvokeAndSmartCast() throws Exception {
|
public void testInvokeAndSmartCast() throws Exception {
|
||||||
|
|||||||
+2
-1
@@ -160,7 +160,8 @@ internal class FirInvokeResolveTowerExtension(
|
|||||||
if (symbol !is FirCallableSymbol<*> && symbol !is FirClassLikeSymbol<*>) continue
|
if (symbol !is FirCallableSymbol<*> && symbol !is FirClassLikeSymbol<*>) continue
|
||||||
|
|
||||||
val isExtensionFunctionType =
|
val isExtensionFunctionType =
|
||||||
(symbol as? FirCallableSymbol<*>)?.fir?.returnTypeRef?.isExtensionFunctionType(components.session) == true
|
symbol is FirCallableSymbol<*> &&
|
||||||
|
components.returnTypeCalculator.tryCalculateReturnType(symbol).isExtensionFunctionType(components.session)
|
||||||
|
|
||||||
if (invokeBuiltinExtensionMode && !isExtensionFunctionType) {
|
if (invokeBuiltinExtensionMode && !isExtensionFunctionType) {
|
||||||
continue
|
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()
|
||||||
Generated
+6
@@ -27563,6 +27563,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.kt");
|
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
|
@Test
|
||||||
@TestMetadata("invokeAndSmartCast.kt")
|
@TestMetadata("invokeAndSmartCast.kt")
|
||||||
public void testInvokeAndSmartCast() throws Exception {
|
public void testInvokeAndSmartCast() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user