[FIR] add missing resolve for ConeFunctionExpectedError building

^KT-60638 Fixed
This commit is contained in:
Dmitrii Gridin
2023-07-24 22:44:55 +02:00
committed by Space Team
parent ba7e6ff154
commit d93ffe0aec
12 changed files with 102 additions and 1 deletions
@@ -0,0 +1,9 @@
package usage
class MyType
class MyClass
val MyClass.isInterface get() = 4
fun usage(type: MyType) {
type.<expr>isInterface</expr>()
}
@@ -0,0 +1,30 @@
KT element: KtNameReferenceExpression
FIR element: FirErrorNamedReferenceImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
<Expression 'isInterface' of type 'kotlin/Int' cannot be invoked as a function>#
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] kt60638.kt
package usage
public final [ResolvedTo(STATUS)] class MyType : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=MyType] constructor(): R|usage/MyType| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(STATUS)] class MyClass : R|kotlin/Any| {
public [ResolvedTo(STATUS)] [ContainingClassKey=MyClass] constructor(): R|usage/MyClass| {
LAZY_super<R|kotlin/Any|>
}
}
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val R|usage/MyClass|.isInterface: R|kotlin/Int|
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int| {
^ Int(4)
}
public final [ResolvedTo(BODY_RESOLVE)] fun usage([ResolvedTo(BODY_RESOLVE)] type: R|usage/MyType|): R|kotlin/Unit| {
R|<local>/type|.<Expression 'isInterface' of type 'kotlin/Int' cannot be invoked as a function>#()
}
@@ -24,6 +24,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/kt60638.kt");
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -24,6 +24,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/kt60638.kt");
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations")
@TestDataPath("$PROJECT_ROOT")
@@ -651,6 +651,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/kt58583.kt");
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("compiler/testData/diagnostics/tests/kt60638.kt");
}
@Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
@@ -651,6 +651,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/kt58583.kt");
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("compiler/testData/diagnostics/tests/kt60638.kt");
}
@Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
@@ -651,6 +651,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/kt58583.kt");
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("compiler/testData/diagnostics/tests/kt60638.kt");
}
@Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
@@ -651,6 +651,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/kt58583.kt");
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("compiler/testData/diagnostics/tests/kt60638.kt");
}
@Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {
@@ -717,7 +717,9 @@ class FirCallResolver(
coneType != null && !coneType.isUnit -> {
ConeFunctionExpectedError(
name.asString(),
(fir as? FirCallableDeclaration)?.returnTypeRef?.coneType ?: coneType
(fir as? FirCallableDeclaration)?.let {
components.returnTypeCalculator.tryCalculateReturnType(it)
}?.coneType ?: coneType
)
}
singleExpectedCandidate != null && !singleExpectedCandidate.currentApplicability.isSuccess -> {
+9
View File
@@ -0,0 +1,9 @@
package usage
class MyType
class MyClass
val MyClass.isInterface get() = 4
fun usage(type: MyType) {
type.<!FUNCTION_EXPECTED!>isInterface<!>()
}
+9
View File
@@ -0,0 +1,9 @@
package usage
class MyType
class MyClass
val MyClass.isInterface get() = 4
fun usage(type: MyType) {
type.<!FUNCTION_EXPECTED, UNRESOLVED_REFERENCE_WRONG_RECEIVER!>isInterface<!>()
}
@@ -651,6 +651,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/kt58583.kt");
}
@Test
@TestMetadata("kt60638.kt")
public void testKt60638() throws Exception {
runTest("compiler/testData/diagnostics/tests/kt60638.kt");
}
@Test
@TestMetadata("LValueAssignment.kt")
public void testLValueAssignment() throws Exception {