IR: preserve argument evaluation order more carefully
1. receivers should be evaluated before named arguments;
2. just because an argument has no side effects doesn't mean it is not
affected by the other arguments' side effects - in that case it
should still be evaluated in source order.
#KT-47660 Fixed
This commit is contained in:
Vendored
-44
@@ -1,44 +0,0 @@
|
||||
open class Base {
|
||||
constructor(x: Int, y: Int) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: Int
|
||||
field = x
|
||||
get
|
||||
|
||||
val y: Int
|
||||
field = y
|
||||
get
|
||||
|
||||
}
|
||||
|
||||
class Test1 : Base {
|
||||
constructor(xx: Int, yy: Int) /* primary */ {
|
||||
{ // BLOCK
|
||||
super/*Base*/(x = xx, y = yy)
|
||||
}
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Test2 : Base {
|
||||
constructor(xx: Int, yy: Int) {
|
||||
{ // BLOCK
|
||||
super/*Base*/(x = xx, y = yy)
|
||||
}
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
constructor(xxx: Int, yyy: Int, a: Any) {
|
||||
{ // BLOCK
|
||||
this/*Test2*/(xx = xxx, yy = yyy)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
FILE fqName:<root> fileName:/argumentReorderingInDelegatingConstructorCall.kt
|
||||
CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base
|
||||
CONSTRUCTOR visibility:public <> (x:kotlin.Int, y:kotlin.Int) returnType:<root>.Base [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:y index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: kotlin.Int declared in <root>.Base.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-x> (): kotlin.Int declared in <root>.Base'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Base declared in <root>.Base.<get-x>' type=<root>.Base origin=null
|
||||
PROPERTY name:y visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'y: kotlin.Int declared in <root>.Base.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-y> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-y> (): kotlin.Int declared in <root>.Base'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Base declared in <root>.Base.<get-y>' type=<root>.Base 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 [operator] 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
|
||||
CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.Base]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test1
|
||||
CONSTRUCTOR visibility:public <> (xx:kotlin.Int, yy:kotlin.Int) returnType:<root>.Test1 [primary]
|
||||
VALUE_PARAMETER name:xx index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:yy index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
BLOCK type=<root>.Base origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
|
||||
x: GET_VAR 'xx: kotlin.Int declared in <root>.Test1.<init>' type=kotlin.Int origin=null
|
||||
y: GET_VAR 'yy: kotlin.Int declared in <root>.Test1.<init>' type=kotlin.Int origin=null
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.Base]'
|
||||
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final x: kotlin.Int [val]
|
||||
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final fun <get-x> (): kotlin.Int declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||
PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final y: kotlin.Int [val]
|
||||
FUN FAKE_OVERRIDE name:<get-y> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final fun <get-y> (): kotlin.Int declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||
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 [fake_override,operator] declared in <root>.Base
|
||||
$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 [fake_override] declared in <root>.Base
|
||||
$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 [fake_override] declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.Base]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test2
|
||||
CONSTRUCTOR visibility:public <> (xx:kotlin.Int, yy:kotlin.Int) returnType:<root>.Test2
|
||||
VALUE_PARAMETER name:xx index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:yy index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
BLOCK type=<root>.Base origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
|
||||
x: GET_VAR 'xx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
y: GET_VAR 'yy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.Base]'
|
||||
CONSTRUCTOR visibility:public <> (xxx:kotlin.Int, yyy:kotlin.Int, a:kotlin.Any) returnType:<root>.Test2
|
||||
VALUE_PARAMETER name:xxx index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:yyy index:1 type:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:2 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
BLOCK type=<root>.Test2 origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (xx: kotlin.Int, yy: kotlin.Int) declared in <root>.Test2'
|
||||
xx: GET_VAR 'xxx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
yy: GET_VAR 'yyy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final x: kotlin.Int [val]
|
||||
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final fun <get-x> (): kotlin.Int declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||
PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final y: kotlin.Int [val]
|
||||
FUN FAKE_OVERRIDE name:<get-y> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:y visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final fun <get-y> (): kotlin.Int declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||
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 [fake_override,operator] declared in <root>.Base
|
||||
$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 [fake_override] declared in <root>.Base
|
||||
$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 [fake_override] declared in <root>.Base
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class Base(val x: Int, val y: Int)
|
||||
|
||||
class Test1(xx: Int, yy: Int) : Base(y = yy, x = xx)
|
||||
|
||||
+3
-9
@@ -17,9 +17,7 @@ open class Base {
|
||||
|
||||
class Test1 : Base {
|
||||
constructor(xx: Int, yy: Int) /* primary */ {
|
||||
{ // BLOCK
|
||||
super/*Base*/(x = xx, y = yy)
|
||||
}
|
||||
super/*Base*/(x = xx, y = yy)
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
@@ -28,17 +26,13 @@ class Test1 : Base {
|
||||
|
||||
class Test2 : Base {
|
||||
constructor(xx: Int, yy: Int) {
|
||||
{ // BLOCK
|
||||
super/*Base*/(x = xx, y = yy)
|
||||
}
|
||||
super/*Base*/(x = xx, y = yy)
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
constructor(xxx: Int, yyy: Int, a: Any) {
|
||||
{ // BLOCK
|
||||
this/*Test2*/(xx = xxx, yy = yyy)
|
||||
}
|
||||
this/*Test2*/(xx = xxx, yy = yyy)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-12
@@ -48,10 +48,9 @@ FILE fqName:<root> fileName:/argumentReorderingInDelegatingConstructorCall.kt
|
||||
VALUE_PARAMETER name:xx index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:yy index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
|
||||
x: GET_VAR 'xx: kotlin.Int declared in <root>.Test1.<init>' type=kotlin.Int origin=null
|
||||
y: GET_VAR 'yy: kotlin.Int declared in <root>.Test1.<init>' type=kotlin.Int origin=null
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
|
||||
x: GET_VAR 'xx: kotlin.Int declared in <root>.Test1.<init>' type=kotlin.Int origin=null
|
||||
y: GET_VAR 'yy: kotlin.Int declared in <root>.Test1.<init>' type=kotlin.Int origin=null
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.Base]'
|
||||
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
@@ -88,20 +87,18 @@ FILE fqName:<root> fileName:/argumentReorderingInDelegatingConstructorCall.kt
|
||||
VALUE_PARAMETER name:xx index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:yy index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
|
||||
x: GET_VAR 'xx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
y: GET_VAR 'yy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
|
||||
x: GET_VAR 'xx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
y: GET_VAR 'yy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.Base]'
|
||||
CONSTRUCTOR visibility:public <> (xxx:kotlin.Int, yyy:kotlin.Int, a:kotlin.Any) returnType:<root>.Test2
|
||||
VALUE_PARAMETER name:xxx index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:yyy index:1 type:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:2 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (xx: kotlin.Int, yy: kotlin.Int) declared in <root>.Test2'
|
||||
xx: GET_VAR 'xxx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
yy: GET_VAR 'yyy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (xx: kotlin.Int, yy: kotlin.Int) declared in <root>.Test2'
|
||||
xx: GET_VAR 'xxx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
yy: GET_VAR 'yyy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
|
||||
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
|
||||
overridden:
|
||||
public final x: kotlin.Int [val]
|
||||
|
||||
Reference in New Issue
Block a user