Generate explicit call to 'Any()' if no superclass found.

Generate call super-constructor calls as IrDelegatedConstructorCall.
This commit is contained in:
Dmitry Petrov
2016-09-05 09:20:09 +03:00
committed by Dmitry Petrov
parent 535ddd639f
commit 28b3ea27f3
41 changed files with 156 additions and 30 deletions
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny
import java.lang.AssertionError
import java.util.*
@@ -177,16 +178,27 @@ class BodyGenerator(val scopeOwner: DeclarationDescriptor, override val context:
irBlockBody.addStatement(generateEnumEntrySuperConstructorCall(ktClassOrObject as KtEnumEntry, classDescriptor))
}
else -> {
val ktSuperTypeList = ktClassOrObject.getSuperTypeList() ?: return
for (ktSuperTypeListEntry in ktSuperTypeList.entries) {
if (ktSuperTypeListEntry is KtSuperTypeCallEntry) {
val statementGenerator = createStatementGenerator()
val superConstructorCall = statementGenerator.pregenerateCall(getResolvedCall(ktSuperTypeListEntry)!!)
val irSuperConstructorCall = CallGenerator(statementGenerator).generateCall(
ktSuperTypeListEntry, superConstructorCall, IrOperator.SUPER_CONSTRUCTOR_CALL)
irBlockBody.addStatement(irSuperConstructorCall)
val statementGenerator = createStatementGenerator()
ktClassOrObject.getSuperTypeList()?.let { ktSuperTypeList ->
for (ktSuperTypeListEntry in ktSuperTypeList.entries) {
if (ktSuperTypeListEntry is KtSuperTypeCallEntry) {
val superConstructorCall = statementGenerator.pregenerateCall(getResolvedCall(ktSuperTypeListEntry)!!)
val irSuperConstructorCall = CallGenerator(statementGenerator).generateDelegatingConstructorCall(
ktSuperTypeListEntry.startOffset, ktSuperTypeListEntry.endOffset, superConstructorCall)
irBlockBody.addStatement(irSuperConstructorCall)
return
}
}
}
// If we are here, we didn't find a superclass entry in super types.
// Thus, super class should be Any.
val superClass = classDescriptor.getSuperClassOrAny()
assert(KotlinBuiltIns.isAny(superClass)) { "$classDescriptor: Super class should be any: $superClass" }
val superConstructor = superClass.constructors.single()
irBlockBody.addStatement(IrDelegatingConstructorCallImpl(ktClassOrObject.startOffset, ktClassOrObject.endOffset,
superConstructor))
}
}
}
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
interface IrDelegatingConstructorCall : IrGeneralCall {
override val descriptor: ConstructorDescriptor
@@ -28,7 +27,7 @@ class IrDelegatingConstructorCallImpl(
startOffset: Int,
endOffset: Int,
override val descriptor: ConstructorDescriptor
) : IrGeneralCallBase(startOffset, endOffset, descriptor.builtIns.unitType, descriptor.valueParameters.size), IrDelegatingConstructorCall {
) : IrGeneralCallBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size), IrDelegatingConstructorCall {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitDelegatingConstructorCall(this, data)
}
@@ -89,7 +89,6 @@ interface IrOperator {
object ANONYMOUS_FUNCTION : IrOperatorImpl("ANONYMOUS_FUNCTION")
object OBJECT_LITERAL : IrOperatorImpl("OBJECT_LITERAL")
object SUPER_CONSTRUCTOR_CALL : IrOperatorImpl("SUPER_CONSTRUCTOR_CALL")
object INITIALIZE_PROPERTY_FROM_PARAMETER : IrOperatorImpl("INITIALIZE_PROPERTY_FROM_PARAMETER")
object PROPERTY_REFERENCE_FOR_DELEGATE : IrOperatorImpl("PROPERTY_REFERENCE_FOR_DELEGATE")
@@ -2,6 +2,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
@@ -21,7 +22,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
GET_VAR yy type=kotlin.Int operator=null
VAR val tmp1_x: kotlin.Int
GET_VAR xx type=kotlin.Int operator=null
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Base
x: GET_VAR tmp1_x type=kotlin.Int operator=null
y: GET_VAR tmp0_y type=kotlin.Int operator=null
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
@@ -33,10 +34,9 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
GET_VAR yy type=kotlin.Int operator=null
VAR val tmp1_x: kotlin.Int
GET_VAR xx type=kotlin.Int operator=null
TYPE_OP operator=IMPLICIT_CAST typeOperand=Base
DELEGATING_CONSTRUCTOR_CALL Base
x: GET_VAR tmp1_x type=kotlin.Int operator=null
y: GET_VAR tmp0_y type=kotlin.Int operator=null
DELEGATING_CONSTRUCTOR_CALL Base
x: GET_VAR tmp1_x type=kotlin.Int operator=null
y: GET_VAR tmp0_y type=kotlin.Int operator=null
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
CONSTRUCTOR public constructor Test2(/*0*/ xxx: kotlin.Int, /*1*/ yyy: kotlin.Int, /*2*/ a: kotlin.Any)
BLOCK_BODY
@@ -45,7 +45,6 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
GET_VAR yyy type=kotlin.Int operator=null
VAR val tmp1_xx: kotlin.Int
GET_VAR xxx type=kotlin.Int operator=null
TYPE_OP operator=IMPLICIT_CAST typeOperand=Test2
DELEGATING_CONSTRUCTOR_CALL Test2
xx: GET_VAR tmp1_xx type=kotlin.Int operator=null
yy: GET_VAR tmp0_yy type=kotlin.Int operator=null
DELEGATING_CONSTRUCTOR_CALL Test2
xx: GET_VAR tmp1_xx type=kotlin.Int operator=null
yy: GET_VAR tmp0_yy type=kotlin.Int operator=null
+3
View File
@@ -4,6 +4,7 @@ FILE /classMembers.kt
z: EXPRESSION_BODY
CONST Int type=kotlin.Int value='1'
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD z type=kotlin.Unit operator=null
@@ -51,6 +52,7 @@ FILE /classMembers.kt
CLASS CLASS NestedClass
CONSTRUCTOR public constructor NestedClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=NestedClass
FUN public final fun function(): kotlin.Unit
BLOCK_BODY
@@ -70,4 +72,5 @@ FILE /classMembers.kt
CLASS OBJECT Companion
CONSTRUCTOR private constructor Companion()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Companion
+3
View File
@@ -2,15 +2,18 @@ FILE /classes.kt
CLASS CLASS TestClass
CONSTRUCTOR public constructor TestClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestClass
CLASS INTERFACE TestInterface
CLASS OBJECT TestObject
CONSTRUCTOR private constructor TestObject()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestObject
CLASS ANNOTATION_CLASS TestAnnotationClass
CONSTRUCTOR public constructor TestAnnotationClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestAnnotationClass
CLASS ENUM_CLASS TestEnumClass
CONSTRUCTOR private constructor TestEnumClass()
@@ -2,16 +2,20 @@ FILE /companionObject.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
CLASS OBJECT Companion
CONSTRUCTOR private constructor Companion()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Companion
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
CLASS OBJECT Named
CONSTRUCTOR private constructor Named()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Named
+1
View File
@@ -2,6 +2,7 @@ FILE /dataClasses.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String, /*2*/ z: kotlin.Any)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
@@ -6,6 +6,7 @@ FILE /delegatedImplementation.kt
CLASS OBJECT BaseImpl
CONSTRUCTOR private constructor BaseImpl()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=BaseImpl
FUN public open override /*1*/ fun foo(/*0*/ x: kotlin.Int, /*1*/ s: kotlin.String): kotlin.Unit
BLOCK_BODY
@@ -27,6 +28,7 @@ FILE /delegatedImplementation.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
PROPERTY public open override /*1*/ val x: kotlin.String
EXPRESSION_BODY
@@ -50,6 +52,7 @@ FILE /delegatedImplementation.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
PROPERTY val `Test1$IBase$delegate`: BaseImpl
EXPRESSION_BODY
@@ -73,6 +76,7 @@ FILE /delegatedImplementation.kt
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
PROPERTY val `Test2$IBase$delegate`: BaseImpl
EXPRESSION_BODY
@@ -5,6 +5,7 @@ FILE /delegatedImplementationWithExplicitOverride.kt
CLASS OBJECT FooBarImpl
CONSTRUCTOR private constructor FooBarImpl()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=FooBarImpl
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
@@ -13,6 +14,7 @@ FILE /delegatedImplementationWithExplicitOverride.kt
CLASS CLASS C
CONSTRUCTOR public constructor C()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY val `C$IFooBar$delegate`: FooBarImpl
EXPRESSION_BODY
@@ -2,6 +2,7 @@ FILE /delegatingConstructorCallsInSecondaryConstructors.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS CLASS Test
CONSTRUCTOR public constructor Test()
+12
View File
@@ -28,4 +28,16 @@ class Test4 {
init {
println("2")
}
}
class Test5 {
init {
println("1")
}
inner class TestInner {
init {
println("2")
}
}
}
+20
View File
@@ -2,6 +2,7 @@ FILE /initBlock.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
ANONYMOUS_INITIALIZER Test1
BLOCK_BODY
@@ -9,6 +10,7 @@ FILE /initBlock.kt
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2(/*0*/ x: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
@@ -39,3 +41,21 @@ FILE /initBlock.kt
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: CONST String type=kotlin.String value='2'
CLASS CLASS Test5
CONSTRUCTOR public constructor Test5()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Test5
ANONYMOUS_INITIALIZER Test5
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: CONST String type=kotlin.String value='1'
CLASS CLASS TestInner
CONSTRUCTOR public constructor TestInner()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInner
ANONYMOUS_INITIALIZER TestInner
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: CONST String type=kotlin.String value='2'
+3
View File
@@ -2,6 +2,7 @@ FILE /initVal.kt
CLASS CLASS TestInitValFromParameter
CONSTRUCTOR public constructor TestInitValFromParameter(/*0*/ x: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValFromParameter
@@ -11,6 +12,7 @@ FILE /initVal.kt
CLASS CLASS TestInitValInClass
CONSTRUCTOR public constructor TestInitValInClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValInClass
PROPERTY public final val x: kotlin.Int = 0
EXPRESSION_BODY
@@ -18,6 +20,7 @@ FILE /initVal.kt
CLASS CLASS TestInitValInInitBlock
CONSTRUCTOR public constructor TestInitValInInitBlock()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValInInitBlock
PROPERTY public final val x: kotlin.Int
ANONYMOUS_INITIALIZER TestInitValInInitBlock
+4
View File
@@ -2,6 +2,7 @@ FILE /initVar.kt
CLASS CLASS TestInitVarFromParameter
CONSTRUCTOR public constructor TestInitVarFromParameter(/*0*/ x: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarFromParameter
@@ -11,6 +12,7 @@ FILE /initVar.kt
CLASS CLASS TestInitVarInClass
CONSTRUCTOR public constructor TestInitVarInClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarInClass
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
@@ -18,6 +20,7 @@ FILE /initVar.kt
CLASS CLASS TestInitVarInInitBlock
CONSTRUCTOR public constructor TestInitVarInInitBlock()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarInInitBlock
PROPERTY public final var x: kotlin.Int
ANONYMOUS_INITIALIZER TestInitVarInInitBlock
@@ -28,6 +31,7 @@ FILE /initVar.kt
CLASS CLASS TestInitVarWithCustomSetter
CONSTRUCTOR public constructor TestInitVarWithCustomSetter()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarWithCustomSetter
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
+5
View File
@@ -0,0 +1,5 @@
class Outer {
open inner class TestInnerClass
inner class DerivedInnerClass : TestInnerClass()
}
+17
View File
@@ -0,0 +1,17 @@
FILE /innerClass.kt
CLASS CLASS Outer
CONSTRUCTOR public constructor Outer()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Outer
CLASS CLASS TestInnerClass
CONSTRUCTOR public constructor TestInnerClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestInnerClass
CLASS CLASS DerivedInnerClass
CONSTRUCTOR public constructor DerivedInnerClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL TestInnerClass
$this: THIS public final class Outer type=Outer
INSTANCE_INITIALIZER_CALL classDescriptor=DerivedInnerClass
+1
View File
@@ -4,6 +4,7 @@ FILE /localClasses.kt
CLASS CLASS LocalClass
CONSTRUCTOR public constructor LocalClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=LocalClass
FUN public final fun foo(): kotlin.Unit
BLOCK_BODY
@@ -7,6 +7,7 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
CALL .<init> type=test1.<no name provided> operator=OBJECT_LITERAL
PROPERTY public val test2: IFoo
@@ -15,6 +16,7 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
@@ -24,10 +26,12 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS Outer
CONSTRUCTOR public constructor Outer()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Outer
CLASS CLASS Inner
CONSTRUCTOR public constructor Inner()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Inner
FUN public final fun test3(): Outer.Inner
BLOCK_BODY
@@ -36,7 +40,7 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
CALL .<init> type=Outer.Inner operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Inner
$this: THIS public final class Outer type=Outer
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
FUN public open override /*1*/ fun foo(): kotlin.Unit
@@ -51,7 +55,7 @@ FILE /objectLiteralExpressions.kt
CLASS CLASS <no name provided>
CONSTRUCTOR public constructor <no name provided>()
BLOCK_BODY
CALL .<init> type=Outer.Inner operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Inner
$this: $RECEIVER of: test4 type=Outer
INSTANCE_INITIALIZER_CALL classDescriptor=<no name provided>
FUN public open override /*1*/ fun foo(): kotlin.Unit
@@ -2,11 +2,12 @@ FILE /objectWithInitializers.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS OBJECT Test
CONSTRUCTOR private constructor Test()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Base
INSTANCE_INITIALIZER_CALL classDescriptor=Test
PROPERTY public final val x: kotlin.Int = 1
EXPRESSION_BODY
@@ -2,6 +2,7 @@ FILE /primaryConstructor.kt
CLASS CLASS Test1
CONSTRUCTOR public constructor Test1(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
@@ -16,6 +17,7 @@ FILE /primaryConstructor.kt
CLASS CLASS Test2
CONSTRUCTOR public constructor Test2(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
@@ -28,6 +30,7 @@ FILE /primaryConstructor.kt
CLASS CLASS Test3
CONSTRUCTOR public constructor Test3(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test3
@@ -2,21 +2,22 @@ FILE /primaryConstructorWithSuperConstructorCall.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS CLASS TestImplicitPrimaryConstructor
CONSTRUCTOR public constructor TestImplicitPrimaryConstructor()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Base
INSTANCE_INITIALIZER_CALL classDescriptor=TestImplicitPrimaryConstructor
CLASS CLASS TestExplicitPrimaryConstructor
CONSTRUCTOR public constructor TestExplicitPrimaryConstructor()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Base
INSTANCE_INITIALIZER_CALL classDescriptor=TestExplicitPrimaryConstructor
CLASS CLASS TestWithDelegatingConstructor
CONSTRUCTOR public constructor TestWithDelegatingConstructor(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Base
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
@@ -18,6 +18,7 @@ FILE /qualifiedSuperCalls.kt
CLASS CLASS CBoth
CONSTRUCTOR public constructor CBoth()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=CBoth
FUN public open override /*2*/ fun foo(): kotlin.Unit
BLOCK_BODY
+4 -3
View File
@@ -2,11 +2,12 @@ FILE /sealedClasses.kt
CLASS CLASS Expr
CONSTRUCTOR private constructor Expr()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Expr
CLASS CLASS Const
CONSTRUCTOR public constructor Const(/*0*/ number: kotlin.Double)
BLOCK_BODY
CALL .<init> type=Expr operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Expr
SET_BACKING_FIELD number type=kotlin.Unit operator=null
GET_VAR number type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Const
@@ -16,7 +17,7 @@ FILE /sealedClasses.kt
CLASS CLASS Sum
CONSTRUCTOR public constructor Sum(/*0*/ e1: Expr, /*1*/ e2: Expr)
BLOCK_BODY
CALL .<init> type=Expr operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Expr
SET_BACKING_FIELD e1 type=kotlin.Unit operator=null
GET_VAR e1 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD e2 type=kotlin.Unit operator=null
@@ -31,5 +32,5 @@ FILE /sealedClasses.kt
CLASS OBJECT NotANumber
CONSTRUCTOR private constructor NotANumber()
BLOCK_BODY
CALL .<init> type=Expr operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Expr
INSTANCE_INITIALIZER_CALL classDescriptor=NotANumber
@@ -2,6 +2,7 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Base
CLASS CLASS TestProperty
PROPERTY public final val x: kotlin.Int = 0
+2 -1
View File
@@ -2,6 +2,7 @@ FILE /superCalls.kt
CLASS CLASS Base
CONSTRUCTOR public constructor Base()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Base
FUN public open fun foo(): kotlin.Unit
BLOCK_BODY
@@ -11,7 +12,7 @@ FILE /superCalls.kt
CLASS CLASS Derived
CONSTRUCTOR public constructor Derived()
BLOCK_BODY
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
DELEGATING_CONSTRUCTOR_CALL Base
INSTANCE_INITIALIZER_CALL classDescriptor=Derived
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
@@ -19,6 +19,7 @@ FILE /delegatedProperties.kt
CLASS CLASS C
CONSTRUCTOR public constructor C(/*0*/ map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any>)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD map type=kotlin.Unit operator=null
GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
@@ -6,5 +6,6 @@ FILE /typeAlias.kt
CLASS CLASS C
CONSTRUCTOR public constructor C()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=C
TYPEALIAS TestNested type=kotlin.String
@@ -14,6 +14,7 @@ FILE /arrayAugmentedAssignment1.kt
CLASS CLASS C
CONSTRUCTOR public constructor C(/*0*/ x: kotlin.IntArray)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
@@ -2,6 +2,7 @@ FILE /assignments.kt
CLASS CLASS Ref
CONSTRUCTOR public constructor Ref(/*0*/ x: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Ref
@@ -2,6 +2,7 @@ FILE /augmentedAssignment2.kt
CLASS CLASS A
CONSTRUCTOR public constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=A
FUN public operator fun A.plusAssign(/*0*/ s: kotlin.String): kotlin.Unit
BLOCK_BODY
@@ -2,6 +2,7 @@ FILE /chainOfSafeCalls.kt
CLASS CLASS C
CONSTRUCTOR public constructor C()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=C
FUN public final fun foo(): C
BLOCK_BODY
@@ -2,10 +2,12 @@ FILE /forWithImplicitReceivers.kt
CLASS OBJECT FiveTimes
CONSTRUCTOR private constructor FiveTimes()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=FiveTimes
CLASS CLASS IntCell
CONSTRUCTOR public constructor IntCell(/*0*/ value: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD value type=kotlin.Unit operator=null
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=IntCell
@@ -23,6 +23,7 @@ FILE /jvmStaticFieldReference.kt
CLASS CLASS TestClass
CONSTRUCTOR public constructor TestClass()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=TestClass
PROPERTY public final val test: kotlin.Int
EXPRESSION_BODY
@@ -2,6 +2,7 @@ FILE /reflectionLiterals.kt
CLASS CLASS A
CONSTRUCTOR public constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=A
FUN public final fun foo(): kotlin.Unit
BLOCK_BODY
@@ -2,6 +2,7 @@ FILE /safeCallWithIncrementDecrement.kt
CLASS CLASS C
CONSTRUCTOR public constructor C()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public var test.C?.p: kotlin.Int
PROPERTY_GETTER public fun test.C?.<get-p>(): kotlin.Int
+1
View File
@@ -2,6 +2,7 @@ FILE /safeCalls.kt
CLASS CLASS Ref
CONSTRUCTOR public constructor Ref(/*0*/ value: kotlin.Int)
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD value type=kotlin.Unit operator=null
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Ref
+3
View File
@@ -13,6 +13,7 @@ FILE /values.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=A
PROPERTY public val a: kotlin.Int = 0
EXPRESSION_BODY
@@ -20,10 +21,12 @@ FILE /values.kt
CLASS CLASS Z
CONSTRUCTOR public constructor Z()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Z
CLASS OBJECT Companion
CONSTRUCTOR private constructor Companion()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=Companion
FUN public fun test1(): Enum
BLOCK_BODY
+1
View File
@@ -2,6 +2,7 @@ FILE /when.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=A
FUN public fun testWithSubject(/*0*/ x: kotlin.Any?): kotlin.String
BLOCK_BODY
@@ -2,10 +2,12 @@ FILE /multipleImplicitReceivers.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=A
CLASS OBJECT B
CONSTRUCTOR private constructor B()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=B
CLASS INTERFACE IFoo
PROPERTY public open val A.foo: B
@@ -115,6 +115,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
doTest(fileName);
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/innerClass.kt");
doTest(fileName);
}
@TestMetadata("localClasses.kt")
public void testLocalClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/localClasses.kt");