Fir2Ir: more precise calculation of enum class modality
Use the same condition as in the already existing `createIrEnumEntry` function (and as in psi2ir): enum class should be final unless there's an enum entry with any declaration other than its constructor. #KT-57216
This commit is contained in:
committed by
Space Team
parent
2cc3b542fd
commit
68b94b07b8
+2
-2
@@ -38,7 +38,7 @@ FILE fqName:<root> fileName:/lambdaInEnumEntryConstructorCall.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS ENUM_CLASS name:ConfigurationParameter modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.ConfigurationParameter>]
|
||||
CLASS ENUM_CLASS name:ConfigurationParameter modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.ConfigurationParameter>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.ConfigurationParameter
|
||||
ENUM_ENTRY name:BASE_URL
|
||||
init: EXPRESSION_BODY
|
||||
@@ -65,7 +65,7 @@ FILE fqName:<root> fileName:/lambdaInEnumEntryConstructorCall.kt
|
||||
BLOCK_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'public constructor <init> (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum'
|
||||
<E>: <root>.ConfigurationParameter
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:ConfigurationParameter modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.ConfigurationParameter>]'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:ConfigurationParameter modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.ConfigurationParameter>]'
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<<root>.ConfigurationParameter>
|
||||
SYNTHETIC_BODY kind=ENUM_VALUES
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:<root>.ConfigurationParameter
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class Wrapper {
|
||||
|
||||
}
|
||||
|
||||
open enum class ConfigurationParameter : Enum<ConfigurationParameter> {
|
||||
enum class ConfigurationParameter : Enum<ConfigurationParameter> {
|
||||
BASE_URL = ConfigurationParameter(apply = local fun <anonymous>(value: String, nc: Wrapper) {
|
||||
println(message = "Base url updated from config parameters ".plus(other = nc.<get-baseUrl>()).plus(other = " -> ").plus(other = value))
|
||||
nc.<set-baseUrl>(<set-?> = value)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE fqName:<root> fileName:/thisInEnumConstructor.kt
|
||||
CLASS ENUM_CLASS name:EE modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.EE>]
|
||||
CLASS ENUM_CLASS name:EE modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.EE>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.EE
|
||||
CONSTRUCTOR visibility:private <> (myName:kotlin.String) returnType:<root>.EE [primary]
|
||||
VALUE_PARAMETER name:myName index:0 type:kotlin.String
|
||||
@@ -10,7 +10,7 @@ FILE fqName:<root> fileName:/thisInEnumConstructor.kt
|
||||
BLOCK_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'public constructor <init> (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum'
|
||||
<E>: <root>.EE
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:EE modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.EE>]'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:EE modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.EE>]'
|
||||
PROPERTY name:myName visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:myName type:kotlin.String visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
open enum class EE : Enum<EE> {
|
||||
enum class EE : Enum<EE> {
|
||||
private constructor(myName: String = Companion.toString().lowercase()) /* primary */ {
|
||||
super/*Enum*/<EE>()
|
||||
/* <init>() */
|
||||
|
||||
Reference in New Issue
Block a user