diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt index dc2615ab6d9..72ca00d7146 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt @@ -121,9 +121,10 @@ fun StatementGenerator.generateSingletonReference( } private fun StatementGenerator.shouldGenerateReceiverAsSingletonReference(receiverClassDescriptor: ClassDescriptor): Boolean { + val scopeOwner = this.scopeOwner return receiverClassDescriptor.kind.isSingleton && - this.scopeOwner != receiverClassDescriptor && //For anonymous initializers - this.scopeOwner.containingDeclaration != receiverClassDescriptor + scopeOwner != receiverClassDescriptor && // For anonymous initializers + !(scopeOwner is FunctionDescriptor && scopeOwner.containingDeclaration == receiverClassDescriptor) // Methods of object } private fun StatementGenerator.generateThisOrSuperReceiver(receiver: ReceiverValue, classDescriptor: ClassDescriptor): IrExpression { diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt index 93e9fb4542f..759325ed9d2 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.txt @@ -59,7 +59,7 @@ FILE fqName: fileName:/memberExtension.kt FIELD DELEGATE name:plusK$delegate type:Host.StringDelegate visibility:private flags:final EXPRESSION_BODY CALL 'provideDelegate(Any?, Any) on String: Host.StringDelegate' type=Host.StringDelegate origin=null - $this: GET_VAR 'this@Host: Host' type=Host origin=null + $this: GET_OBJECT 'Host' type=Host $receiver: CONST String type=kotlin.String value=K host: GET_VAR 'this@Host: Host' type=Host origin=null p: PROPERTY_REFERENCE 'plusK: String on String' field=null getter='() on String: String' setter=null type=kotlin.reflect.KProperty2 origin=PROPERTY_REFERENCE_FOR_DELEGATE @@ -78,7 +78,7 @@ FILE fqName: fileName:/memberExtension.kt FIELD PROPERTY_BACKING_FIELD name:ok type:kotlin.String visibility:public flags:final EXPRESSION_BODY CALL '() on String: String' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR 'this@Host: Host' type=Host origin=null + $this: GET_OBJECT 'Host' type=Host $receiver: CONST String type=kotlin.String value=O FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Host) returnType:kotlin.String flags: correspondingProperty: PROPERTY name:ok visibility:public modality:FINAL flags:val diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt new file mode 100644 index 00000000000..95636298feb --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt @@ -0,0 +1,28 @@ +enum class MyEnum { + Z { + var counter = 0 + fun foo() {} + + fun bar() { + counter = 1 + foo() + } + + val aLambda = { + counter = 1 + foo() + } + + val anObject = object { + init { + counter = 1 + foo() + } + + fun test() { + counter = 1 + foo() + } + } + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt new file mode 100644 index 00000000000..2f71d4cc5a5 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.txt @@ -0,0 +1,203 @@ +FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt + CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public flags: superTypes:[kotlin.Enum] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:MyEnum flags: + CONSTRUCTOR visibility:private <> () returnType:MyEnum flags:primary + BLOCK_BODY + ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' + >: MyEnum + INSTANCE_INITIALIZER_CALL classDescriptor='MyEnum' + ENUM_ENTRY name:Z + init: ENUM_CONSTRUCTOR_CALL 'constructor Z()' + class: CLASS ENUM_ENTRY name:Z modality:FINAL visibility:public flags: superTypes:[MyEnum] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:MyEnum.Z flags: + CONSTRUCTOR visibility:private <> () returnType:MyEnum.Z flags:primary + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + ENUM_CONSTRUCTOR_CALL 'constructor MyEnum()' + INSTANCE_INITIALIZER_CALL classDescriptor='Z' + PROPERTY name:counter visibility:public modality:FINAL flags:var + FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public flags: + EXPRESSION_BODY + CONST Int type=kotlin.Int value=0 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:MyEnum.Z) returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:counter visibility:public modality:FINAL flags:var + $this: VALUE_PARAMETER name: type:MyEnum.Z flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'counter: Int' type=kotlin.Int origin=null + receiver: GET_VAR 'this@Z: Z' type=MyEnum.Z origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:MyEnum.Z, :kotlin.Int) returnType:kotlin.Unit flags: + correspondingProperty: PROPERTY name:counter visibility:public modality:FINAL flags:var + $this: VALUE_PARAMETER name: type:MyEnum.Z flags: + VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + BLOCK_BODY + SET_FIELD 'counter: Int' type=kotlin.Unit origin=null + receiver: GET_VAR 'this@Z: Z' type=MyEnum.Z origin=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + FUN name:foo visibility:public modality:FINAL <> ($this:MyEnum.Z) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:MyEnum.Z flags: + BLOCK_BODY + FUN name:bar visibility:public modality:FINAL <> ($this:MyEnum.Z) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:MyEnum.Z flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_VAR 'this@Z: Z' type=MyEnum.Z origin=null + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR 'this@Z: Z' type=MyEnum.Z origin=null + PROPERTY name:aLambda visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:aLambda type:() -> kotlin.Unit visibility:public flags:final + EXPRESSION_BODY + BLOCK type=() -> kotlin.Unit origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_ENUM 'Z' type=MyEnum.Z + : CONST Int type=kotlin.Int value=1 + RETURN type=kotlin.Nothing from='(): Unit' + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_ENUM 'Z' type=MyEnum.Z + FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:MyEnum.Z) returnType:() -> kotlin.Unit flags: + correspondingProperty: PROPERTY name:aLambda visibility:public modality:FINAL flags:val + $this: VALUE_PARAMETER name: type:MyEnum.Z flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): () -> Unit' + GET_FIELD 'aLambda: () -> Unit' type=() -> kotlin.Unit origin=null + receiver: GET_VAR 'this@Z: Z' type=MyEnum.Z origin=null + PROPERTY name:anObject visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:anObject type:kotlin.Any visibility:public flags:final + EXPRESSION_BODY + BLOCK type=MyEnum.Z.anObject. origin=OBJECT_LITERAL + CLASS CLASS name: modality:FINAL visibility:local flags: superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:MyEnum.Z.anObject. flags: + CONSTRUCTOR visibility:public <> () returnType:MyEnum.Z.anObject. flags:primary + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='' + ANONYMOUS_INITIALIZER + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_ENUM 'Z' type=MyEnum.Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_ENUM 'Z' type=MyEnum.Z + FUN name:test visibility:public modality:FINAL <> ($this:MyEnum.Z.anObject.) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:MyEnum.Z.anObject. flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_ENUM 'Z' type=MyEnum.Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_ENUM 'Z' type=MyEnum.Z + 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: + CALL 'constructor ()' type=MyEnum.Z.anObject. origin=OBJECT_LITERAL + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:MyEnum.Z) returnType:kotlin.Any flags: + correspondingProperty: PROPERTY name:anObject visibility:public modality:FINAL flags:val + $this: VALUE_PARAMETER name: type:MyEnum.Z flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Any' + GET_FIELD 'anObject: Any' type=kotlin.Any origin=null + receiver: GET_VAR 'this@Z: Z' type=MyEnum.Z origin=null + FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Any flags: + overridden: + FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Any flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Unit flags: + overridden: + FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:java.lang.Class? flags: + overridden: + FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:java.lang.Class? flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:MyEnum) returnType:kotlin.Int flags: + overridden: + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:MyEnum) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + VALUE_PARAMETER name:other index:0 type:MyEnum flags: + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean flags: + overridden: + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + overridden: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL flags:val + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String flags: + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL flags:val + overridden: + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL flags:val + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL flags:val + overridden: + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum) returnType:kotlin.String flags: + overridden: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Any flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Any flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Unit flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:java.lang.Class? flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:java.lang.Class? flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:MyEnum) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:E) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + VALUE_PARAMETER name:other index:0 type:MyEnum flags: + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL flags:val + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String flags: + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL flags:val + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL flags:val + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL flags:val + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum) returnType:kotlin.String flags: + overridden: + FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum) returnType:kotlin.String flags: + $this: VALUE_PARAMETER name: type:kotlin.Enum flags: + FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array flags: + SYNTHETIC_BODY kind=ENUM_VALUES + FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:MyEnum flags: + VALUE_PARAMETER name:value index:0 type:kotlin.String flags: + SYNTHETIC_BODY kind=ENUM_VALUEOF diff --git a/compiler/testData/ir/irText/expressions/objectReference.kt b/compiler/testData/ir/irText/expressions/objectReference.kt new file mode 100644 index 00000000000..43b651d8520 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReference.kt @@ -0,0 +1,57 @@ +object Z { + var counter = 0 + fun foo() {} + + fun bar() { + counter = 1 + foo() + Z.counter = 1 + Z.foo() + } + + class Nested { + init { + counter = 1 + foo() + Z.counter = 1 + Z.foo() + } + + fun test() { + counter = 1 + foo() + Z.counter = 1 + Z.foo() + } + } + + val aLambda = { + counter = 1 + foo() + Z.counter = 1 + Z.foo() + } + + val anObject = object { + init { + counter = 1 + foo() + Z.counter = 1 + Z.foo() + } + + fun test() { + counter = 1 + foo() + Z.counter = 1 + Z.foo() + } + } +} + +fun Z.test() { + counter = 1 + foo() + Z.counter = 1 + Z.foo() +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/objectReference.txt b/compiler/testData/ir/irText/expressions/objectReference.txt new file mode 100644 index 00000000000..e71fdbfec11 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/objectReference.txt @@ -0,0 +1,193 @@ +FILE fqName: fileName:/objectReference.kt + CLASS OBJECT name:Z modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:Z flags: + CONSTRUCTOR visibility:private <> () returnType:Z flags:primary + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Z' + PROPERTY name:counter visibility:public modality:FINAL flags:var + FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public flags: + EXPRESSION_BODY + CONST Int type=kotlin.Int value=0 + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Z) returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:counter visibility:public modality:FINAL flags:var + $this: VALUE_PARAMETER name: type:Z flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'counter: Int' type=kotlin.Int origin=null + receiver: GET_VAR 'this@Z: Z' type=Z origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Z, :kotlin.Int) returnType:kotlin.Unit flags: + correspondingProperty: PROPERTY name:counter visibility:public modality:FINAL flags:var + $this: VALUE_PARAMETER name: type:Z flags: + VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + BLOCK_BODY + SET_FIELD 'counter: Int' type=kotlin.Unit origin=null + receiver: GET_VAR 'this@Z: Z' type=Z origin=null + value: GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + FUN name:foo visibility:public modality:FINAL <> ($this:Z) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:Z flags: + BLOCK_BODY + FUN name:bar visibility:public modality:FINAL <> ($this:Z) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:Z flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_VAR 'this@Z: Z' type=Z origin=null + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR 'this@Z: Z' type=Z origin=null + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + CLASS CLASS name:Nested modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:Z.Nested flags: + CONSTRUCTOR visibility:public <> () returnType:Z.Nested flags:primary + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Nested' + ANONYMOUS_INITIALIZER Nested + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + FUN name:test visibility:public modality:FINAL <> ($this:Z.Nested) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:Z.Nested flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + 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:aLambda visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:aLambda type:() -> kotlin.Unit visibility:public flags:final + EXPRESSION_BODY + BLOCK type=() -> kotlin.Unit origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + RETURN type=kotlin.Nothing from='(): Unit' + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + FUNCTION_REFERENCE '(): Unit' type=() -> kotlin.Unit origin=LAMBDA + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Z) returnType:() -> kotlin.Unit flags: + correspondingProperty: PROPERTY name:aLambda visibility:public modality:FINAL flags:val + $this: VALUE_PARAMETER name: type:Z flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): () -> Unit' + GET_FIELD 'aLambda: () -> Unit' type=() -> kotlin.Unit origin=null + receiver: GET_VAR 'this@Z: Z' type=Z origin=null + PROPERTY name:anObject visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:anObject type:kotlin.Any visibility:public flags:final + EXPRESSION_BODY + BLOCK type=Z.anObject. origin=OBJECT_LITERAL + CLASS CLASS name: modality:FINAL visibility:local flags: superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:Z.anObject. flags: + CONSTRUCTOR visibility:public <> () returnType:Z.anObject. flags:primary + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='' + ANONYMOUS_INITIALIZER + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + FUN name:test visibility:public modality:FINAL <> ($this:Z.anObject.) returnType:kotlin.Unit flags: + $this: VALUE_PARAMETER name: type:Z.anObject. flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z + 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: + CALL 'constructor ()' type=Z.anObject. origin=OBJECT_LITERAL + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Z) returnType:kotlin.Any flags: + correspondingProperty: PROPERTY name:anObject visibility:public modality:FINAL flags:val + $this: VALUE_PARAMETER name: type:Z flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Any' + GET_FIELD 'anObject: Any' type=kotlin.Any origin=null + receiver: GET_VAR 'this@Z: Z' type=Z origin=null + 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: + FUN name:test visibility:public modality:FINAL <> ($receiver:Z) returnType:kotlin.Unit flags: + $receiver: VALUE_PARAMETER name: type:Z flags: + BLOCK_BODY + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_VAR 'this@test: Z' type=Z origin=null + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_VAR 'this@test: Z' type=Z origin=null + CALL '(Int): Unit' type=kotlin.Unit origin=EQ + $this: GET_OBJECT 'Z' type=Z + : CONST Int type=kotlin.Int value=1 + CALL 'foo(): Unit' type=kotlin.Unit origin=null + $this: GET_OBJECT 'Z' type=Z diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index f9a6474c8bf..44cb50fe150 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -812,6 +812,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/enumEntryAsReceiver.kt"); } + @TestMetadata("enumEntryReferenceFromEnumEntryClass.kt") + public void testEnumEntryReferenceFromEnumEntryClass() throws Exception { + runTest("compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.kt"); + } + @TestMetadata("equality.kt") public void testEquality() throws Exception { runTest("compiler/testData/ir/irText/expressions/equality.kt"); @@ -967,6 +972,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/objectClassReference.kt"); } + @TestMetadata("objectReference.kt") + public void testObjectReference() throws Exception { + runTest("compiler/testData/ir/irText/expressions/objectReference.kt"); + } + @TestMetadata("outerClassInstanceReference.kt") public void testOuterClassInstanceReference() throws Exception { runTest("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");