[IR] Fix translation of synthetic generic java properties
- Compute substituted accessor descriptor to avoid unbound type parameters
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
FILE fqName:<root> fileName:/javaSyntheticGenericPropertyAccess.kt
|
||||
FUN name:test visibility:public modality:FINAL <F> (j:<root>.J<F of <root>.test>) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:F index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:j index:0 type:<root>.J<F of <root>.test>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun <get-foo> (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
CALL 'public open fun <set-foo> (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
x: CONST Int type=kotlin.Int value=1
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
||||
CALL 'public open fun <get-foo> (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
CALL 'public open fun <set-foo> (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
x: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
|
||||
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
|
||||
CALL 'public open fun <set-foo> (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=EQ
|
||||
x: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: CALL 'public open fun <get-foo> (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
other: CONST Int type=kotlin.Int value=1
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
FILE fqName:<root> fileName:/javaSyntheticGenericPropertyAccess.kt
|
||||
FUN name:test visibility:public modality:FINAL <F> (j:<root>.J<F of <root>.test>) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:F index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:j index:0 type:<root>.J<F of <root>.test>
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public open fun getFoo (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=GET_PROPERTY
|
||||
<1>: F of <root>.test
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
CALL 'public open fun setFoo (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=EQ
|
||||
<1>: F of <root>.test
|
||||
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
x: CONST Int type=kotlin.Int value=1
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.J<F of <root>.test> [val]
|
||||
GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
|
||||
CALL 'public open fun getFoo (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=POSTFIX_INCR
|
||||
<1>: F of <root>.test
|
||||
$this: GET_VAR 'val tmp_0: <root>.J<F of <root>.test> [val] declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
CALL 'public open fun setFoo (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=POSTFIX_INCR
|
||||
<1>: F of <root>.test
|
||||
$this: GET_VAR 'val tmp_0: <root>.J<F of <root>.test> [val] declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
x: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||
$this: GET_VAR 'val tmp_1: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
|
||||
GET_VAR 'val tmp_1: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
|
||||
BLOCK type=kotlin.Unit origin=PLUSEQ
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:<root>.J<F of <root>.test> [val]
|
||||
GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
CALL 'public open fun setFoo (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=PLUSEQ
|
||||
<1>: F of <root>.test
|
||||
$this: GET_VAR 'val tmp_2: <root>.J<F of <root>.test> [val] declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
x: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
|
||||
$this: CALL 'public open fun getFoo (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=PLUSEQ
|
||||
<1>: F of <root>.test
|
||||
$this: GET_VAR 'val tmp_2: <root>.J<F of <root>.test> [val] declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
|
||||
other: CONST Int type=kotlin.Int value=1
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: javaSyntheticGenericPropertyAccess.kt
|
||||
fun <F> test(j: J<F>) {
|
||||
j.foo
|
||||
j.foo = 1
|
||||
j.foo++
|
||||
j.foo += 1
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J<T> {
|
||||
private int foo = 42;
|
||||
|
||||
public int getFoo() { return foo; }
|
||||
public void setFoo(int x) {}
|
||||
}
|
||||
@@ -7,5 +7,4 @@ FILE fqName:<root> fileName:/jdkClassSyntheticProperty.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test> (): kotlin.Array<out java.lang.reflect.Field?>? declared in <root>'
|
||||
CALL 'public open fun getDeclaredFields (): kotlin.Array<out java.lang.reflect.Field?>? declared in java.lang.Class' type=kotlin.Array<out java.lang.reflect.Field?>? origin=GET_PROPERTY
|
||||
<1>: kotlin.Any?
|
||||
$this: TYPE_OP type=java.lang.Class<T of java.lang.Class> origin=IMPLICIT_CAST typeOperand=java.lang.Class<T of java.lang.Class>
|
||||
GET_VAR '<this>: java.lang.Class<*> declared in <root>.<get-test>' type=java.lang.Class<*> origin=null
|
||||
$this: GET_VAR '<this>: java.lang.Class<*> declared in <root>.<get-test>' type=java.lang.Class<*> origin=null
|
||||
|
||||
Reference in New Issue
Block a user