[FIR] Fix NPE on empty throws

^KT-60325 fixed
This commit is contained in:
Egor Kulikov
2023-09-21 18:37:35 +02:00
committed by Space Team
parent 3894e719b3
commit c3010dd599
7 changed files with 35 additions and 1 deletions
@@ -321,6 +321,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
}
@Test
@TestMetadata("EmptyThrow.kt")
public void testEmptyThrow() throws Exception {
runTest("compiler/testData/diagnostics/tests/EmptyThrow.kt");
}
@Test
@TestMetadata("EnumEntryAsType.kt")
public void testEnumEntryAsType() throws Exception {
@@ -321,6 +321,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
}
@Test
@TestMetadata("EmptyThrow.kt")
public void testEmptyThrow() throws Exception {
runTest("compiler/testData/diagnostics/tests/EmptyThrow.kt");
}
@Test
@TestMetadata("EnumEntryAsType.kt")
public void testEnumEntryAsType() throws Exception {
@@ -321,6 +321,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
}
@Test
@TestMetadata("EmptyThrow.kt")
public void testEmptyThrow() throws Exception {
runTest("compiler/testData/diagnostics/tests/EmptyThrow.kt");
}
@Test
@TestMetadata("EnumEntryAsType.kt")
public void testEnumEntryAsType() throws Exception {
@@ -321,6 +321,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
}
@Test
@TestMetadata("EmptyThrow.kt")
public void testEmptyThrow() throws Exception {
runTest("compiler/testData/diagnostics/tests/EmptyThrow.kt");
}
@Test
@TestMetadata("EnumEntryAsType.kt")
public void testEnumEntryAsType() throws Exception {
@@ -19,7 +19,7 @@ object FirThrowExpressionTypeChecker : FirThrowExpressionChecker() {
if (!actualType.isSubtypeOf(expectedType, context.session)) {
reporter.reportOn(
expression.exception.source,
expression.exception.source ?: expression.source,
FirErrors.TYPE_MISMATCH,
expectedType,
actualType,
+4
View File
@@ -0,0 +1,4 @@
// FIR_IDENTICAL
fun someFun(i:Int) {
val x = i ?: throw<!SYNTAX!><!>
}
@@ -321,6 +321,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/emptyLhsClassLiterals.kt");
}
@Test
@TestMetadata("EmptyThrow.kt")
public void testEmptyThrow() throws Exception {
runTest("compiler/testData/diagnostics/tests/EmptyThrow.kt");
}
@Test
@TestMetadata("EnumEntryAsType.kt")
public void testEnumEntryAsType() throws Exception {