[FIR2IR] Support error qualifier in case of error suppression

#KT-60536 Fixed
This commit is contained in:
Kirill Rakhman
2023-08-18 12:17:47 +02:00
committed by Space Team
parent 51a43a02f7
commit 79fe48ab5b
19 changed files with 127 additions and 0 deletions
@@ -70,6 +70,11 @@ class Fir2IrImplicitCastInserter(
override fun visitResolvedQualifier(resolvedQualifier: FirResolvedQualifier, data: IrElement): IrElement = data
override fun visitErrorResolvedQualifier(errorResolvedQualifier: FirErrorResolvedQualifier, data: IrElement): IrElement {
// Support for error suppression case
return visitResolvedQualifier(errorResolvedQualifier, data)
}
override fun visitGetClassCall(getClassCall: FirGetClassCall, data: IrElement): IrElement = data
override fun visitFunctionCall(functionCall: FirFunctionCall, data: IrElement): IrElement = data
@@ -1537,6 +1537,11 @@ class Fir2IrVisitor(
return callGenerator.convertToGetObject(resolvedQualifier)
}
override fun visitErrorResolvedQualifier(errorResolvedQualifier: FirErrorResolvedQualifier, data: Any?): IrElement {
// Support for error suppression case
return visitResolvedQualifier(errorResolvedQualifier, data)
}
private fun LogicOperationKind.toIrDynamicOperator() = when (this) {
LogicOperationKind.AND -> IrDynamicOperator.ANDAND
LogicOperationKind.OR -> IrDynamicOperator.OROR
@@ -18865,6 +18865,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/fir/staticImportViaInheritance.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
@@ -18865,6 +18865,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/fir/staticImportViaInheritance.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
@@ -0,0 +1,22 @@
// MODULE: lib
// FILE: lib.kt
package lib
interface Key {
val s get() = "OK"
}
internal class Internal {
companion object : Key
}
// MODULE: box(lib)
// FILE: box.kt
package app
import lib.*
fun foo(key: Key) = key.s
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
fun box() = foo(Internal)
@@ -17917,6 +17917,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
@@ -18865,6 +18865,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/fir/staticImportViaInheritance.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
@@ -18865,6 +18865,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/fir/staticImportViaInheritance.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
@@ -15695,6 +15695,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/fir/staticImportViaInheritance.kt");
}
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
runTest("compiler/testData/codegen/box/fir/SuspendExtension.kt");
@@ -13867,6 +13867,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -13867,6 +13867,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -13867,6 +13867,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -13867,6 +13867,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -14988,6 +14988,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -15346,6 +15346,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -14810,6 +14810,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -14989,6 +14989,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -13843,6 +13843,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {
@@ -13843,6 +13843,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/fir/SamWithReceiverMavenProjectImportHandler.kt");
}
@Test
@TestMetadata("suppressedInvisibleReferenceQualifier.kt")
public void testSuppressedInvisibleReferenceQualifier() throws Exception {
runTest("compiler/testData/codegen/box/fir/suppressedInvisibleReferenceQualifier.kt");
}
@Test
@TestMetadata("toLong.kt")
public void testToLong() throws Exception {