[FIR] Generate java declarations for record components of java records

^KT-53964 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-09-30 14:51:58 +03:00
parent 2ed6e9febf
commit c0ad67c4f9
35 changed files with 469 additions and 71 deletions
@@ -0,0 +1,13 @@
FILE fqName:<root> fileName:/recordPropertyAccess.kt
FUN name:test_1 visibility:public modality:FINAL <> (rec:<root>.MyRec) returnType:kotlin.Unit
VALUE_PARAMETER name:rec index:0 type:<root>.MyRec
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun name (): @[FlexibleNullability] kotlin.String? declared in <root>.MyRec' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY
$this: GET_VAR 'rec: <root>.MyRec declared in <root>.test_1' type=<root>.MyRec origin=null
FUN name:test_2 visibility:public modality:FINAL <> (rec:<root>.MyRec) returnType:kotlin.Unit
VALUE_PARAMETER name:rec index:0 type:<root>.MyRec
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun name (): @[FlexibleNullability] kotlin.String? declared in <root>.MyRec' type=@[FlexibleNullability] kotlin.String? origin=null
$this: GET_VAR 'rec: <root>.MyRec declared in <root>.test_2' type=<root>.MyRec origin=null
@@ -0,0 +1,7 @@
fun test_1(rec: MyRec) {
rec.name() /*~> Unit */
}
fun test_2(rec: MyRec) {
rec.name() /*~> Unit */
}
@@ -0,0 +1,13 @@
FILE fqName:<root> fileName:/recordPropertyAccess.kt
FUN name:test_1 visibility:public modality:FINAL <> (rec:<root>.MyRec) returnType:kotlin.Unit
VALUE_PARAMETER name:rec index:0 type:<root>.MyRec
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun name (): @[FlexibleNullability] kotlin.String? declared in <root>.MyRec' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY
$this: GET_VAR 'rec: <root>.MyRec declared in <root>.test_1' type=<root>.MyRec origin=null
FUN name:test_2 visibility:public modality:FINAL <> (rec:<root>.MyRec) returnType:kotlin.Unit
VALUE_PARAMETER name:rec index:0 type:<root>.MyRec
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public open fun name (): @[FlexibleNullability] kotlin.String? declared in <root>.MyRec' type=@[FlexibleNullability] kotlin.String? origin=null
$this: GET_VAR 'rec: <root>.MyRec declared in <root>.test_2' type=<root>.MyRec origin=null
@@ -0,0 +1,13 @@
// TARGET_BACKEND: JVM_IR
// JDK_KIND: FULL_JDK_17
// FILE: MyRec.java
public record MyRec(String name) {}
// FILE: recordPropertyAccess.kt
fun test_1(rec: MyRec) {
rec.name
}
fun test_2(rec: MyRec) {
rec.name()
}
@@ -0,0 +1,7 @@
fun test_1(rec: MyRec) {
rec.name() /*~> Unit */
}
fun test_2(rec: MyRec) {
rec.name() /*~> Unit */
}