[klib tool] Add option to print ir
Dumping the IR from a klib is useful for debugging klib compilations. ^KT-58877
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
MODULE_FRAGMENT name:<class.kt>
|
||||
FILE fqName:test fileName:class.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:test.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
@@ -0,0 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
package test
|
||||
|
||||
class A {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
MODULE_FRAGMENT name:<class.kt>
|
||||
FILE fqName:test fileName:class.kt
|
||||
CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR signature:test/A.<init>|<init>(){}[0] visibility:public <> () returnType:test.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
@@ -0,0 +1,35 @@
|
||||
MODULE_FRAGMENT name:<constructor.kt>
|
||||
FILE fqName:test fileName:constructor.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR visibility:public <> (x:<unbound IrClassPublicSymbolImpl>) returnType:test.A [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:<unbound IrClassPublicSymbolImpl> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: <unbound IrClassPublicSymbolImpl> declared in test.A.<init>' type=<unbound IrClassPublicSymbolImpl> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-x> (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:<unbound IrClassPublicSymbolImpl> visibility:private [final]' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<get-x>' type=test.A origin=null
|
||||
CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A.Companion
|
||||
CONSTRUCTOR visibility:private <> () returnType:test.A.Companion [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
FUN name:create visibility:public modality:FINAL <> ($this:test.A.Companion, x:<unbound IrClassPublicSymbolImpl>) returnType:test.A
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A.Companion
|
||||
VALUE_PARAMETER name:x index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun create (x: <unbound IrClassPublicSymbolImpl>): test.A declared in test.A.Companion'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (x: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.A' type=test.A origin=null
|
||||
x: CALL 'UNBOUND IrSimpleFunctionPublicSymbolImpl' type=<unbound IrClassPublicSymbolImpl> origin=MUL
|
||||
$this: GET_VAR 'x: <unbound IrClassPublicSymbolImpl> declared in test.A.Companion.create' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
1: CONST Int type=<unbound IrClassPublicSymbolImpl> value=2
|
||||
@@ -0,0 +1,8 @@
|
||||
// FIR_IDENTICAL
|
||||
package test
|
||||
|
||||
class A constructor(val x: Int) {
|
||||
companion object {
|
||||
fun create(x: Int): A = A(x * 2)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
MODULE_FRAGMENT name:<constructor.kt>
|
||||
FILE fqName:test fileName:constructor.kt
|
||||
CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR signature:test/A.<init>|<init>(kotlin.Int){}[0] visibility:public <> (x:<unbound IrClassPublicSymbolImpl>) returnType:test.A [primary]
|
||||
VALUE_PARAMETER name:x index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
PROPERTY name:x signature:test/A.x|{}x[0] visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x signature:[ test/A.x|{}x[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]] ] type:<unbound IrClassPublicSymbolImpl> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'x: <unbound IrClassPublicSymbolImpl> declared in test.A.<init>' type=<unbound IrClassPublicSymbolImpl> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> signature:test/A.x.<get-x>|<get-x>(){}[0] visibility:public modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:x signature:test/A.x|{}x[0] visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-x> (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x signature:[ test/A.x|{}x[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]] ] type:<unbound IrClassPublicSymbolImpl> visibility:private [final]' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<get-x>' type=test.A origin=null
|
||||
CLASS OBJECT name:Companion signature:test/A.Companion|null[0] modality:FINAL visibility:public [companion] superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A.Companion
|
||||
CONSTRUCTOR signature:test/A.Companion.<init>|<init>(){}[0] visibility:private <> () returnType:test.A.Companion [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Companion signature:test/A.Companion|null[0] modality:FINAL visibility:public [companion] superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
FUN name:create signature:test/A.Companion.create|create(kotlin.Int){}[0] visibility:public modality:FINAL <> ($this:test.A.Companion, x:<unbound IrClassPublicSymbolImpl>) returnType:test.A
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A.Companion
|
||||
VALUE_PARAMETER name:x index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun create (x: <unbound IrClassPublicSymbolImpl>): test.A declared in test.A.Companion'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (x: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.A' type=test.A origin=null
|
||||
x: CALL 'UNBOUND IrSimpleFunctionPublicSymbolImpl' type=<unbound IrClassPublicSymbolImpl> origin=MUL
|
||||
$this: GET_VAR 'x: <unbound IrClassPublicSymbolImpl> declared in test.A.Companion.create' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
1: CONST Int type=<unbound IrClassPublicSymbolImpl> value=2
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
MODULE_FRAGMENT name:<enum.kt>
|
||||
FILE fqName:test fileName:enum.kt
|
||||
CLASS ENUM_CLASS name:Color modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl><test.Color>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.Color
|
||||
CONSTRUCTOR visibility:private <> (rgb:<unbound IrClassPublicSymbolImpl>) returnType:test.Color [primary]
|
||||
VALUE_PARAMETER name:rgb index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
<1>: test.Color
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Color modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl><test.Color>]'
|
||||
PROPERTY name:rgb visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:rgb type:<unbound IrClassPublicSymbolImpl> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'rgb: <unbound IrClassPublicSymbolImpl> declared in test.Color.<init>' type=<unbound IrClassPublicSymbolImpl> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-rgb> visibility:public modality:FINAL <> ($this:test.Color) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:rgb visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.Color
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-rgb> (): <unbound IrClassPublicSymbolImpl> declared in test.Color'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:rgb type:<unbound IrClassPublicSymbolImpl> visibility:private [final]' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.Color declared in test.Color.<get-rgb>' type=test.Color origin=null
|
||||
ENUM_ENTRY name:RED
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (rgb: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.Color'
|
||||
rgb: CONST Int type=<unbound IrClassPublicSymbolImpl> value=16711680
|
||||
ENUM_ENTRY name:GREEN
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (rgb: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.Color'
|
||||
rgb: CONST Int type=<unbound IrClassPublicSymbolImpl> value=65280
|
||||
ENUM_ENTRY name:BLUE
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (rgb: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.Color'
|
||||
rgb: CONST Int type=<unbound IrClassPublicSymbolImpl> value=255
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl><test.Color>
|
||||
SYNTHETIC_BODY kind=ENUM_VALUES
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:<unbound IrClassPublicSymbolImpl>) returnType:test.Color
|
||||
VALUE_PARAMETER name:value index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
SYNTHETIC_BODY kind=ENUM_VALUEOF
|
||||
PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val]
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:<get-entries> visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl><test.Color>
|
||||
correspondingProperty: PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val]
|
||||
SYNTHETIC_BODY kind=ENUM_ENTRIES
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// FIR_IDENTICAL
|
||||
package test
|
||||
|
||||
enum class Color(val rgb: Int) {
|
||||
RED(0xFF0000),
|
||||
GREEN(0x00FF00),
|
||||
BLUE(0x0000FF)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
MODULE_FRAGMENT name:<enum.kt>
|
||||
FILE fqName:test fileName:enum.kt
|
||||
CLASS ENUM_CLASS name:Color signature:test/Color|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl><test.Color>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.Color
|
||||
CONSTRUCTOR signature:test/Color.<init>|<init>(kotlin.Int){}[0] visibility:private <> (rgb:<unbound IrClassPublicSymbolImpl>) returnType:test.Color [primary]
|
||||
VALUE_PARAMETER name:rgb index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
<1>: test.Color
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Color signature:test/Color|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl><test.Color>]'
|
||||
PROPERTY name:rgb signature:test/Color.rgb|{}rgb[0] visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:rgb signature:[ test/Color.rgb|{}rgb[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:rgb type:kotlin.Int visibility:private [final]] ] type:<unbound IrClassPublicSymbolImpl> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'rgb: <unbound IrClassPublicSymbolImpl> declared in test.Color.<init>' type=<unbound IrClassPublicSymbolImpl> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-rgb> signature:test/Color.rgb.<get-rgb>|<get-rgb>(){}[0] visibility:public modality:FINAL <> ($this:test.Color) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:rgb signature:test/Color.rgb|{}rgb[0] visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.Color
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-rgb> (): <unbound IrClassPublicSymbolImpl> declared in test.Color'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:rgb signature:[ test/Color.rgb|{}rgb[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:rgb type:kotlin.Int visibility:private [final]] ] type:<unbound IrClassPublicSymbolImpl> visibility:private [final]' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.Color declared in test.Color.<get-rgb>' type=test.Color origin=null
|
||||
ENUM_ENTRY name:RED signature:test/Color.RED|null[0]
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (rgb: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.Color'
|
||||
rgb: CONST Int type=<unbound IrClassPublicSymbolImpl> value=16711680
|
||||
ENUM_ENTRY name:GREEN signature:test/Color.GREEN|null[0]
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (rgb: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.Color'
|
||||
rgb: CONST Int type=<unbound IrClassPublicSymbolImpl> value=65280
|
||||
ENUM_ENTRY name:BLUE signature:test/Color.BLUE|null[0]
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (rgb: <unbound IrClassPublicSymbolImpl>) [primary] declared in test.Color'
|
||||
rgb: CONST Int type=<unbound IrClassPublicSymbolImpl> value=255
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:values signature:test/Color.values|values#static(){}[0] visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl><test.Color>
|
||||
SYNTHETIC_BODY kind=ENUM_VALUES
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf signature:test/Color.valueOf|valueOf#static(kotlin.String){}[0] visibility:public modality:FINAL <> (value:<unbound IrClassPublicSymbolImpl>) returnType:test.Color
|
||||
VALUE_PARAMETER name:value index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
SYNTHETIC_BODY kind=ENUM_VALUEOF
|
||||
PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries signature:test/Color.entries|#static{}entries[0] visibility:public modality:FINAL [val]
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:<get-entries> signature:test/Color.entries.<get-entries>|<get-entries>#static(){}[0] visibility:public modality:FINAL <> () returnType:<unbound IrClassPublicSymbolImpl><test.Color>
|
||||
correspondingProperty: PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries signature:test/Color.entries|#static{}entries[0] visibility:public modality:FINAL [val]
|
||||
SYNTHETIC_BODY kind=ENUM_ENTRIES
|
||||
@@ -0,0 +1,38 @@
|
||||
MODULE_FRAGMENT name:<field.kt>
|
||||
FILE fqName:test fileName:field.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:test.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
PROPERTY name:x visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x type:<unbound IrClassPublicSymbolImpl> visibility:private
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=<unbound IrClassPublicSymbolImpl> value=5
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-x> (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:<unbound IrClassPublicSymbolImpl> visibility:private' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<get-x>' type=test.A origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> visibility:public modality:FINAL <> ($this:test.A, <set-?>:<unbound IrClassPublicSymbolImpl>) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:<unbound IrClassPublicSymbolImpl> visibility:private' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<set-x>' type=test.A origin=null
|
||||
value: GET_VAR '<set-?>: <unbound IrClassPublicSymbolImpl> declared in test.A.<set-x>' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
PROPERTY name:y visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:y type:<unbound IrClassPublicSymbolImpl> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=<unbound IrClassPublicSymbolImpl> value=10
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-y> visibility:public modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-y> (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:<unbound IrClassPublicSymbolImpl> visibility:private [final]' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<get-y>' type=test.A origin=null
|
||||
@@ -0,0 +1,7 @@
|
||||
// FIR_IDENTICAL
|
||||
package test
|
||||
|
||||
class A {
|
||||
var x: Int = 5
|
||||
final val y: Int = 10
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
MODULE_FRAGMENT name:<field.kt>
|
||||
FILE fqName:test fileName:field.kt
|
||||
CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR signature:test/A.<init>|<init>(){}[0] visibility:public <> () returnType:test.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
PROPERTY name:x signature:test/A.x|{}x[0] visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:x signature:[ test/A.x|{}x[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private] ] type:<unbound IrClassPublicSymbolImpl> visibility:private
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=<unbound IrClassPublicSymbolImpl> value=5
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> signature:test/A.x.<get-x>|<get-x>(){}[0] visibility:public modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:x signature:test/A.x|{}x[0] visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-x> (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x signature:[ test/A.x|{}x[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private] ] type:<unbound IrClassPublicSymbolImpl> visibility:private' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<get-x>' type=test.A origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> signature:test/A.x.<set-x>|<set-x>(kotlin.Int){}[0] visibility:public modality:FINAL <> ($this:test.A, <set-?>:<unbound IrClassPublicSymbolImpl>) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:x signature:test/A.x|{}x[0] visibility:public modality:FINAL [var]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
VALUE_PARAMETER name:<set-?> index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x signature:[ test/A.x|{}x[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private] ] type:<unbound IrClassPublicSymbolImpl> visibility:private' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<set-x>' type=test.A origin=null
|
||||
value: GET_VAR '<set-?>: <unbound IrClassPublicSymbolImpl> declared in test.A.<set-x>' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
PROPERTY name:y signature:test/A.y|{}y[0] visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:y signature:[ test/A.y|{}y[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private] ] type:<unbound IrClassPublicSymbolImpl> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=<unbound IrClassPublicSymbolImpl> value=10
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-y> signature:test/A.y.<get-y>|<get-y>(){}[0] visibility:public modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
correspondingProperty: PROPERTY name:y signature:test/A.y|{}y[0] visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun <get-y> (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y signature:[ test/A.y|{}y[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private] ] type:<unbound IrClassPublicSymbolImpl> visibility:private [final]' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
receiver: GET_VAR '<this>: test.A declared in test.A.<get-y>' type=test.A origin=null
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
MODULE_FRAGMENT name:<fun.kt>
|
||||
FILE fqName:test fileName:fun.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:test.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
FUN name:foo visibility:private modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='private final fun foo (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
CONST Int type=<unbound IrClassPublicSymbolImpl> value=42
|
||||
FUN name:bar visibility:public modality:FINAL <> ($this:test.A, z:<unbound IrClassPublicSymbolImpl>) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
VALUE_PARAMETER name:z index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun bar (z: <unbound IrClassPublicSymbolImpl>): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
CALL 'UNBOUND IrSimpleFunctionPublicSymbolImpl' type=<unbound IrClassPublicSymbolImpl> origin=PLUS
|
||||
$this: CALL 'private final fun foo (): <unbound IrClassPublicSymbolImpl> declared in test.A' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
$this: GET_VAR '<this>: test.A declared in test.A.bar' type=test.A origin=null
|
||||
1: GET_VAR 'z: <unbound IrClassPublicSymbolImpl> declared in test.A.bar' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// FIR_IDENTICAL
|
||||
package test
|
||||
|
||||
class A {
|
||||
private fun foo() = 42
|
||||
public fun bar(z: Int) = foo() + z
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
MODULE_FRAGMENT name:<fun.kt>
|
||||
FILE fqName:test fileName:fun.kt
|
||||
CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.A
|
||||
CONSTRUCTOR signature:test/A.<init>|<init>(){}[0] visibility:public <> () returnType:test.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A signature:test/A|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
FUN name:foo signature:test/A.foo|foo(){}[0] visibility:private modality:FINAL <> ($this:test.A) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='private final fun foo (): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
CONST Int type=<unbound IrClassPublicSymbolImpl> value=42
|
||||
FUN name:bar signature:test/A.bar|bar(kotlin.Int){}[0] visibility:public modality:FINAL <> ($this:test.A, z:<unbound IrClassPublicSymbolImpl>) returnType:<unbound IrClassPublicSymbolImpl>
|
||||
$this: VALUE_PARAMETER name:<this> type:test.A
|
||||
VALUE_PARAMETER name:z index:0 type:<unbound IrClassPublicSymbolImpl>
|
||||
BLOCK_BODY
|
||||
RETURN type=<unbound IrClassPublicSymbolImpl> from='public final fun bar (z: <unbound IrClassPublicSymbolImpl>): <unbound IrClassPublicSymbolImpl> declared in test.A'
|
||||
CALL 'UNBOUND IrSimpleFunctionPublicSymbolImpl' type=<unbound IrClassPublicSymbolImpl> origin=PLUS
|
||||
$this: CALL 'private final fun foo (): <unbound IrClassPublicSymbolImpl> declared in test.A' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
$this: GET_VAR '<this>: test.A declared in test.A.bar' type=test.A origin=null
|
||||
1: GET_VAR 'z: <unbound IrClassPublicSymbolImpl> declared in test.A.bar' type=<unbound IrClassPublicSymbolImpl> origin=null
|
||||
@@ -0,0 +1,11 @@
|
||||
MODULE_FRAGMENT name:<typealias.kt>
|
||||
FILE fqName:test fileName:typealias.kt
|
||||
TYPEALIAS name:PublicTypeAlias visibility:public expandedType:test.ClassName
|
||||
TYPEALIAS name:InternalTypeAlias visibility:internal expandedType:test.ClassName
|
||||
TYPEALIAS name:PrivateTypeAlias visibility:private expandedType:test.ClassName
|
||||
CLASS CLASS name:ClassName modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.ClassName
|
||||
CONSTRUCTOR visibility:public <> () returnType:test.ClassName [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ClassName modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
@@ -0,0 +1,11 @@
|
||||
MODULE_FRAGMENT name:<typealias.kt>
|
||||
FILE fqName:test fileName:typealias.kt
|
||||
CLASS CLASS name:ClassName modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.ClassName
|
||||
CONSTRUCTOR visibility:public <> () returnType:test.ClassName [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ClassName modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
TYPEALIAS name:PublicTypeAlias visibility:public expandedType:test.ClassName
|
||||
TYPEALIAS name:InternalTypeAlias visibility:internal expandedType:test.ClassName
|
||||
TYPEALIAS name:PrivateTypeAlias visibility:private expandedType:test.ClassName
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
class ClassName
|
||||
|
||||
typealias PublicTypeAlias = ClassName
|
||||
internal typealias InternalTypeAlias = ClassName
|
||||
private typealias PrivateTypeAlias = ClassName
|
||||
@@ -0,0 +1,11 @@
|
||||
MODULE_FRAGMENT name:<typealias.kt>
|
||||
FILE fqName:test fileName:typealias.kt
|
||||
TYPEALIAS name:PublicTypeAlias signature:test/PublicTypeAlias|null[0] visibility:public expandedType:test.ClassName
|
||||
TYPEALIAS name:InternalTypeAlias signature:test/InternalTypeAlias|null[0] visibility:internal expandedType:test.ClassName
|
||||
TYPEALIAS name:PrivateTypeAlias signature:[ File 'typealias.kt' <- test/PrivateTypeAlias|null[0] ] visibility:private expandedType:test.ClassName
|
||||
CLASS CLASS name:ClassName signature:test/ClassName|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.ClassName
|
||||
CONSTRUCTOR signature:test/ClassName.<init>|<init>(){}[0] visibility:public <> () returnType:test.ClassName [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ClassName signature:test/ClassName|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
@@ -0,0 +1,11 @@
|
||||
MODULE_FRAGMENT name:<typealias.kt>
|
||||
FILE fqName:test fileName:typealias.kt
|
||||
CLASS CLASS name:ClassName signature:test/ClassName|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:test.ClassName
|
||||
CONSTRUCTOR signature:test/ClassName.<init>|<init>(){}[0] visibility:public <> () returnType:test.ClassName [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'UNBOUND IrConstructorPublicSymbolImpl'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ClassName signature:test/ClassName|null[0] modality:FINAL visibility:public superTypes:[<unbound IrClassPublicSymbolImpl>]'
|
||||
TYPEALIAS name:PublicTypeAlias signature:test/PublicTypeAlias|null[0] visibility:public expandedType:test.ClassName
|
||||
TYPEALIAS name:InternalTypeAlias signature:test/InternalTypeAlias|null[0] visibility:internal expandedType:test.ClassName
|
||||
TYPEALIAS name:PrivateTypeAlias signature:[ File 'typealias.kt' <- test/PrivateTypeAlias|null[0] ] visibility:private expandedType:test.ClassName
|
||||
+1
-1
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
public class FirNativeKLibContentsTestGenerated extends AbstractNativeKlibContentsTest {
|
||||
public class FirNativeKlibContentsTestGenerated extends AbstractNativeKlibContentsTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInKlibContents() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klibContents"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.blackboxtest;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.FirPipeline;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/klibIr")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@Tag("frontend-fir")
|
||||
@FirPipeline()
|
||||
public class FirNativeKlibIrTestGenerated extends AbstractNativeKlibIrTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInKlibIr() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klibIr"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructor.kt")
|
||||
public void testConstructor() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/enum.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field.kt")
|
||||
public void testField() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/field.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fun.kt")
|
||||
public void testFun() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/fun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typealias.kt")
|
||||
public void testTypealias() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/typealias.kt");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/klibContents")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NativeKLibContentsTestGenerated extends AbstractNativeKlibContentsTest {
|
||||
public class NativeKlibContentsTestGenerated extends AbstractNativeKlibContentsTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInKlibContents() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klibContents"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
||||
native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeKlibIrTestGenerated.java
Generated
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.blackboxtest;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("native/native.tests/testData/klibIr")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NativeKlibIrTestGenerated extends AbstractNativeKlibIrTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInKlibIr() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/klibIr"), Pattern.compile("^([^_](.+)).kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constructor.kt")
|
||||
public void testConstructor() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/constructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/enum.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("field.kt")
|
||||
public void testField() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/field.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fun.kt")
|
||||
public void testFun() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/fun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typealias.kt")
|
||||
public void testTypealias() throws Exception {
|
||||
runTest("native/native.tests/testData/klibIr/typealias.kt");
|
||||
}
|
||||
}
|
||||
+21
-2
@@ -196,14 +196,14 @@ fun main() {
|
||||
// Klib contents tests
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeKlibContentsTest>(
|
||||
suiteTestClassName = "NativeKLibContentsTestGenerated"
|
||||
suiteTestClassName = "NativeKlibContentsTestGenerated"
|
||||
) {
|
||||
model("klibContents", pattern = "^([^_](.+)).kt$", recursive = true)
|
||||
}
|
||||
}
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeKlibContentsTest>(
|
||||
suiteTestClassName = "FirNativeKLibContentsTestGenerated",
|
||||
suiteTestClassName = "FirNativeKlibContentsTestGenerated",
|
||||
annotations = listOf(
|
||||
*frontendFir()
|
||||
)
|
||||
@@ -212,6 +212,25 @@ fun main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Klib ir tests
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeKlibIrTest>(
|
||||
suiteTestClassName = "NativeKlibIrTestGenerated",
|
||||
) {
|
||||
model("klibIr", pattern = "^([^_](.+)).kt$", recursive = true)
|
||||
}
|
||||
}
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeKlibIrTest>(
|
||||
suiteTestClassName = "FirNativeKlibIrTestGenerated",
|
||||
annotations = listOf(
|
||||
*frontendFir()
|
||||
)
|
||||
) {
|
||||
model("klibIr", pattern = "^([^_](.+)).kt$", recursive = true)
|
||||
}
|
||||
}
|
||||
|
||||
// LLDB integration tests.
|
||||
testGroup("native/native.tests/tests-gen", "native/native.tests/testData") {
|
||||
testClass<AbstractNativeBlackBoxTest>(
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.runner.TestRunChecks
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.Binaries
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.CacheMode
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.KotlinNativeTargets
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.PipelineType
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.Timeouts
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.util.*
|
||||
import org.jetbrains.kotlin.test.Directives
|
||||
@@ -36,7 +37,7 @@ import org.jetbrains.kotlin.compatibility.binary.TestModule as TModule
|
||||
abstract class AbstractNativeKlibEvolutionTest : AbstractNativeSimpleTest() {
|
||||
// Const evaluation tests muted for FIR because FIR does const propagation.
|
||||
private fun isIgnoredTest(filePath: String): Boolean {
|
||||
if (!this::class.java.simpleName.startsWith("Fir"))
|
||||
if (testRunSettings.get<PipelineType>() != PipelineType.K2)
|
||||
return false
|
||||
|
||||
val fileName = filePath.substringAfterLast('/')
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.konan.blackboxtest
|
||||
|
||||
import com.intellij.testFramework.TestDataFile
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.PackageName
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCase
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCaseId
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestCompilerArgs
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestFile
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestKind
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.TestRunnerType
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationArtifact
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationResult
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationResult.Companion.assertSuccess
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.runner.TestRunChecks
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.KotlinNativeClassLoader
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.PipelineType
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.settings.Timeouts
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.util.getAbsoluteFile
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.util.getIr
|
||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEqualsToFile
|
||||
import org.junit.jupiter.api.Tag
|
||||
import java.io.File
|
||||
|
||||
@Tag("klib")
|
||||
abstract class AbstractNativeKlibIrTest : AbstractNativeSimpleTest() {
|
||||
protected fun runTest(@TestDataFile testPath: String) {
|
||||
val testPathFull = getAbsoluteFile(testPath)
|
||||
muteTestIfNecessary(testPathFull)
|
||||
|
||||
val testCase: TestCase = generateTestCaseWithSingleSource(
|
||||
testPathFull,
|
||||
listOf("-Xklib-relative-path-base=${testPathFull.parent}")
|
||||
)
|
||||
val testCompilationResult: TestCompilationResult.Success<out TestCompilationArtifact.KLIB> = compileToLibrary(testCase)
|
||||
|
||||
val testPathNoExtension = testPathFull.canonicalPath.substringBeforeLast(".")
|
||||
|
||||
val firSpecificExt =
|
||||
if (testRunSettings.get<PipelineType>() == PipelineType.K2 && !firIdentical(testPathFull))
|
||||
".fir"
|
||||
else ""
|
||||
|
||||
val expectedContentsNoSig = File("$testPathNoExtension.ir$firSpecificExt.txt")
|
||||
assertIrMatchesExpected(testCompilationResult, expectedContentsNoSig, printSignatures = false)
|
||||
|
||||
val expectedContentsWithSig = File("$testPathNoExtension.sig.ir$firSpecificExt.txt")
|
||||
assertIrMatchesExpected(testCompilationResult, expectedContentsWithSig, printSignatures = true)
|
||||
}
|
||||
|
||||
private fun assertIrMatchesExpected(
|
||||
compilationResult: TestCompilationResult<out TestCompilationArtifact.KLIB>,
|
||||
expectedContents: File,
|
||||
printSignatures: Boolean
|
||||
) {
|
||||
val artifact = compilationResult.assertSuccess().resultingArtifact
|
||||
val kotlinNativeClassLoader = testRunSettings.get<KotlinNativeClassLoader>()
|
||||
val klibIr = artifact.getIr(kotlinNativeClassLoader.classLoader, printSignatures)
|
||||
assertEqualsToFile(expectedContents, klibIr)
|
||||
}
|
||||
|
||||
private fun generateTestCaseWithSingleSource(source: File, extraArgs: List<String>): TestCase {
|
||||
val moduleName: String = source.name
|
||||
val module = TestModule.Exclusive(moduleName, emptySet(), emptySet(), emptySet())
|
||||
module.files += TestFile.createCommitted(source, module)
|
||||
|
||||
return TestCase(
|
||||
id = TestCaseId.Named(moduleName),
|
||||
kind = TestKind.STANDALONE,
|
||||
modules = setOf(module),
|
||||
freeCompilerArgs = TestCompilerArgs(extraArgs),
|
||||
nominalPackageName = PackageName.EMPTY,
|
||||
checks = TestRunChecks.Default(testRunSettings.get<Timeouts>().executionTimeout),
|
||||
extras = TestCase.WithTestRunnerExtras(TestRunnerType.DEFAULT)
|
||||
).apply {
|
||||
initialize(null, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -309,6 +309,9 @@ internal fun AbstractNativeSimpleTest.muteTestIfNecessary(testDataFileContents:
|
||||
Assumptions.assumeFalse(mutedWhenValues.any { it == pipelineType.mutedOption.name })
|
||||
}
|
||||
|
||||
internal fun AbstractNativeSimpleTest.firIdentical(testDataFile: File) =
|
||||
InTextDirectivesUtils.isDirectiveDefined(FileUtil.loadFile(testDataFile), TestDirectives.FIR_IDENTICAL.name)
|
||||
|
||||
internal fun AbstractNativeSimpleTest.freeCompilerArgs(testDataFile: File) = freeCompilerArgs(FileUtil.loadFile(testDataFile))
|
||||
internal fun AbstractNativeSimpleTest.freeCompilerArgs(testDataFileContents: String) =
|
||||
directiveValues(testDataFileContents, TestDirectives.FREE_COMPILER_ARGS.name)
|
||||
|
||||
+4
@@ -140,6 +140,10 @@ internal object TestDirectives : SimpleDirectivesContainer() {
|
||||
Usage: // MUTED_WHEN: [K1, K2]
|
||||
In native simple tests, specify the pipeline types to mute the test""".trimIndent(),
|
||||
)
|
||||
|
||||
val FIR_IDENTICAL by directive(
|
||||
description = "Test behavior should be identical for FIR testing"
|
||||
)
|
||||
}
|
||||
|
||||
internal enum class TestKind {
|
||||
|
||||
+16
-3
@@ -6,14 +6,27 @@
|
||||
package org.jetbrains.kotlin.konan.blackboxtest.support.util
|
||||
|
||||
import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationArtifact
|
||||
import java.io.File
|
||||
|
||||
internal fun TestCompilationArtifact.KLIB.getContents(kotlinNativeClassLoader: ClassLoader): String {
|
||||
private fun invokeKlibTool(kotlinNativeClassLoader: ClassLoader, klibFile: File, functionName: String, vararg args: Any): String {
|
||||
val libraryClass = Class.forName("org.jetbrains.kotlin.cli.klib.Library", true, kotlinNativeClassLoader)
|
||||
val entryPoint = libraryClass.declaredMethods.single { it.name == "contents" }
|
||||
val entryPoint = libraryClass.declaredMethods.single { it.name == functionName }
|
||||
val lib = libraryClass.getDeclaredConstructor(String::class.java, String::class.java, String::class.java)
|
||||
.newInstance(klibFile.canonicalPath, null, "host")
|
||||
|
||||
val output = StringBuilder()
|
||||
entryPoint.invoke(lib, output, false)
|
||||
entryPoint.invoke(lib, output, *args)
|
||||
return output.toString()
|
||||
|
||||
}
|
||||
|
||||
internal fun TestCompilationArtifact.KLIB.getContents(kotlinNativeClassLoader: ClassLoader): String {
|
||||
return invokeKlibTool(kotlinNativeClassLoader, klibFile, "contents", false)
|
||||
}
|
||||
|
||||
internal fun TestCompilationArtifact.KLIB.getIr(
|
||||
kotlinNativeClassLoader: ClassLoader,
|
||||
printSignatures: Boolean = false,
|
||||
): String {
|
||||
return invokeKlibTool(kotlinNativeClassLoader, klibFile, "ir", printSignatures)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user