FIR2IR: don't generate 'none' type arguments for Java field references

#KT-60254 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-08-18 17:38:40 +02:00
committed by Space Team
parent 9846ec23df
commit b06188180e
8 changed files with 4 additions and 21 deletions
@@ -262,7 +262,6 @@ FILE fqName:<root> fileName:/propertyReferences.kt
FIELD PROPERTY_BACKING_FIELD name:test_J_CONST type:kotlin.reflect.KProperty0<kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
PROPERTY_REFERENCE 'public final CONST: kotlin.Int' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:CONST type:kotlin.Int visibility:public [final,static]' getter=null setter=null type=kotlin.reflect.KProperty0<kotlin.Int> origin=null
<1>: <none>
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_J_CONST> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0<kotlin.Int>
correspondingProperty: PROPERTY name:test_J_CONST visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -272,7 +271,6 @@ FILE fqName:<root> fileName:/propertyReferences.kt
FIELD PROPERTY_BACKING_FIELD name:test_J_nonConst type:kotlin.reflect.KMutableProperty0<kotlin.Int> visibility:private [final,static]
EXPRESSION_BODY
PROPERTY_REFERENCE 'public open nonConst: kotlin.Int' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:nonConst type:kotlin.Int visibility:public [static]' getter=null setter=null type=kotlin.reflect.KMutableProperty0<kotlin.Int> origin=null
<1>: <none>
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_J_nonConst> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty0<kotlin.Int>
correspondingProperty: PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -115,11 +115,11 @@ val test_constVal: KProperty0<Int>
get
val test_J_CONST: KProperty0<Int>
field = J::CONST/*</* null */>()*/
field = J::CONST
get
val test_J_nonConst: KMutableProperty0<Int>
field = J::nonConst/*</* null */>()*/
field = J::nonConst
get
val test_varWithPrivateSet: KProperty1<C, Int>
@@ -20,7 +20,6 @@ FILE fqName:<root> fileName:/protectedJavaFieldRef.kt
FIELD PROPERTY_BACKING_FIELD name:ref type:kotlin.reflect.KMutableProperty0<@[FlexibleNullability] kotlin.String?> visibility:private [final]
EXPRESSION_BODY
PROPERTY_REFERENCE 'protected/*protected and package*/ open j: @[FlexibleNullability] kotlin.String?' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:j type:@[FlexibleNullability] kotlin.String? visibility:protected/*protected and package*/' getter='protected/*protected and package*/ open fun <get-j> (): @[FlexibleNullability] kotlin.String? declared in p.Base' setter='protected/*protected and package*/ open fun <set-j> (<set-?>: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in p.Base' type=kotlin.reflect.KMutableProperty0<@[FlexibleNullability] kotlin.String?> origin=null
<1>: <none>
$this: GET_VAR '<this>: <root>.Derived declared in <root>.Derived' type=<root>.Derived origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-ref> visibility:public modality:FINAL <> ($this:<root>.Derived) returnType:kotlin.reflect.KMutableProperty0<@[FlexibleNullability] kotlin.String?>
correspondingProperty: PROPERTY name:ref visibility:public modality:FINAL [val]
@@ -1,9 +0,0 @@
FILE fqName:<root> fileName:/SameJavaFieldReferences.kt
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:ref1 type:kotlin.reflect.KProperty0<kotlin.String> [val]
PROPERTY_REFERENCE 'public final someJavaField: kotlin.String' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:someJavaField type:kotlin.String visibility:public [final,static]' getter=null setter=null type=kotlin.reflect.KProperty0<kotlin.String> origin=null
<1>: <none>
VAR name:ref2 type:kotlin.reflect.KProperty0<kotlin.String> [val]
PROPERTY_REFERENCE 'public final someJavaField: kotlin.String' field='FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:someJavaField type:kotlin.String visibility:public [final,static]' getter=null setter=null type=kotlin.reflect.KProperty0<kotlin.String> origin=null
<1>: <none>
@@ -1,4 +0,0 @@
fun foo() {
val ref1: KProperty0<String> = SomeJavaClass::someJavaField/*</* null */>()*/
val ref2: KProperty0<String> = SomeJavaClass::someJavaField/*</* null */>()*/
}
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// FIR_IDENTICAL
// FILE: SomeJavaClass.java
public class SomeJavaClass {