[IR] Split const folding into necessary one and for optimizations only

In this commit we have a lot of change in test data. This was caused
by the way where we evaluate constants. We split constant evaluation
into two distinct parts: only necessary evaluations for `fir2ir`
(like const val and annotations) and optimizations for lowering.
Now we don't do all constant evaluation on `fir2ir`, but IR
dump is executed after this phase, so test data changed.

#KT-58923
This commit is contained in:
Ivan Kylchik
2023-05-28 18:43:30 +02:00
committed by Space Team
parent 8067df3c94
commit dd264cff50
96 changed files with 648 additions and 327 deletions
@@ -0,0 +1,42 @@
FILE fqName:interop fileName:/Definitions.kt
CLASS OBJECT name:Definitions modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:interop.Definitions
CONSTRUCTOR visibility:private <> () returnType:interop.Definitions [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Definitions modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:KT_CONSTANT visibility:public modality:FINAL [const,val]
FIELD PROPERTY_BACKING_FIELD name:KT_CONSTANT type:kotlin.String visibility:public [final]
EXPRESSION_BODY
CONST String type=kotlin.String value="constant"
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-KT_CONSTANT> visibility:public modality:FINAL <> ($this:interop.Definitions) returnType:kotlin.String
correspondingProperty: PROPERTY name:KT_CONSTANT visibility:public modality:FINAL [const,val]
$this: VALUE_PARAMETER name:<this> type:interop.Definitions
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-KT_CONSTANT> (): kotlin.String declared in interop.Definitions'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:KT_CONSTANT type:kotlin.String visibility:public [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: interop.Definitions declared in interop.Definitions.<get-KT_CONSTANT>' type=interop.Definitions origin=null
PROPERTY name:ktValue visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:ktValue type:kotlin.String visibility:private [final]
EXPRESSION_BODY
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:CONSTANT type:kotlin.String visibility:public [final,static]' type=kotlin.String origin=GET_PROPERTY
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-ktValue> visibility:public modality:FINAL <> ($this:interop.Definitions) returnType:kotlin.String
correspondingProperty: PROPERTY name:ktValue visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:interop.Definitions
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-ktValue> (): kotlin.String declared in interop.Definitions'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ktValue type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: interop.Definitions declared in interop.Definitions.<get-ktValue>' type=interop.Definitions origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any