diff --git a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt index 891743f1e08..abb4e1cd17b 100644 --- a/compiler/testData/ir/irText/expressions/boundCallableReferences.txt +++ b/compiler/testData/ir/irText/expressions/boundCallableReferences.txt @@ -48,7 +48,7 @@ FILE fqName: fileName:/boundCallableReferences.kt PROPERTY name:test2 visibility:public modality:FINAL flags:val FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.reflect.KProperty0 visibility:public flags:final,static EXPRESSION_BODY - PROPERTY_REFERENCE 'bar: Int' field='bar: Int' getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null + PROPERTY_REFERENCE 'bar: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null $this: CALL 'constructor A()' type=A origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL flags:val diff --git a/compiler/testData/ir/irText/expressions/callableRefToGenericMember.txt b/compiler/testData/ir/irText/expressions/callableRefToGenericMember.txt index a7a49754445..04aee18afe1 100644 --- a/compiler/testData/ir/irText/expressions/callableRefToGenericMember.txt +++ b/compiler/testData/ir/irText/expressions/callableRefToGenericMember.txt @@ -45,10 +45,9 @@ FILE fqName: fileName:/callableRefToGenericMember.kt PROPERTY name:test2 visibility:public modality:FINAL flags:val FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.reflect.KProperty1, kotlin.Int> visibility:public flags:final,static EXPRESSION_BODY - PROPERTY_REFERENCE 'bar: Int' field='bar: Int' getter='(): Int' setter=null type=kotlin.reflect.KProperty1, kotlin.Int> origin=null + PROPERTY_REFERENCE 'bar: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty1, kotlin.Int> origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty1, kotlin.Int> flags: correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL flags:val BLOCK_BODY RETURN type=kotlin.Nothing from='(): KProperty1, Int>' GET_FIELD 'test2: KProperty1, Int>' type=kotlin.reflect.KProperty1, kotlin.Int> origin=null - diff --git a/compiler/testData/ir/irText/expressions/callableReferenceToImportedFromObject.txt b/compiler/testData/ir/irText/expressions/callableReferenceToImportedFromObject.txt index d95bec71e59..e546889c13d 100644 --- a/compiler/testData/ir/irText/expressions/callableReferenceToImportedFromObject.txt +++ b/compiler/testData/ir/irText/expressions/callableReferenceToImportedFromObject.txt @@ -37,7 +37,7 @@ FILE fqName:test fileName:/callableReferenceToImportedFromObject.kt PROPERTY name:test1 visibility:public modality:FINAL flags:val FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.reflect.KProperty0 visibility:public flags:final,static EXPRESSION_BODY - PROPERTY_REFERENCE 'a: String' field='a: String' getter='(): String' setter=null type=kotlin.reflect.KProperty0 origin=null + PROPERTY_REFERENCE 'a: String' field=null getter='(): String' setter=null type=kotlin.reflect.KProperty0 origin=null $this: GET_OBJECT 'Foo' type=test.Foo FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL flags:val @@ -47,7 +47,7 @@ FILE fqName:test fileName:/callableReferenceToImportedFromObject.kt PROPERTY name:test1a visibility:public modality:FINAL flags:val FIELD PROPERTY_BACKING_FIELD name:test1a type:kotlin.reflect.KProperty0 visibility:public flags:final,static EXPRESSION_BODY - PROPERTY_REFERENCE 'a: String' field='a: String' getter='(): String' setter=null type=kotlin.reflect.KProperty0 origin=null + PROPERTY_REFERENCE 'a: String' field=null getter='(): String' setter=null type=kotlin.reflect.KProperty0 origin=null $this: GET_OBJECT 'Foo' type=test.Foo FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: correspondingProperty: PROPERTY name:test1a visibility:public modality:FINAL flags:val diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.txt index 35604e4b397..c617a638ca4 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.txt @@ -69,7 +69,7 @@ FILE fqName: fileName:/genericPropertyRef.kt FIELD DELEGATE name:additionalText$delegate type:DVal visibility:private flags:final,static EXPRESSION_BODY CALL 'constructor DVal(Any)' type=DVal origin=null - kmember: PROPERTY_REFERENCE 'text: String?' field='text: String?' getter='(): String?' setter='(String?): Unit' type=kotlin.reflect.KMutableProperty1, kotlin.String?> origin=null + kmember: PROPERTY_REFERENCE 'text: String?' field=null getter='(): String?' setter='(String?): Unit' type=kotlin.reflect.KMutableProperty1, kotlin.String?> origin=null FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL ($receiver:Value) returnType:kotlin.Int flags: correspondingProperty: PROPERTY name:additionalText visibility:public modality:FINAL flags:delegated,val TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] @@ -85,7 +85,7 @@ FILE fqName: fileName:/genericPropertyRef.kt FIELD DELEGATE name:additionalValue$delegate type:DVal visibility:private flags:final,static EXPRESSION_BODY CALL 'constructor DVal(Any)' type=DVal origin=null - kmember: PROPERTY_REFERENCE 'value: T' field='value: T' getter='(): T' setter='(T): Unit' type=kotlin.reflect.KMutableProperty1, T> origin=null + kmember: PROPERTY_REFERENCE 'value: T' field=null getter='(): T' setter='(T): Unit' type=kotlin.reflect.KMutableProperty1, T> origin=null FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL ($receiver:Value) returnType:kotlin.Int flags: correspondingProperty: PROPERTY name:additionalValue visibility:public modality:FINAL flags:delegated,val TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] @@ -186,7 +186,7 @@ FILE fqName: fileName:/genericPropertyRef.kt PROPERTY name:barRef visibility:public modality:FINAL flags:val FIELD PROPERTY_BACKING_FIELD name:barRef type:kotlin.reflect.KMutableProperty1 visibility:public flags:final,static EXPRESSION_BODY - PROPERTY_REFERENCE 'bar: T on T' field='bar: T on T' getter='() on T: T' setter='(T) on T: Unit' type=kotlin.reflect.KMutableProperty1 origin=null + PROPERTY_REFERENCE 'bar: T on T' field=null getter='() on T: T' setter='(T) on T: Unit' type=kotlin.reflect.KMutableProperty1 origin=null : kotlin.String? FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty1 flags: correspondingProperty: PROPERTY name:barRef visibility:public modality:FINAL flags:val diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.kt b/compiler/testData/ir/irText/expressions/propertyReferences.kt new file mode 100644 index 00000000000..b7c4a7585f9 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/propertyReferences.kt @@ -0,0 +1,51 @@ +// FILE: propertyReferences.kt +object Delegate { + operator fun getValue(thisRef: Any?, kProp: Any) = 1 + operator fun setValue(thisRef: Any?, kProp: Any, value: Int) {} +} + +val valWithBackingField = 1 + +val test_valWithBackingField = ::valWithBackingField + +var varWithBackingField = 1 + +val test_varWithBackingField = ::varWithBackingField + +var varWithBackingFieldAndAccessors = 1 + get() = field + set(value) { field = value } + +val test_varWithBackingFieldAndAccessors = ::varWithBackingFieldAndAccessors + +val valWithAccessors + get() = 1 + +val test_valWithAccessors = ::valWithAccessors + +var varWithAccessors + get() = 1 + set(value) {} + +val test_varWithAccessors = ::varWithAccessors + +val delegatedVal by Delegate + +val test_delegatedVal = ::delegatedVal + +var delegatedVar by Delegate + +val test_delegatedVar = ::delegatedVar + +val constVal = 1 + +val test_constVal = ::constVal + +val test_J_CONST = J::CONST +val test_J_nonConst = J::nonConst + +// FILE: J.java +public class J { + public static final int CONST = 1; + public static int nonConst = 2; +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.txt b/compiler/testData/ir/irText/expressions/propertyReferences.txt new file mode 100644 index 00000000000..e2b40842e2b --- /dev/null +++ b/compiler/testData/ir/irText/expressions/propertyReferences.txt @@ -0,0 +1,221 @@ +FILE fqName: fileName:/propertyReferences.kt + CLASS OBJECT name:Delegate modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:Delegate flags: + CONSTRUCTOR visibility:private <> () returnType:Delegate flags:primary + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Delegate' + FUN name:getValue visibility:public modality:FINAL <> ($this:Delegate, thisRef:kotlin.Any?, kProp:kotlin.Any) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:Delegate flags: + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? flags: + VALUE_PARAMETER name:kProp index:1 type:kotlin.Any flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='getValue(Any?, Any): Int' + CONST Int type=kotlin.Int value=1 + FUN name:setValue visibility:public modality:FINAL <> ($this:Delegate, thisRef:kotlin.Any?, kProp:kotlin.Any, value:kotlin.Int) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:Delegate flags: + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? flags: + VALUE_PARAMETER name:kProp index:1 type:kotlin.Any flags: + VALUE_PARAMETER name:value index:2 type:kotlin.Int flags: + BLOCK_BODY + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Any flags: + PROPERTY name:valWithBackingField visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:valWithBackingField type:kotlin.Int visibility:public flags:final,static + EXPRESSION_BODY + CONST Int type=kotlin.Int value=1 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:valWithBackingField visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'valWithBackingField: Int' type=kotlin.Int origin=null + PROPERTY name:test_valWithBackingField visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_valWithBackingField type:kotlin.reflect.KProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'valWithBackingField: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: + correspondingProperty: PROPERTY name:test_valWithBackingField visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_FIELD 'test_valWithBackingField: KProperty0' type=kotlin.reflect.KProperty0 origin=null + PROPERTY name:varWithBackingField visibility:public modality:FINAL flags:var + FIELD PROPERTY_BACKING_FIELD name:varWithBackingField type:kotlin.Int visibility:public flags:static + EXPRESSION_BODY + CONST Int type=kotlin.Int value=1 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:varWithBackingField visibility:public modality:FINAL flags:var + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'varWithBackingField: Int' type=kotlin.Int origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit flags: + correspondingProperty: PROPERTY name:varWithBackingField visibility:public modality:FINAL flags:var + VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + BLOCK_BODY + SET_FIELD 'varWithBackingField: Int' type=kotlin.Unit origin=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + PROPERTY name:test_varWithBackingField visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_varWithBackingField type:kotlin.reflect.KMutableProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'varWithBackingField: Int' field=null getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty0 flags: + correspondingProperty: PROPERTY name:test_varWithBackingField visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KMutableProperty0' + GET_FIELD 'test_varWithBackingField: KMutableProperty0' type=kotlin.reflect.KMutableProperty0 origin=null + PROPERTY name:varWithBackingFieldAndAccessors visibility:public modality:FINAL flags:var + FIELD PROPERTY_BACKING_FIELD name:varWithBackingFieldAndAccessors type:kotlin.Int visibility:public flags:static + EXPRESSION_BODY + CONST Int type=kotlin.Int value=1 + FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:varWithBackingFieldAndAccessors visibility:public modality:FINAL flags:var + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'varWithBackingFieldAndAccessors: Int' type=kotlin.Int origin=null + FUN name: visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit flags: + correspondingProperty: PROPERTY name:varWithBackingFieldAndAccessors visibility:public modality:FINAL flags:var + VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + BLOCK_BODY + SET_FIELD 'varWithBackingFieldAndAccessors: Int' type=kotlin.Unit origin=EQ + value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + PROPERTY name:test_varWithBackingFieldAndAccessors visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_varWithBackingFieldAndAccessors type:kotlin.reflect.KMutableProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'varWithBackingFieldAndAccessors: Int' field=null getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty0 flags: + correspondingProperty: PROPERTY name:test_varWithBackingFieldAndAccessors visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KMutableProperty0' + GET_FIELD 'test_varWithBackingFieldAndAccessors: KMutableProperty0' type=kotlin.reflect.KMutableProperty0 origin=null + PROPERTY name:valWithAccessors visibility:public modality:FINAL flags:val + FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:valWithAccessors visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value=1 + PROPERTY name:test_valWithAccessors visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_valWithAccessors type:kotlin.reflect.KProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'valWithAccessors: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: + correspondingProperty: PROPERTY name:test_valWithAccessors visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_FIELD 'test_valWithAccessors: KProperty0' type=kotlin.reflect.KProperty0 origin=null + PROPERTY name:varWithAccessors visibility:public modality:FINAL flags:var + FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:varWithAccessors visibility:public modality:FINAL flags:var + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CONST Int type=kotlin.Int value=1 + FUN name: visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit flags: + correspondingProperty: PROPERTY name:varWithAccessors visibility:public modality:FINAL flags:var + VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + BLOCK_BODY + PROPERTY name:test_varWithAccessors visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_varWithAccessors type:kotlin.reflect.KMutableProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'varWithAccessors: Int' field=null getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty0 flags: + correspondingProperty: PROPERTY name:test_varWithAccessors visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KMutableProperty0' + GET_FIELD 'test_varWithAccessors: KMutableProperty0' type=kotlin.reflect.KMutableProperty0 origin=null + PROPERTY name:delegatedVal visibility:public modality:FINAL flags:delegated,val + FIELD DELEGATE name:delegatedVal$delegate type:Delegate visibility:private flags:final,static + EXPRESSION_BODY + GET_OBJECT 'Delegate' type=Delegate + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:delegatedVal visibility:public modality:FINAL flags:delegated,val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CALL 'getValue(Any?, Any): Int' type=kotlin.Int origin=null + $this: GET_FIELD '`delegatedVal$delegate`: Delegate' type=Delegate origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + kProp: PROPERTY_REFERENCE 'delegatedVal: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE + PROPERTY name:test_delegatedVal visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_delegatedVal type:kotlin.reflect.KProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'delegatedVal: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: + correspondingProperty: PROPERTY name:test_delegatedVal visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_FIELD 'test_delegatedVal: KProperty0' type=kotlin.reflect.KProperty0 origin=null + PROPERTY name:delegatedVar visibility:public modality:FINAL flags:delegated,var + FIELD DELEGATE name:delegatedVar$delegate type:Delegate visibility:private flags:final,static + EXPRESSION_BODY + GET_OBJECT 'Delegate' type=Delegate + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:delegatedVar visibility:public modality:FINAL flags:delegated,var + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + CALL 'getValue(Any?, Any): Int' type=kotlin.Int origin=null + $this: GET_FIELD '`delegatedVar$delegate`: Delegate' type=Delegate origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + kProp: PROPERTY_REFERENCE 'delegatedVar: Int' field=null getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit flags: + correspondingProperty: PROPERTY name:delegatedVar visibility:public modality:FINAL flags:delegated,var + VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(Int): Unit' + CALL 'setValue(Any?, Any, Int): Unit' type=kotlin.Unit origin=null + $this: GET_FIELD '`delegatedVar$delegate`: Delegate' type=Delegate origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + kProp: PROPERTY_REFERENCE 'delegatedVar: Int' field=null getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + PROPERTY name:test_delegatedVar visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_delegatedVar type:kotlin.reflect.KMutableProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'delegatedVar: Int' field=null getter='(): Int' setter='(Int): Unit' type=kotlin.reflect.KMutableProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty0 flags: + correspondingProperty: PROPERTY name:test_delegatedVar visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KMutableProperty0' + GET_FIELD 'test_delegatedVar: KMutableProperty0' type=kotlin.reflect.KMutableProperty0 origin=null + PROPERTY name:constVal visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:constVal type:kotlin.Int visibility:public flags:final,static + EXPRESSION_BODY + CONST Int type=kotlin.Int value=1 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:constVal visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'constVal: Int' type=kotlin.Int origin=null + PROPERTY name:test_constVal visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_constVal type:kotlin.reflect.KProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'constVal: Int' field=null getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: + correspondingProperty: PROPERTY name:test_constVal visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_FIELD 'test_constVal: KProperty0' type=kotlin.reflect.KProperty0 origin=null + PROPERTY name:test_J_CONST visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_J_CONST type:kotlin.reflect.KProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'CONST: Int' field='CONST: Int' getter=null setter=null type=kotlin.reflect.KProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: + correspondingProperty: PROPERTY name:test_J_CONST visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KProperty0' + GET_FIELD 'test_J_CONST: KProperty0' type=kotlin.reflect.KProperty0 origin=null + PROPERTY name:test_J_nonConst visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:test_J_nonConst type:kotlin.reflect.KMutableProperty0 visibility:public flags:final,static + EXPRESSION_BODY + PROPERTY_REFERENCE 'nonConst: Int' field='nonConst: Int' getter=null setter=null type=kotlin.reflect.KMutableProperty0 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KMutableProperty0 flags: + correspondingProperty: PROPERTY name:test_J_nonConst visibility:public modality:FINAL flags:val + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): KMutableProperty0' + GET_FIELD 'test_J_nonConst: KMutableProperty0' type=kotlin.reflect.KMutableProperty0 origin=null diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt index 377423df9a0..ec7e4f36a2b 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt @@ -2,12 +2,11 @@ class A { fun foo() {} } fun bar() {} -val qux = 42 +val qux = 1 val test1 = A::class val test2 = qux::class val test3 = A::foo val test4 = ::A val test5 = A()::foo -val test6 = ::bar -val test7 = ::qux \ No newline at end of file +val test6 = ::bar \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.txt index c520018e7aa..e5693742f1c 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.txt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.txt @@ -26,7 +26,7 @@ FILE fqName: fileName:/reflectionLiterals.kt PROPERTY name:qux visibility:public modality:FINAL flags:val FIELD PROPERTY_BACKING_FIELD name:qux type:kotlin.Int visibility:public flags:final,static EXPRESSION_BODY - CONST Int type=kotlin.Int value=42 + CONST Int type=kotlin.Int value=1 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: correspondingProperty: PROPERTY name:qux visibility:public modality:FINAL flags:val BLOCK_BODY @@ -88,13 +88,3 @@ FILE fqName: fileName:/reflectionLiterals.kt BLOCK_BODY RETURN type=kotlin.Nothing from='(): KFunction0' GET_FIELD 'test6: KFunction0' type=kotlin.reflect.KFunction0 origin=null - PROPERTY name:test7 visibility:public modality:FINAL flags:val - FIELD PROPERTY_BACKING_FIELD name:test7 type:kotlin.reflect.KProperty0 visibility:public flags:final,static - EXPRESSION_BODY - PROPERTY_REFERENCE 'qux: Int' field='qux: Int' getter='(): Int' setter=null type=kotlin.reflect.KProperty0 origin=null - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KProperty0 flags: - correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL flags:val - BLOCK_BODY - RETURN type=kotlin.Nothing from='(): KProperty0' - GET_FIELD 'test7: KProperty0' type=kotlin.reflect.KProperty0 origin=null - diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 31720563bf6..688de667992 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1062,6 +1062,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/primitivesImplicitConversions.kt"); } + @TestMetadata("propertyReferences.kt") + public void testPropertyReferences() throws Exception { + runTest("compiler/testData/ir/irText/expressions/propertyReferences.kt"); + } + @TestMetadata("references.kt") public void testReferences() throws Exception { runTest("compiler/testData/ir/irText/expressions/references.kt");