Make coercion to Unit explicit in IR.
This commit is contained in:
committed by
Dmitry Petrov
parent
233a979932
commit
1c2a676cd6
+4
-3
@@ -77,7 +77,8 @@ fun StatementGenerator.generateCallReceiver(
|
|||||||
ktDefaultElement: KtElement,
|
ktDefaultElement: KtElement,
|
||||||
dispatchReceiver: ReceiverValue?,
|
dispatchReceiver: ReceiverValue?,
|
||||||
extensionReceiver: ReceiverValue?,
|
extensionReceiver: ReceiverValue?,
|
||||||
isSafe: Boolean
|
isSafe: Boolean,
|
||||||
|
isAssignmentReceiver: Boolean = false
|
||||||
) : CallReceiver {
|
) : CallReceiver {
|
||||||
val dispatchReceiverValue = generateReceiverOrNull(ktDefaultElement, dispatchReceiver)
|
val dispatchReceiverValue = generateReceiverOrNull(ktDefaultElement, dispatchReceiver)
|
||||||
val extensionReceiverValue = generateReceiverOrNull(ktDefaultElement, extensionReceiver)
|
val extensionReceiverValue = generateReceiverOrNull(ktDefaultElement, extensionReceiver)
|
||||||
@@ -87,10 +88,10 @@ fun StatementGenerator.generateCallReceiver(
|
|||||||
SimpleCallReceiver(dispatchReceiverValue, extensionReceiverValue)
|
SimpleCallReceiver(dispatchReceiverValue, extensionReceiverValue)
|
||||||
extensionReceiverValue != null ->
|
extensionReceiverValue != null ->
|
||||||
SafeCallReceiver(this, ktDefaultElement.startOffset, ktDefaultElement.endOffset,
|
SafeCallReceiver(this, ktDefaultElement.startOffset, ktDefaultElement.endOffset,
|
||||||
extensionReceiverValue.load(), dispatchReceiverValue)
|
extensionReceiverValue.load(), dispatchReceiverValue, isAssignmentReceiver)
|
||||||
dispatchReceiverValue != null ->
|
dispatchReceiverValue != null ->
|
||||||
SafeCallReceiver(this, ktDefaultElement.startOffset, ktDefaultElement.endOffset,
|
SafeCallReceiver(this, ktDefaultElement.startOffset, ktDefaultElement.endOffset,
|
||||||
dispatchReceiverValue.load(), null)
|
dispatchReceiverValue.load(), null, isAssignmentReceiver)
|
||||||
else ->
|
else ->
|
||||||
throw AssertionError("Safe call should have an explicit receiver: ${ktDefaultElement.text}")
|
throw AssertionError("Safe call should have an explicit receiver: ${ktDefaultElement.text}")
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -145,7 +145,9 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen
|
|||||||
}
|
}
|
||||||
|
|
||||||
val propertyReceiver = statementGenerator.generateCallReceiver(
|
val propertyReceiver = statementGenerator.generateCallReceiver(
|
||||||
ktLeft, resolvedCall.dispatchReceiver, resolvedCall.extensionReceiver, resolvedCall.call.isSafeCall())
|
ktLeft, resolvedCall.dispatchReceiver, resolvedCall.extensionReceiver,
|
||||||
|
isSafe = resolvedCall.call.isSafeCall(),
|
||||||
|
isAssignmentReceiver = true)
|
||||||
|
|
||||||
val superQualifier = getSuperQualifier(resolvedCall)
|
val superQualifier = getSuperQualifier(resolvedCall)
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
import org.jetbrains.kotlin.psi2ir.intermediate.*
|
import org.jetbrains.kotlin.psi2ir.intermediate.*
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE
|
|||||||
val irCall = IrDelegatingConstructorCallImpl(startOffset, endOffset, descriptor, getTypeArguments(call.original))
|
val irCall = IrDelegatingConstructorCallImpl(startOffset, endOffset, descriptor, getTypeArguments(call.original))
|
||||||
irCall.dispatchReceiver = dispatchReceiver?.load()
|
irCall.dispatchReceiver = dispatchReceiver?.load()
|
||||||
irCall.extensionReceiver = extensionReceiver?.load()
|
irCall.extensionReceiver = extensionReceiver?.load()
|
||||||
addParametersToCall(startOffset, endOffset, call, irCall, descriptor.returnType)
|
addParametersToCall(startOffset, endOffset, call, irCall, descriptor.builtIns.unitType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
|||||||
import org.jetbrains.kotlin.psi2ir.generators.GeneratorWithScope
|
import org.jetbrains.kotlin.psi2ir.generators.GeneratorWithScope
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.constNull
|
import org.jetbrains.kotlin.psi2ir.generators.constNull
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.equalsNull
|
import org.jetbrains.kotlin.psi2ir.generators.equalsNull
|
||||||
|
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +32,8 @@ class SafeCallReceiver(
|
|||||||
val startOffset: Int,
|
val startOffset: Int,
|
||||||
val endOffset: Int,
|
val endOffset: Int,
|
||||||
val explicitReceiver: IrExpression,
|
val explicitReceiver: IrExpression,
|
||||||
val implicitDispatchReceiverValue: IntermediateValue?
|
val implicitDispatchReceiverValue: IntermediateValue?,
|
||||||
|
val isAssignmentReceiver: Boolean
|
||||||
) : CallReceiver {
|
) : CallReceiver {
|
||||||
override fun call(withDispatchAndExtensionReceivers: (IntermediateValue?, IntermediateValue?) -> IrExpression): IrExpression {
|
override fun call(withDispatchAndExtensionReceivers: (IntermediateValue?, IntermediateValue?) -> IrExpression): IrExpression {
|
||||||
val irTmp = generator.scope.createTemporaryVariable(explicitReceiver, "safe_receiver")
|
val irTmp = generator.scope.createTemporaryVariable(explicitReceiver, "safe_receiver")
|
||||||
@@ -49,7 +51,7 @@ class SafeCallReceiver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val irResult = withDispatchAndExtensionReceivers(dispatchReceiverValue, extensionReceiverValue)
|
val irResult = withDispatchAndExtensionReceivers(dispatchReceiverValue, extensionReceiverValue)
|
||||||
val resultType = irResult.type.makeNullable()
|
val resultType = if (isAssignmentReceiver) irResult.type.builtIns.unitType else irResult.type.makeNullable()
|
||||||
|
|
||||||
val irBlock = IrBlockImpl(startOffset, endOffset, resultType, IrStatementOrigin.SAFE_CALL)
|
val irBlock = IrBlockImpl(startOffset, endOffset, resultType, IrStatementOrigin.SAFE_CALL)
|
||||||
|
|
||||||
|
|||||||
+34
-6
@@ -56,17 +56,35 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementTransformerVoi
|
|||||||
return expression
|
return expression
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitBlock(expression: IrBlock): IrExpression {
|
override fun visitBlockBody(body: IrBlockBody): IrBody {
|
||||||
|
body.transformChildrenVoid(this)
|
||||||
|
|
||||||
|
body.statements.forEachIndexed { i, irStatement ->
|
||||||
|
if (irStatement is IrExpression) {
|
||||||
|
body.statements[i] = irStatement.coerceToUnit(builtIns.unitType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return body
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitContainerExpression(expression: IrContainerExpression): IrExpression {
|
||||||
expression.transformChildrenVoid(this)
|
expression.transformChildrenVoid(this)
|
||||||
|
|
||||||
val type = expression.type
|
val type = expression.type
|
||||||
if (expression.statements.isEmpty() || KotlinBuiltIns.isUnit(type) || KotlinBuiltIns.isNothing(type)) {
|
if (expression.statements.isEmpty()) {
|
||||||
return expression
|
return expression
|
||||||
}
|
}
|
||||||
|
|
||||||
val lastStatement = expression.statements.last()
|
val lastIndex = expression.statements.lastIndex
|
||||||
if (lastStatement is IrExpression) {
|
expression.statements.forEachIndexed { i, irStatement ->
|
||||||
expression.statements[expression.statements.lastIndex] = lastStatement.cast(type)
|
if (irStatement is IrExpression) {
|
||||||
|
expression.statements[i] =
|
||||||
|
if (i == lastIndex)
|
||||||
|
irStatement.cast(type)
|
||||||
|
else
|
||||||
|
irStatement.coerceToUnit(builtIns.unitType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return expression
|
return expression
|
||||||
@@ -169,8 +187,10 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementTransformerVoi
|
|||||||
|
|
||||||
private fun IrExpression.cast(expectedType: KotlinType?): IrExpression {
|
private fun IrExpression.cast(expectedType: KotlinType?): IrExpression {
|
||||||
if (expectedType == null) return this
|
if (expectedType == null) return this
|
||||||
|
|
||||||
if (expectedType.isError) return this
|
if (expectedType.isError) return this
|
||||||
if (KotlinBuiltIns.isUnit(expectedType)) return this // TODO expose coercion to Unit in IR?
|
|
||||||
|
if (KotlinBuiltIns.isUnit(expectedType)) return coerceToUnit(expectedType)
|
||||||
|
|
||||||
val valueType = this.type
|
val valueType = this.type
|
||||||
|
|
||||||
@@ -189,5 +209,13 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementTransformerVoi
|
|||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun IrExpression.coerceToUnit(unitType: KotlinType): IrExpression {
|
||||||
|
val valueType = this.type
|
||||||
|
|
||||||
|
if (KotlinTypeChecker.DEFAULT.isSubtypeOf(valueType, unitType)) return this
|
||||||
|
|
||||||
|
return IrTypeOperatorCallImpl(startOffset, endOffset, unitType, IrTypeOperator.IMPLICIT_COERCION_TO_UNIT, unitType, this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ enum class IrTypeOperator {
|
|||||||
CAST,
|
CAST,
|
||||||
IMPLICIT_CAST,
|
IMPLICIT_CAST,
|
||||||
IMPLICIT_NOTNULL,
|
IMPLICIT_NOTNULL,
|
||||||
|
IMPLICIT_COERCION_TO_UNIT,
|
||||||
SAFE_CAST,
|
SAFE_CAST,
|
||||||
INSTANCEOF,
|
INSTANCEOF,
|
||||||
NOT_INSTANCEOF;
|
NOT_INSTANCEOF;
|
||||||
|
|||||||
+2
-1
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall
|
import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
class IrDelegatingConstructorCallImpl(
|
class IrDelegatingConstructorCallImpl(
|
||||||
@@ -27,7 +28,7 @@ class IrDelegatingConstructorCallImpl(
|
|||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
override val descriptor: ConstructorDescriptor,
|
override val descriptor: ConstructorDescriptor,
|
||||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?
|
typeArguments: Map<TypeParameterDescriptor, KotlinType>?
|
||||||
) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size, typeArguments),
|
) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.builtIns.unitType, descriptor.valueParameters.size, typeArguments),
|
||||||
IrDelegatingConstructorCall {
|
IrDelegatingConstructorCall {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitDelegatingConstructorCall(this, data)
|
return visitor.visitDelegatingConstructorCall(this, data)
|
||||||
|
|||||||
+2
-1
@@ -20,13 +20,14 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrEnumConstructorCall
|
import org.jetbrains.kotlin.ir.expressions.IrEnumConstructorCall
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
|
|
||||||
class IrEnumConstructorCallImpl(
|
class IrEnumConstructorCallImpl(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
override val descriptor: ConstructorDescriptor,
|
override val descriptor: ConstructorDescriptor,
|
||||||
override val enumEntryDescriptor: ClassDescriptor? = null
|
override val enumEntryDescriptor: ClassDescriptor? = null
|
||||||
) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.returnType, descriptor.valueParameters.size, null),
|
) : IrCallWithIndexedArgumentsBase(startOffset, endOffset, descriptor.builtIns.unitType, descriptor.valueParameters.size, null),
|
||||||
IrEnumConstructorCall {
|
IrEnumConstructorCall {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitEnumConstructorCall(this, data)
|
return visitor.visitEnumConstructorCall(this, data)
|
||||||
|
|||||||
+3
-3
@@ -25,7 +25,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
|
|||||||
CLASS CLASS Test1
|
CLASS CLASS Test1
|
||||||
CONSTRUCTOR public constructor Test1(xx: kotlin.Int, yy: kotlin.Int)
|
CONSTRUCTOR public constructor Test1(xx: kotlin.Int, yy: kotlin.Int)
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=Base origin=ARGUMENTS_REORDERING_FOR_CALL
|
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int
|
||||||
GET_VAR 'value-parameter yy: Int' type=kotlin.Int origin=null
|
GET_VAR 'value-parameter yy: Int' type=kotlin.Int origin=null
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1_x: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp1_x: kotlin.Int
|
||||||
@@ -37,7 +37,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
|
|||||||
CLASS CLASS Test2
|
CLASS CLASS Test2
|
||||||
CONSTRUCTOR public constructor Test2(xx: kotlin.Int, yy: kotlin.Int)
|
CONSTRUCTOR public constructor Test2(xx: kotlin.Int, yy: kotlin.Int)
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=Base origin=ARGUMENTS_REORDERING_FOR_CALL
|
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp0_y: kotlin.Int
|
||||||
GET_VAR 'value-parameter yy: Int' type=kotlin.Int origin=null
|
GET_VAR 'value-parameter yy: Int' type=kotlin.Int origin=null
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1_x: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp1_x: kotlin.Int
|
||||||
@@ -48,7 +48,7 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
|
|||||||
INSTANCE_INITIALIZER_CALL classDescriptor='Test2'
|
INSTANCE_INITIALIZER_CALL classDescriptor='Test2'
|
||||||
CONSTRUCTOR public constructor Test2(xxx: kotlin.Int, yyy: kotlin.Int, a: kotlin.Any)
|
CONSTRUCTOR public constructor Test2(xxx: kotlin.Int, yyy: kotlin.Int, a: kotlin.Any)
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=Test2 origin=ARGUMENTS_REORDERING_FOR_CALL
|
BLOCK type=kotlin.Unit origin=ARGUMENTS_REORDERING_FOR_CALL
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_yy: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp0_yy: kotlin.Int
|
||||||
GET_VAR 'value-parameter yyy: Int' type=kotlin.Int origin=null
|
GET_VAR 'value-parameter yyy: Int' type=kotlin.Int origin=null
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1_xx: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp1_xx: kotlin.Int
|
||||||
|
|||||||
@@ -46,16 +46,20 @@ FILE /localDelegatedProperties.kt
|
|||||||
thisRef: CONST Null type=kotlin.Nothing? value='null'
|
thisRef: CONST Null type=kotlin.Nothing? value='null'
|
||||||
property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KMutableProperty0<kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
property: CALLABLE_REFERENCE 'x: Int' type=kotlin.reflect.KMutableProperty0<kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||||
value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null
|
value: GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null
|
||||||
CALL '<set-x>(Int): Int' type=kotlin.Int origin=EQ
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
value: CONST Int type=kotlin.Int value='0'
|
CALL '<set-x>(Int): Int' type=kotlin.Int origin=EQ
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
value: CONST Int type=kotlin.Int value='0'
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
CALL '<get-x>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL '<set-x>(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
|
||||||
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
CALL '<get-x>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
CALL '<set-x>(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL '<set-x>(Int): Int' type=kotlin.Int origin=PLUSEQ
|
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ
|
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
||||||
$this: CALL '<get-x>(): Int' type=kotlin.Int origin=PLUSEQ
|
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
||||||
other: CONST Int type=kotlin.Int value='1'
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CALL '<set-x>(Int): Int' type=kotlin.Int origin=PLUSEQ
|
||||||
|
value: CALL 'plus(Int): Int' type=kotlin.Int origin=PLUSEQ
|
||||||
|
$this: CALL '<get-x>(): Int' type=kotlin.Int origin=PLUSEQ
|
||||||
|
other: CONST Int type=kotlin.Int value='1'
|
||||||
|
|||||||
@@ -59,19 +59,20 @@ FILE /arrayAugmentedAssignment1.kt
|
|||||||
other: CONST Int type=kotlin.Int value='2'
|
other: CONST Int type=kotlin.Int value='2'
|
||||||
FUN public fun testMember(c: C): kotlin.Unit
|
FUN public fun testMember(c: C): kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_array: kotlin.IntArray
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL '<get-x>(): IntArray' type=kotlin.IntArray origin=GET_PROPERTY
|
VAR IR_TEMPORARY_VARIABLE val tmp0_array: kotlin.IntArray
|
||||||
$this: GET_VAR 'value-parameter c: C' type=C origin=null
|
CALL '<get-x>(): IntArray' type=kotlin.IntArray origin=GET_PROPERTY
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1_index0: kotlin.Int
|
$this: GET_VAR 'value-parameter c: C' type=C origin=null
|
||||||
CONST Int type=kotlin.Int value='0'
|
VAR IR_TEMPORARY_VARIABLE val tmp1_index0: kotlin.Int
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
|
CONST Int type=kotlin.Int value='0'
|
||||||
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
|
||||||
|
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
|
||||||
|
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
|
||||||
|
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
|
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
|
||||||
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
|
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
|
||||||
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp0_array: IntArray' type=kotlin.IntArray origin=null
|
$this: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
||||||
index: GET_VAR 'tmp1_index0: Int' type=kotlin.Int origin=null
|
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
||||||
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
|
||||||
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// +JDK
|
||||||
|
|
||||||
|
val test1: () -> Unit = { 42 }
|
||||||
|
|
||||||
|
fun test2(mc: MutableCollection<String>) {
|
||||||
|
mc.add("")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test3() {
|
||||||
|
System.out?.println("Hello,")
|
||||||
|
System.out?.println("world!")
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
FILE /coercionToUnit.kt
|
||||||
|
PROPERTY public val test1: () -> kotlin.Unit
|
||||||
|
FIELD PROPERTY_BACKING_FIELD public val test1: () -> kotlin.Unit
|
||||||
|
EXPRESSION_BODY
|
||||||
|
BLOCK type=() -> kotlin.Unit origin=LAMBDA
|
||||||
|
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun <anonymous>(): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='<anonymous>(): Unit'
|
||||||
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CONST Int type=kotlin.Int value='42'
|
||||||
|
CALLABLE_REFERENCE '<anonymous>(): Unit' type=() -> kotlin.Unit origin=LAMBDA
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test1>(): () -> kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='<get-test1>(): () -> Unit'
|
||||||
|
GET_FIELD 'test1: () -> Unit' type=() -> kotlin.Unit origin=null
|
||||||
|
FUN public fun test2(mc: kotlin.collections.MutableCollection<kotlin.String>): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CALL 'add(String): Boolean' type=kotlin.Boolean origin=null
|
||||||
|
$this: GET_VAR 'value-parameter mc: MutableCollection<String>' type=kotlin.collections.MutableCollection<kotlin.String> origin=null
|
||||||
|
element: CONST String type=kotlin.String value=''
|
||||||
|
FUN public fun test3(): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
BLOCK type=kotlin.Unit? origin=SAFE_CALL
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: java.io.PrintStream!
|
||||||
|
GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY
|
||||||
|
WHEN type=kotlin.Unit? origin=SAFE_CALL
|
||||||
|
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
||||||
|
arg0: GET_VAR 'tmp0_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
else: CALL 'println(String!): Unit' type=kotlin.Unit origin=null
|
||||||
|
$this: TYPE_OP origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
|
||||||
|
GET_VAR 'tmp0_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
|
||||||
|
p0: CONST String type=kotlin.String value='Hello,'
|
||||||
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
BLOCK type=kotlin.Unit? origin=SAFE_CALL
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp1_safe_receiver: java.io.PrintStream!
|
||||||
|
GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY
|
||||||
|
WHEN type=kotlin.Unit? origin=SAFE_CALL
|
||||||
|
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
||||||
|
arg0: GET_VAR 'tmp1_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
else: CALL 'println(String!): Unit' type=kotlin.Unit origin=null
|
||||||
|
$this: TYPE_OP origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
|
||||||
|
GET_VAR 'tmp1_safe_receiver: PrintStream!' type=java.io.PrintStream! origin=null
|
||||||
|
p0: CONST String type=kotlin.String value='world!'
|
||||||
@@ -60,65 +60,69 @@ FILE /complexAugmentedAssignment.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
VAR var i: kotlin.Int
|
VAR var i: kotlin.Int
|
||||||
CONST Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1_array: kotlin.IntArray
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'value-parameter a: IntArray' type=kotlin.IntArray origin=null
|
VAR IR_TEMPORARY_VARIABLE val tmp1_array: kotlin.IntArray
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp2_index0: kotlin.Int
|
GET_VAR 'value-parameter a: IntArray' type=kotlin.IntArray origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp2_index0: kotlin.Int
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'i: Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
|
||||||
SET_VAR 'i: Int' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'i: Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
SET_VAR 'i: Int' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
|
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
||||||
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
|
||||||
|
CALL 'get(Int): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
|
||||||
|
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
|
||||||
|
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
|
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
|
||||||
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
|
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
|
||||||
CALL 'set(Int, Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp1_array: IntArray' type=kotlin.IntArray origin=null
|
|
||||||
index: GET_VAR 'tmp2_index0: Int' type=kotlin.Int origin=null
|
|
||||||
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
|
||||||
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
|
||||||
FUN public fun test2(): kotlin.Unit
|
|
||||||
BLOCK_BODY
|
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_this: X1
|
|
||||||
GET_OBJECT 'X1' type=X1
|
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1: kotlin.Int
|
|
||||||
CALL '<get-x1>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
|
|
||||||
CALL '<set-x1>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
|
|
||||||
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
|
|
||||||
GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
|
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp2_this: X1.X2
|
|
||||||
GET_OBJECT 'X2' type=X1.X2
|
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
|
|
||||||
CALL '<get-x2>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
|
|
||||||
CALL '<set-x2>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
|
|
||||||
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
||||||
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
FUN public fun test2(): kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp4_this: X1.X2.X3
|
BLOCK_BODY
|
||||||
GET_OBJECT 'X3' type=X1.X2.X3
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp0_this: X1
|
||||||
CALL '<get-x3>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
GET_OBJECT 'X1' type=X1
|
||||||
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp1: kotlin.Int
|
||||||
|
CALL '<get-x1>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
|
||||||
|
CALL '<set-x1>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp0_this: X1' type=X1 origin=null
|
||||||
|
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
|
||||||
|
GET_VAR 'tmp1: Int' type=kotlin.Int origin=null
|
||||||
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp2_this: X1.X2
|
||||||
|
GET_OBJECT 'X2' type=X1.X2
|
||||||
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
|
||||||
|
CALL '<get-x2>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
|
||||||
|
CALL '<set-x2>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp2_this: X1.X2' type=X1.X2 origin=null
|
||||||
|
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
||||||
|
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
||||||
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp4_this: X1.X2.X3
|
||||||
|
GET_OBJECT 'X3' type=X1.X2.X3
|
||||||
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
|
||||||
|
CALL '<get-x3>(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
|
||||||
|
CALL '<set-x3>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
|
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
|
||||||
CALL '<set-x3>(Int): Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp4_this: X1.X2.X3' type=X1.X2.X3 origin=null
|
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
||||||
<set-?>: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
||||||
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
|
||||||
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
|
||||||
CLASS CLASS B
|
CLASS CLASS B
|
||||||
CONSTRUCTOR public constructor B(s: kotlin.Int = ...)
|
CONSTRUCTOR public constructor B(s: kotlin.Int = ...)
|
||||||
s: EXPRESSION_BODY
|
s: EXPRESSION_BODY
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class C(var x: Int)
|
||||||
|
|
||||||
|
fun test(nc: C?) {
|
||||||
|
nc?.x = 42
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
FILE /safeAssignment.kt
|
||||||
|
CLASS CLASS C
|
||||||
|
CONSTRUCTOR public constructor C(x: kotlin.Int)
|
||||||
|
BLOCK_BODY
|
||||||
|
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor='C'
|
||||||
|
PROPERTY public final var x: kotlin.Int
|
||||||
|
FIELD PROPERTY_BACKING_FIELD public final var x: kotlin.Int
|
||||||
|
EXPRESSION_BODY
|
||||||
|
GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR public final fun <get-x>(): kotlin.Int
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='<get-x>(): Int'
|
||||||
|
GET_FIELD 'x: Int' type=kotlin.Int origin=null
|
||||||
|
receiver: THIS of 'C' type=C
|
||||||
|
FUN DEFAULT_PROPERTY_ACCESSOR public final fun <set-x>(<set-?>: kotlin.Int): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
SET_FIELD 'x: Int' type=kotlin.Unit origin=null
|
||||||
|
receiver: THIS of 'C' type=C
|
||||||
|
value: GET_VAR 'value-parameter <set-?>: Int' type=kotlin.Int origin=null
|
||||||
|
FUN public fun test(nc: C?): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
BLOCK type=kotlin.Unit origin=SAFE_CALL
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: C?
|
||||||
|
GET_VAR 'value-parameter nc: C?' type=C? origin=null
|
||||||
|
WHEN type=kotlin.Unit origin=SAFE_CALL
|
||||||
|
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
||||||
|
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null
|
||||||
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CONST Null type=kotlin.Nothing? value='null'
|
||||||
|
else: CALL '<set-x>(Int): Unit' type=kotlin.Unit origin=EQ
|
||||||
|
$this: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null
|
||||||
|
<set-?>: CONST Int type=kotlin.Int value='42'
|
||||||
+38
-35
@@ -32,49 +32,52 @@ FILE /safeCallWithIncrementDecrement.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
FUN public fun testProperty(nc: test.C?): kotlin.Unit
|
FUN public fun testProperty(nc: test.C?): kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=kotlin.Int? origin=SAFE_CALL
|
BLOCK type=kotlin.Unit origin=SAFE_CALL
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
|
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
|
||||||
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
|
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
|
||||||
WHEN type=kotlin.Int? origin=SAFE_CALL
|
WHEN type=kotlin.Unit origin=SAFE_CALL
|
||||||
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
||||||
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
||||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
then: CONST Null type=kotlin.Nothing? value='null'
|
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
else: BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
CONST Null type=kotlin.Nothing? value='null'
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp1_this: test.C?
|
else: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
|
VAR IR_TEMPORARY_VARIABLE val tmp1_this: test.C?
|
||||||
CALL '<get-p>() on C?: Int' type=kotlin.Int origin=POSTFIX_INCR
|
GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
||||||
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
VAR IR_TEMPORARY_VARIABLE val tmp2: kotlin.Int
|
||||||
|
CALL '<get-p>() on C?: Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
|
||||||
|
CALL '<set-p>(Int) on C?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
|
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
|
||||||
CALL '<set-p>(Int) on C?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
value: CALL 'inc() on Int?: Int?' type=kotlin.Int? origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
|
$receiver: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
||||||
value: CALL 'inc() on Int?: Int?' type=kotlin.Int? origin=POSTFIX_INCR
|
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
||||||
$receiver: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
|
||||||
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
|
|
||||||
FUN public fun testArrayAccess(nc: test.C?): kotlin.Unit
|
FUN public fun testArrayAccess(nc: test.C?): kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp3_array: kotlin.Int?
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
BLOCK type=kotlin.Int? origin=SAFE_CALL
|
VAR IR_TEMPORARY_VARIABLE val tmp3_array: kotlin.Int?
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
|
BLOCK type=kotlin.Int? origin=SAFE_CALL
|
||||||
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
|
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
|
||||||
WHEN type=kotlin.Int? origin=SAFE_CALL
|
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
|
||||||
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
WHEN type=kotlin.Int? origin=SAFE_CALL
|
||||||
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
||||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
||||||
then: CONST Null type=kotlin.Nothing? value='null'
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
else: CALL '<get-p>() on C?: Int' type=kotlin.Int origin=GET_PROPERTY
|
then: CONST Null type=kotlin.Nothing? value='null'
|
||||||
$this: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
else: CALL '<get-p>() on C?: Int' type=kotlin.Int origin=GET_PROPERTY
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp4_index0: kotlin.Int
|
$this: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
|
||||||
CONST Int type=kotlin.Int value='0'
|
VAR IR_TEMPORARY_VARIABLE val tmp4_index0: kotlin.Int
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
|
CONST Int type=kotlin.Int value='0'
|
||||||
CALL 'get(Int) on Int?: Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
|
||||||
|
CALL 'get(Int) on Int?: Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
|
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
|
||||||
|
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
|
||||||
|
CALL 'set(Int, Int) on Int?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
|
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
|
||||||
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
|
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
|
||||||
CALL 'set(Int, Int) on Int?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
|
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
$receiver: GET_VAR 'tmp3_array: Int?' type=kotlin.Int? origin=null
|
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
||||||
index: GET_VAR 'tmp4_index0: Int' type=kotlin.Int origin=null
|
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
||||||
value: CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
|
||||||
$this: GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
|
||||||
GET_VAR 'tmp5: Int' type=kotlin.Int origin=null
|
|
||||||
|
|||||||
+4
-3
@@ -66,14 +66,15 @@ FILE /safeCalls.kt
|
|||||||
other: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null
|
other: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null
|
||||||
FUN public fun test4(x: Ref?): kotlin.Unit
|
FUN public fun test4(x: Ref?): kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=kotlin.Unit? origin=SAFE_CALL
|
BLOCK type=kotlin.Unit origin=SAFE_CALL
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: Ref?
|
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: Ref?
|
||||||
GET_VAR 'value-parameter x: Ref?' type=Ref? origin=null
|
GET_VAR 'value-parameter x: Ref?' type=Ref? origin=null
|
||||||
WHEN type=kotlin.Unit? origin=SAFE_CALL
|
WHEN type=kotlin.Unit origin=SAFE_CALL
|
||||||
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
|
||||||
arg0: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
|
arg0: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
|
||||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||||
then: CONST Null type=kotlin.Nothing? value='null'
|
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CONST Null type=kotlin.Nothing? value='null'
|
||||||
else: CALL '<set-value>(Int): Unit' type=kotlin.Unit origin=EQ
|
else: CALL '<set-value>(Int): Unit' type=kotlin.Unit origin=EQ
|
||||||
$this: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
|
$this: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
|
||||||
<set-?>: CONST Int type=kotlin.Int value='0'
|
<set-?>: CONST Int type=kotlin.Int value='0'
|
||||||
|
|||||||
@@ -52,13 +52,14 @@ FILE /whileDoWhile.kt
|
|||||||
other: CONST Int type=kotlin.Int value='15'
|
other: CONST Int type=kotlin.Int value='15'
|
||||||
DO_WHILE label=null origin=DO_WHILE_LOOP
|
DO_WHILE label=null origin=DO_WHILE_LOOP
|
||||||
body: BLOCK type=kotlin.Unit origin=null
|
body: BLOCK type=kotlin.Unit origin=null
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp3: kotlin.Int
|
||||||
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
$this: GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
||||||
|
GET_VAR 'tmp3: Int' type=kotlin.Int origin=null
|
||||||
condition: CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT
|
condition: CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT
|
||||||
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=LT
|
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=LT
|
||||||
$this: GET_VAR 'x: Int' type=kotlin.Int origin=null
|
$this: GET_VAR 'x: Int' type=kotlin.Int origin=null
|
||||||
|
|||||||
+8
-7
@@ -5,11 +5,12 @@ FILE /localFunction.kt
|
|||||||
CONST Int type=kotlin.Int value='0'
|
CONST Int type=kotlin.Int value='0'
|
||||||
FUN local final fun local(): kotlin.Unit
|
FUN local final fun local(): kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
|
BLOCK type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
|
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
|
||||||
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
|
GET_VAR 'x: Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
SET_VAR 'x: Int' type=kotlin.Unit origin=POSTFIX_INCR
|
||||||
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
CALL 'inc(): Int' type=kotlin.Int origin=POSTFIX_INCR
|
||||||
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
$this: GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
||||||
|
GET_VAR 'tmp0: Int' type=kotlin.Int origin=null
|
||||||
CALL 'local(): Unit' type=kotlin.Unit origin=null
|
CALL 'local(): Unit' type=kotlin.Unit origin=null
|
||||||
|
|||||||
@@ -22,35 +22,36 @@ FILE /multipleImplicitReceivers.kt
|
|||||||
CONST Int type=kotlin.Int value='42'
|
CONST Int type=kotlin.Int value='42'
|
||||||
FUN public fun test(fooImpl: IFoo, invokeImpl: IInvoke): kotlin.Unit
|
FUN public fun test(fooImpl: IFoo, invokeImpl: IInvoke): kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null
|
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
<T>: A
|
CALL 'with(A, A.() -> Int): Int' type=kotlin.Int origin=null
|
||||||
<R>: Int
|
<T>: A
|
||||||
receiver: GET_OBJECT 'A' type=A
|
<R>: Int
|
||||||
block: BLOCK type=A.() -> kotlin.Int origin=LAMBDA
|
receiver: GET_OBJECT 'A' type=A
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun A.<anonymous>(): kotlin.Int
|
block: BLOCK type=A.() -> kotlin.Int origin=LAMBDA
|
||||||
BLOCK_BODY
|
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun A.<anonymous>(): kotlin.Int
|
||||||
RETURN type=kotlin.Nothing from='<anonymous>() on A: Int'
|
BLOCK_BODY
|
||||||
CALL 'with(IFoo, IFoo.() -> Int): Int' type=kotlin.Int origin=null
|
RETURN type=kotlin.Nothing from='<anonymous>() on A: Int'
|
||||||
<T>: IFoo
|
CALL 'with(IFoo, IFoo.() -> Int): Int' type=kotlin.Int origin=null
|
||||||
<R>: Int
|
<T>: IFoo
|
||||||
receiver: GET_VAR 'value-parameter fooImpl: IFoo' type=IFoo origin=null
|
<R>: Int
|
||||||
block: BLOCK type=IFoo.() -> kotlin.Int origin=LAMBDA
|
receiver: GET_VAR 'value-parameter fooImpl: IFoo' type=IFoo origin=null
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IFoo.<anonymous>(): kotlin.Int
|
block: BLOCK type=IFoo.() -> kotlin.Int origin=LAMBDA
|
||||||
BLOCK_BODY
|
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IFoo.<anonymous>(): kotlin.Int
|
||||||
RETURN type=kotlin.Nothing from='<anonymous>() on IFoo: Int'
|
BLOCK_BODY
|
||||||
CALL 'with(IInvoke, IInvoke.() -> Int): Int' type=kotlin.Int origin=null
|
RETURN type=kotlin.Nothing from='<anonymous>() on IFoo: Int'
|
||||||
<T>: IInvoke
|
CALL 'with(IInvoke, IInvoke.() -> Int): Int' type=kotlin.Int origin=null
|
||||||
<R>: Int
|
<T>: IInvoke
|
||||||
receiver: GET_VAR 'value-parameter invokeImpl: IInvoke' type=IInvoke origin=null
|
<R>: Int
|
||||||
block: BLOCK type=IInvoke.() -> kotlin.Int origin=LAMBDA
|
receiver: GET_VAR 'value-parameter invokeImpl: IInvoke' type=IInvoke origin=null
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IInvoke.<anonymous>(): kotlin.Int
|
block: BLOCK type=IInvoke.() -> kotlin.Int origin=LAMBDA
|
||||||
BLOCK_BODY
|
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun IInvoke.<anonymous>(): kotlin.Int
|
||||||
RETURN type=kotlin.Nothing from='<anonymous>() on IInvoke: Int'
|
BLOCK_BODY
|
||||||
CALL 'invoke() on B: Int' type=kotlin.Int origin=INVOKE
|
RETURN type=kotlin.Nothing from='<anonymous>() on IInvoke: Int'
|
||||||
$this: $RECEIVER of '<anonymous>() on IInvoke: Int' type=IInvoke
|
CALL 'invoke() on B: Int' type=kotlin.Int origin=INVOKE
|
||||||
$receiver: CALL '<get-foo>() on A: B' type=B origin=GET_PROPERTY
|
$this: $RECEIVER of '<anonymous>() on IInvoke: Int' type=IInvoke
|
||||||
$this: $RECEIVER of '<anonymous>() on IFoo: Int' type=IFoo
|
$receiver: CALL '<get-foo>() on A: B' type=B origin=GET_PROPERTY
|
||||||
$receiver: $RECEIVER of '<anonymous>() on A: Int' type=A
|
$this: $RECEIVER of '<anonymous>() on IFoo: Int' type=IFoo
|
||||||
CALLABLE_REFERENCE '<anonymous>() on IInvoke: Int' type=IInvoke.() -> kotlin.Int origin=LAMBDA
|
$receiver: $RECEIVER of '<anonymous>() on A: Int' type=A
|
||||||
CALLABLE_REFERENCE '<anonymous>() on IFoo: Int' type=IFoo.() -> kotlin.Int origin=LAMBDA
|
CALLABLE_REFERENCE '<anonymous>() on IInvoke: Int' type=IInvoke.() -> kotlin.Int origin=LAMBDA
|
||||||
CALLABLE_REFERENCE '<anonymous>() on A: Int' type=A.() -> kotlin.Int origin=LAMBDA
|
CALLABLE_REFERENCE '<anonymous>() on IFoo: Int' type=IFoo.() -> kotlin.Int origin=LAMBDA
|
||||||
|
CALLABLE_REFERENCE '<anonymous>() on A: Int' type=A.() -> kotlin.Int origin=LAMBDA
|
||||||
|
|||||||
@@ -382,6 +382,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("coercionToUnit.kt")
|
||||||
|
public void testCoercionToUnit() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/coercionToUnit.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("complexAugmentedAssignment.kt")
|
@TestMetadata("complexAugmentedAssignment.kt")
|
||||||
public void testComplexAugmentedAssignment() throws Exception {
|
public void testComplexAugmentedAssignment() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/complexAugmentedAssignment.kt");
|
||||||
@@ -514,6 +520,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("safeAssignment.kt")
|
||||||
|
public void testSafeAssignment() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/safeAssignment.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("safeCallWithIncrementDecrement.kt")
|
@TestMetadata("safeCallWithIncrementDecrement.kt")
|
||||||
public void testSafeCallWithIncrementDecrement() throws Exception {
|
public void testSafeCallWithIncrementDecrement() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/safeCallWithIncrementDecrement.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user