[FIR] Fix crash on incorrect call on ILT

^KT-62306 Fixed
This commit is contained in:
Ivan Kochurkin
2023-11-07 17:43:21 +01:00
committed by Space Team
parent c5da2b7433
commit 54ab3d39db
7 changed files with 37 additions and 1 deletions
@@ -12300,6 +12300,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt"); runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
} }
@Test
@TestMetadata("incorrectCallOnILT.kt")
public void testIncorrectCallOnILT() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test @Test
@TestMetadata("kt24158.kt") @TestMetadata("kt24158.kt")
public void testKt24158() throws Exception { public void testKt24158() throws Exception {
@@ -12300,6 +12300,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt"); runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
} }
@Test
@TestMetadata("incorrectCallOnILT.kt")
public void testIncorrectCallOnILT() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test @Test
@TestMetadata("kt24158.kt") @TestMetadata("kt24158.kt")
public void testKt24158() throws Exception { public void testKt24158() throws Exception {
@@ -12294,6 +12294,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt"); runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
} }
@Test
@TestMetadata("incorrectCallOnILT.kt")
public void testIncorrectCallOnILT() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test @Test
@TestMetadata("kt24158.kt") @TestMetadata("kt24158.kt")
public void testKt24158() throws Exception { public void testKt24158() throws Exception {
@@ -12300,6 +12300,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt"); runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
} }
@Test
@TestMetadata("incorrectCallOnILT.kt")
public void testIncorrectCallOnILT() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test @Test
@TestMetadata("kt24158.kt") @TestMetadata("kt24158.kt")
public void testKt24158() throws Exception { public void testKt24158() throws Exception {
@@ -125,7 +125,7 @@ class CandidateFactory private constructor(
// There is no need to unwrap unary operators // There is no need to unwrap unary operators
if (fir.valueParameters.isEmpty()) return this if (fir.valueParameters.isEmpty()) return this
val original = fir.originalForWrappedIntegerOperator ?: return this val original = fir.originalForWrappedIntegerOperator ?: return this
return if (callInfo.arguments.first().isIntegerLiteralOrOperatorCall()) { return if (callInfo.arguments.firstOrNull()?.isIntegerLiteralOrOperatorCall() == true) {
this this
} else { } else {
original original
@@ -0,0 +1,6 @@
// FIR_IDENTICAL
// ISSUE: KT-62306
fun main() {
1.<!NONE_APPLICABLE!>plus<!>()
}
@@ -12300,6 +12300,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt"); runTest("compiler/testData/diagnostics/tests/exceptions/expectedSomeTypesOnBranchForWhenExpressionOfErroneousType.kt");
} }
@Test
@TestMetadata("incorrectCallOnILT.kt")
public void testIncorrectCallOnILT() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test @Test
@TestMetadata("kt24158.kt") @TestMetadata("kt24158.kt")
public void testKt24158() throws Exception { public void testKt24158() throws Exception {