[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:
@@ -824,10 +824,12 @@ FILE fqName:<root> fileName:/ArrayMap.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.ArrayMapImpl.Entry'
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
CONST String type=kotlin.String value="Entry(key="
|
||||
CONST String type=kotlin.String value="Entry("
|
||||
CONST String type=kotlin.String value="key="
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:key type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
|
||||
receiver: GET_VAR '<this>: <root>.ArrayMapImpl.Entry<T of <root>.ArrayMapImpl.Entry> declared in <root>.ArrayMapImpl.Entry.toString' type=<root>.ArrayMapImpl.Entry<T of <root>.ArrayMapImpl.Entry> origin=null
|
||||
CONST String type=kotlin.String value=", value="
|
||||
CONST String type=kotlin.String value=", "
|
||||
CONST String type=kotlin.String value="value="
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of <root>.ArrayMapImpl.Entry visibility:private [final]' type=T of <root>.ArrayMapImpl.Entry origin=null
|
||||
receiver: GET_VAR '<this>: <root>.ArrayMapImpl.Entry<T of <root>.ArrayMapImpl.Entry> declared in <root>.ArrayMapImpl.Entry.toString' type=<root>.ArrayMapImpl.Entry<T of <root>.ArrayMapImpl.Entry> origin=null
|
||||
CONST String type=kotlin.String value=")"
|
||||
|
||||
@@ -322,7 +322,7 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Entry(key=" + <this>.#key + ", value=" + <this>.#value + ")"
|
||||
return "Entry(" + "key=" + <this>.#key + ", " + "value=" + <this>.#value + ")"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ FILE fqName:<root> fileName:/MultiList.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.Some'
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
CONST String type=kotlin.String value="Some(value="
|
||||
CONST String type=kotlin.String value="Some("
|
||||
CONST String type=kotlin.String value="value="
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of <root>.Some visibility:private [final]' type=T of <root>.Some origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Some<T of <root>.Some> declared in <root>.Some.toString' type=<root>.Some<T of <root>.Some> origin=null
|
||||
CONST String type=kotlin.String value=")"
|
||||
|
||||
@@ -39,7 +39,7 @@ data class Some<T : Any?> {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Some(value=" + <this>.#value + ")"
|
||||
return "Some(" + "value=" + <this>.#value + ")"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -176,7 +176,8 @@ FILE fqName:<root> fileName:/SignatureClash.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.DataClass'
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
CONST String type=kotlin.String value="DataClass(delegate="
|
||||
CONST String type=kotlin.String value="DataClass("
|
||||
CONST String type=kotlin.String value="delegate="
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:delegate type:<root>.Delegate visibility:private [final]' type=<root>.Delegate origin=null
|
||||
receiver: GET_VAR '<this>: <root>.DataClass declared in <root>.DataClass.toString' type=<root>.DataClass origin=null
|
||||
CONST String type=kotlin.String value=")"
|
||||
|
||||
@@ -71,7 +71,7 @@ data class DataClass : Derived, Delegate {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "DataClass(delegate=" + <this>.#delegate + ")"
|
||||
return "DataClass(" + "delegate=" + <this>.#delegate + ")"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
FILE fqName:<root> fileName:/kt59102.kt
|
||||
CLASS CLASS name:XAlign modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.XAlign
|
||||
CONSTRUCTOR visibility:public <> (bits:kotlin.Long) returnType:<root>.XAlign [primary]
|
||||
VALUE_PARAMETER name:bits index:0 type:kotlin.Long
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:XAlign modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:bits visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:bits type:kotlin.Long visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'bits: kotlin.Long declared in <root>.XAlign.<init>' type=kotlin.Long origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-bits> visibility:public modality:FINAL <> ($this:<root>.XAlign) returnType:kotlin.Long
|
||||
correspondingProperty: PROPERTY name:bits visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.XAlign
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-bits> (): kotlin.Long declared in <root>.XAlign'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:bits type:kotlin.Long visibility:private [final]' type=kotlin.Long origin=null
|
||||
receiver: GET_VAR '<this>: <root>.XAlign declared in <root>.XAlign.<get-bits>' type=<root>.XAlign origin=null
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.XAlign
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (bits: kotlin.Long) declared in <root>.XAlign'
|
||||
bits: CONST Long type=kotlin.Long value=2
|
||||
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
|
||||
@@ -1,16 +0,0 @@
|
||||
class XAlign {
|
||||
constructor(bits: Long) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val bits: Long
|
||||
field = bits
|
||||
get
|
||||
|
||||
constructor() {
|
||||
this/*XAlign*/(bits = 2L)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class XAlign(val bits: Long) {
|
||||
constructor() : this(1 shl 1)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ FILE fqName:<root> fileName:/timesInBuilder.kt
|
||||
$receiver: CALL 'public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression declared in <root>' type=<root>.Expression origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||
t: CONST Int type=kotlin.Int value=120
|
||||
t: CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||
$this: CONST Int type=kotlin.Int value=2
|
||||
other: CONST Int type=kotlin.Int value=60
|
||||
CALL 'public final fun unaryPlus (): kotlin.Unit declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||
$receiver: CALL 'public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression declared in <root>' type=<root>.Expression origin=null
|
||||
@@ -21,13 +23,18 @@ FILE fqName:<root> fileName:/timesInBuilder.kt
|
||||
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||
t: CALL 'public final fun id <I> (arg: I of <root>.id): I of <root>.id declared in <root>' type=kotlin.Int origin=null
|
||||
<I>: kotlin.Int
|
||||
arg: CONST Int type=kotlin.Int value=120
|
||||
arg: CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||
$this: CONST Int type=kotlin.Int value=2
|
||||
other: CONST Int type=kotlin.Int value=60
|
||||
CALL 'public final fun unaryPlus (): kotlin.Unit declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||
$receiver: CALL 'public final fun select <T> (t: T of <root>.select, r: T of <root>.select): <root>.Expression declared in <root>' type=<root>.Expression origin=null
|
||||
<T>: kotlin.Long
|
||||
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||
t: CONST Long type=kotlin.Long value=120
|
||||
t: CALL 'public open fun toLong (): kotlin.Long declared in kotlin.Int' type=kotlin.Long origin=null
|
||||
$this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||
$this: CONST Int type=kotlin.Int value=2
|
||||
other: CONST Int type=kotlin.Int value=60
|
||||
r: GET_VAR 'x: kotlin.Long declared in <root>.test' type=kotlin.Long origin=null
|
||||
PROPERTY name:spentTime visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:spentTime type:<root>.Column visibility:private [final,static]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
private fun test(x: Long) {
|
||||
return countIssues(restrictionsBuilder = local fun ArgumentsBuilder.<anonymous>() {
|
||||
($this$countIssues, <get-spentTime>().lessEq<Int>(t = 120)).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().lessEq<Int>(t = id<Int>(arg = 120))).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().select<Long>(t = 120L, r = x)).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().lessEq<Int>(t = 2.times(other = 60))).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().lessEq<Int>(t = id<Int>(arg = 2.times(other = 60)))).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().select<Long>(t = 2.times(other = 60).toLong(), r = x)).unaryPlus()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ FILE fqName:<root> fileName:/valueClassEquals.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.Z'
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
CONST String type=kotlin.String value="Z(s="
|
||||
CONST String type=kotlin.String value="Z("
|
||||
CONST String type=kotlin.String value="s="
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z.toString' type=<root>.Z origin=null
|
||||
CONST String type=kotlin.String value=")"
|
||||
|
||||
@@ -26,7 +26,7 @@ value class Z {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Z(s=" + <this>.#s + ")"
|
||||
return "Z(" + "s=" + <this>.#s + ")"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user