FIR: fix serialization of accessor with source-level annotations
This commit is contained in:
+6
@@ -13724,6 +13724,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("NameHighlighter.kt")
|
||||||
|
public void testNameHighlighter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/NameHighlighter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("SuspendExtension.kt")
|
@TestMetadata("SuspendExtension.kt")
|
||||||
public void testSuspendExtension() throws Exception {
|
public void testSuspendExtension() throws Exception {
|
||||||
|
|||||||
+3
-2
@@ -714,11 +714,12 @@ class FirElementSerializer private constructor(
|
|||||||
private fun getAccessorFlags(accessor: FirPropertyAccessor, property: FirProperty): Int {
|
private fun getAccessorFlags(accessor: FirPropertyAccessor, property: FirProperty): Int {
|
||||||
// [FirDefaultPropertyAccessor]---a property accessor without body---can still hold other information, such as annotations,
|
// [FirDefaultPropertyAccessor]---a property accessor without body---can still hold other information, such as annotations,
|
||||||
// user-contributed visibility, and modifiers, such as `external` or `inline`.
|
// user-contributed visibility, and modifiers, such as `external` or `inline`.
|
||||||
|
val nonSourceAnnotations = accessor.nonSourceAnnotations(session)
|
||||||
val isDefault = accessor is FirDefaultPropertyAccessor &&
|
val isDefault = accessor is FirDefaultPropertyAccessor &&
|
||||||
accessor.annotations.isEmpty() && accessor.visibility == property.visibility &&
|
nonSourceAnnotations.isEmpty() && accessor.visibility == property.visibility &&
|
||||||
!accessor.isExternal && !accessor.isInline
|
!accessor.isExternal && !accessor.isInline
|
||||||
return Flags.getAccessorFlags(
|
return Flags.getAccessorFlags(
|
||||||
accessor.nonSourceAnnotations(session).isNotEmpty(),
|
nonSourceAnnotations.isNotEmpty(),
|
||||||
ProtoEnumFlags.visibility(normalizeVisibility(accessor)),
|
ProtoEnumFlags.visibility(normalizeVisibility(accessor)),
|
||||||
ProtoEnumFlags.modality(accessor.modality!!),
|
ProtoEnumFlags.modality(accessor.modality!!),
|
||||||
!isDefault,
|
!isDefault,
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: NameHighlighter.kt
|
||||||
|
|
||||||
|
object NameHighlighter {
|
||||||
|
var namesHighlightingEnabled = true
|
||||||
|
@TestOnly set
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: TestOnly.java
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
|
||||||
|
public @interface TestOnly {
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (!NameHighlighter.namesHighlightingEnabled) return "FAIL 1"
|
||||||
|
NameHighlighter.namesHighlightingEnabled = false
|
||||||
|
if (NameHighlighter.namesHighlightingEnabled) return "FAIL 2"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -13724,6 +13724,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("NameHighlighter.kt")
|
||||||
|
public void testNameHighlighter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/NameHighlighter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("SuspendExtension.kt")
|
@TestMetadata("SuspendExtension.kt")
|
||||||
public void testSuspendExtension() throws Exception {
|
public void testSuspendExtension() throws Exception {
|
||||||
|
|||||||
+6
@@ -13724,6 +13724,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("NameHighlighter.kt")
|
||||||
|
public void testNameHighlighter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/NameHighlighter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("SuspendExtension.kt")
|
@TestMetadata("SuspendExtension.kt")
|
||||||
public void testSuspendExtension() throws Exception {
|
public void testSuspendExtension() throws Exception {
|
||||||
|
|||||||
+5
@@ -12061,6 +12061,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testIrBuiltIns() throws Exception {
|
public void testIrBuiltIns() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("NameHighlighter.kt")
|
||||||
|
public void testNameHighlighter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/NameHighlighter.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/fullJdk")
|
@TestMetadata("compiler/testData/codegen/box/fullJdk")
|
||||||
|
|||||||
Reference in New Issue
Block a user