diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt index 068e6947e8c..bf6e31839d6 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyClass.kt @@ -65,7 +65,7 @@ class Fir2IrLazyClass( set(_) = mutationNotSupported() override var modality: Modality - get() = fir.modality!! + get() = if (fir.classKind.isAnnotationClass) Modality.OPEN else fir.modality!! set(_) = mutationNotSupported() override var attributeOwnerId: IrAttributeContainer diff --git a/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt index c2fc404591d..1b408e1c25a 100644 --- a/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt +++ b/compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.fir.ir.txt @@ -96,7 +96,7 @@ FILE fqName: fileName:/1.kt $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass1 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass1> p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY : .JavaAnn - $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ @@ -146,7 +146,7 @@ FILE fqName: fileName:/1.kt $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass2 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass2> p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY : .JavaAnn - $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ @@ -196,7 +196,7 @@ FILE fqName: fileName:/1.kt $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass3 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass3> p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY : .JavaAnn - $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ @@ -232,7 +232,7 @@ FILE fqName: fileName:/1.kt $receiver: CLASS_REFERENCE 'CLASS CLASS name:MyClass4 modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.MyClass4> p0: CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm' type=java.lang.Class<.JavaAnn> origin=GET_PROPERTY : .JavaAnn - $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:FINAL visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> + $receiver: CLASS_REFERENCE 'CLASS IR_EXTERNAL_JAVA_DECLARATION_STUB ANNOTATION_CLASS name:JavaAnn modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Any; kotlin.Annotation]' type=kotlin.reflect.KClass<.JavaAnn> WHEN type=kotlin.Unit origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/classes/enumEntries.fir.ir.txt b/compiler/testData/ir/irText/classes/enumEntries.fir.ir.txt index bdabe806da6..ed6cf51d1cc 100644 --- a/compiler/testData/ir/irText/classes/enumEntries.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/enumEntries.fir.ir.txt @@ -71,7 +71,7 @@ FILE fqName: fileName:/enumEntries.kt $this: VALUE_PARAMETER name: type:kotlin.Enum FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.enums.EnumEntries<.MyEnum> annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalStdlibApi modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalStdlibApi modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun box (): kotlin.enums.EnumEntries<.MyEnum> declared in ' CALL 'public final fun (): kotlin.enums.EnumEntries<.MyEnum> declared in .MyEnum' type=kotlin.enums.EnumEntries<.MyEnum> origin=GET_PROPERTY diff --git a/compiler/testData/ir/irText/regressions/kt45236.fir.ir.txt b/compiler/testData/ir/irText/regressions/kt45236.fir.ir.txt index 7da47a8041f..c841d75587b 100644 --- a/compiler/testData/ir/irText/regressions/kt45236.fir.ir.txt +++ b/compiler/testData/ir/irText/regressions/kt45236.fir.ir.txt @@ -181,7 +181,7 @@ FILE fqName: fileName:/kt45236.kt $this: VALUE_PARAMETER name: type:kotlin.Any FUN name:isError visibility:public modality:FINAL ($receiver:.NetRequestStatus.isError>) returnType:kotlin.Boolean annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalContracts modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalContracts modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false $receiver: VALUE_PARAMETER name: type:.NetRequestStatus.isError> BLOCK_BODY diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.ir.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.ir.txt index 2cd67fb92f8..1aaf605f7be 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.ir.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.ir.txt @@ -1,7 +1,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt FUN name:scopedFlow visibility:public modality:FINAL (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.CoroutineScope, .FlowCollector.scopedFlow>, kotlin.Unit>) returnType:.Flow.scopedFlow> annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?] reified:false VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<.CoroutineScope, .FlowCollector.scopedFlow>, kotlin.Unit> BLOCK_BODY @@ -51,7 +51,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt BLOCK_BODY FUN name:unsafeFlow visibility:public modality:FINAL (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.FlowCollector.unsafeFlow>, kotlin.Unit>) returnType:.Flow.unsafeFlow> [inline] annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.FlowCollector.unsafeFlow>, kotlin.Unit> [crossinline] BLOCK_BODY @@ -189,7 +189,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt $this: VALUE_PARAMETER name: type:kotlin.Any FUN name:flow visibility:public modality:FINAL (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.FlowCollector.flow>, kotlin.Unit>) returnType:.Flow.flow> annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.FlowCollector.flow>, kotlin.Unit> BLOCK_BODY @@ -197,7 +197,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null FUN name:flowScope visibility:public modality:FINAL (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.CoroutineScope, R of .flowScope>) returnType:R of .flowScope [suspend] annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?] reified:false VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.CoroutineScope, R of .flowScope> BLOCK_BODY @@ -303,7 +303,7 @@ FILE fqName: fileName:/castsInsideCoroutineInference.kt $this: VALUE_PARAMETER name: type:kotlin.Any FUN name:produce visibility:public modality:FINAL ($receiver:.CoroutineScope, block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.ProducerScope.produce>, kotlin.Unit>) returnType:.ReceiveChannel.produce> annotations: - OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?] reified:false $receiver: VALUE_PARAMETER name: type:.CoroutineScope VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<.ProducerScope.produce>, kotlin.Unit>