diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt index dcf9a471979..86411fcc5ff 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrClass.kt @@ -35,6 +35,7 @@ interface IrClass : IrSymbolDeclaration, IrDeclarationContainer, val isInner: Boolean val isData: Boolean val isExternal: Boolean + val isInline: Boolean val superTypes: MutableList diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt index d1dc13728cf..9f488cd01d9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/impl/IrClassImpl.kt @@ -43,7 +43,8 @@ class IrClassImpl( override val isCompanion: Boolean, override val isInner: Boolean, override val isData: Boolean, - override val isExternal: Boolean + override val isExternal: Boolean, + override val isInline: Boolean ) : IrDeclarationBase(startOffset, endOffset, origin), IrClass { @@ -61,7 +62,8 @@ class IrClassImpl( isCompanion = symbol.descriptor.isCompanionObject, isInner = symbol.descriptor.isInner, isData = symbol.descriptor.isData, - isExternal = symbol.descriptor.isEffectivelyExternal() + isExternal = symbol.descriptor.isEffectivelyExternal(), + isInline = symbol.descriptor.isInline ) constructor( diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyClass.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyClass.kt index fceb7d14bc2..d6510bdec68 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyClass.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyClass.kt @@ -34,6 +34,7 @@ class IrLazyClass( override val isInner: Boolean, override val isData: Boolean, override val isExternal: Boolean, + override val isInline: Boolean, stubGenerator: DeclarationStubGenerator, typeTranslator: TypeTranslator ) : @@ -56,6 +57,7 @@ class IrLazyClass( isInner = symbol.descriptor.isInner, isData = symbol.descriptor.isData, isExternal = symbol.descriptor.isEffectivelyExternal(), + isInline = symbol.descriptor.isInline, stubGenerator = stubGenerator, typeTranslator = TypeTranslator ) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt index 736a5bc7342..db2e347c87a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/RenderIrElement.kt @@ -139,7 +139,8 @@ class RenderIrElementVisitor : IrElementVisitor { "companion".takeIf { isCompanion }, "inner".takeIf { isInner }, "data".takeIf { isData }, - "external".takeIf { isExternal } + "external".takeIf { isExternal }, + "inline".takeIf { isInline } ) override fun visitTypeAlias(declaration: IrTypeAlias, data: Nothing?): String = diff --git a/compiler/testData/ir/irText/classes/inlineClass.kt b/compiler/testData/ir/irText/classes/inlineClass.kt new file mode 100644 index 00000000000..7e09b3520cd --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClass.kt @@ -0,0 +1,3 @@ +// !LANGUAGE: +InlineClasses + +inline class Test(val x: Int) \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/inlineClass.txt b/compiler/testData/ir/irText/classes/inlineClass.txt new file mode 100644 index 00000000000..b8ebb160bb7 --- /dev/null +++ b/compiler/testData/ir/irText/classes/inlineClass.txt @@ -0,0 +1,19 @@ +FILE fqName: fileName:/inlineClass.kt + CLASS CLASS name:Test modality:FINAL visibility:public flags:inline superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test flags: + CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:Test flags:primary + VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + INSTANCE_INITIALIZER_CALL classDescriptor='Test' + PROPERTY name:x visibility:public modality:FINAL flags:val + FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public flags:final + EXPRESSION_BODY + GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Test) returnType:kotlin.Int flags: + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL flags:val + $this: VALUE_PARAMETER name: type:Test flags: + BLOCK_BODY + RETURN type=kotlin.Nothing from='(): Int' + GET_FIELD 'x: Int' type=kotlin.Int origin=null + receiver: GET_VAR 'this@Test: Test' type=Test origin=null diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.txt index 7bab93b3b0d..e771110a1ab 100644 --- a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.txt +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.txt @@ -99,35 +99,35 @@ FILE fqName: fileName:/signedToUnsignedConversions_test.kt BLOCK_BODY CALL 'takeUByte(UByte): Unit' type=kotlin.Unit origin=null u: TYPE_OP type=kotlin.UByte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UByte - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CALL 'takeUByte(UByte): Unit' type=kotlin.Unit origin=null u: TYPE_OP type=kotlin.UByte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UByte - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CALL 'takeUShort(UShort): Unit' type=kotlin.Unit origin=null u: TYPE_OP type=kotlin.UShort origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UShort - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UShort modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UShort modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CALL 'takeUShort(UShort): Unit' type=kotlin.Unit origin=null u: TYPE_OP type=kotlin.UShort origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UShort - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UShort modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UShort modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CALL 'takeUInt(UInt): Unit' type=kotlin.Unit origin=null u: TYPE_OP type=kotlin.UInt origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UInt - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UInt modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UInt modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CALL 'takeULong(ULong): Unit' type=kotlin.Unit origin=null u: TYPE_OP type=kotlin.ULong origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.ULong - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:ULong modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:ULong modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CALL 'takeUBytes(vararg UByte): Unit' type=kotlin.Unit origin=null u: VARARG type=kotlin.UByteArray varargElementType=kotlin.UByte TYPE_OP type=kotlin.UByte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UByte - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY TYPE_OP type=kotlin.UByte origin=IMPLICIT_INTEGER_COERCION typeOperand=kotlin.UByte - typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags: superTypes:[kotlin.Comparable] + typeOperand: CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:UByte modality:FINAL visibility:public flags:inline superTypes:[kotlin.Comparable] CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY CONST Byte type=kotlin.UByte value=42 CALL 'takeLong(Long): Unit' type=kotlin.Unit origin=null diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 22ce50d1118..b6f8de2ee70 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -131,6 +131,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/classes/initVar.kt"); } + @TestMetadata("inlineClass.kt") + public void testInlineClass() throws Exception { + runTest("compiler/testData/ir/irText/classes/inlineClass.kt"); + } + @TestMetadata("innerClass.kt") public void testInnerClass() throws Exception { runTest("compiler/testData/ir/irText/classes/innerClass.kt");