Refactor IrWhen.

This commit is contained in:
Dmitry Petrov
2016-09-21 15:32:36 +03:00
parent aca71dea22
commit 8551bcf103
37 changed files with 700 additions and 554 deletions
@@ -30,8 +30,6 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrIfThenElseImpl
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE
import org.jetbrains.kotlin.types.KotlinType
@@ -303,13 +301,13 @@ class ExpressionCodegen(
/*TODO */
if (expression is IrIfThenElseImpl) {
val elseLabel = Label()
val condition = expression.getNthCondition(0)!!
val condition = expression.branches[0].condition
gen(condition, data)
BranchedValue.condJump(StackValue.onStack(condition.asmType), elseLabel, true, mv)
val end = Label()
expression.getNthResult(0)!!.apply {
expression.branches[0].result.apply {
gen(this, data)
coerceNotToUnit(this.asmType, expression.asmType)
}
@@ -317,7 +315,7 @@ class ExpressionCodegen(
mv.goTo(end)
mv.mark(elseLabel)
expression.getNthResult(1)?.apply {
expression.branches.getOrNull(1)?.result?.apply {
gen(this, data)
coerceNotToUnit(this.asmType, expression.asmType)
}
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.psi2ir.defaultLoad
import org.jetbrains.kotlin.psi2ir.deparenthesize
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.SmartList
class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) {
@@ -32,13 +33,13 @@ class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : Sta
val resultType = getInferredTypeWithImplicitCastsOrFail(expression)
var ktLastIf: KtIfExpression = expression
val irBranches = SmartList<Pair<IrExpression, IrExpression>>()
val irBranches = SmartList<IrBranch>()
var irElseBranch: IrExpression? = null
whenBranches@while (true) {
val irCondition = statementGenerator.generateExpression(ktLastIf.condition!!)
val irThenBranch = statementGenerator.generateExpression(ktLastIf.then!!)
irBranches.add(Pair(irCondition, irThenBranch))
irBranches.add(IrBranchImpl(irCondition, irThenBranch))
val ktElse = ktLastIf.`else`?.deparenthesize()
when (ktElse) {
@@ -52,19 +53,29 @@ class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : Sta
}
}
return if (irBranches.size == 1) {
val (irCondition, irThenBranch) = irBranches[0]
IrIfThenElseImpl(expression.startOffset, expression.endOffset, resultType,
irCondition, irThenBranch, irElseBranch, IrStatementOrigin.IF)
return createIrWhen(expression, irBranches, irElseBranch, resultType)
}
private fun createIrWhen(
ktIf: KtIfExpression,
irBranches: List<IrBranch>,
irElseResult: IrExpression?,
resultType: KotlinType
): IrWhen {
if (irBranches.size == 1) {
return IrIfThenElseImpl(ktIf.startOffset, ktIf.endOffset, resultType,
irBranches[0].condition, irBranches[0].result, irElseResult)
}
else {
val irWhen = IrWhenImpl(expression.startOffset, expression.endOffset, resultType, IrStatementOrigin.WHEN)
for ((irCondition, irThenBranch) in irBranches) {
irWhen.addBranch(irCondition, irThenBranch)
}
irWhen.elseBranch = irElseBranch
irWhen
val irWhen = IrWhenImpl(ktIf.startOffset, ktIf.endOffset, resultType, IrStatementOrigin.WHEN)
irWhen.branches.addAll(irBranches)
irElseResult?.let {
irWhen.branches.add(IrBranchImpl.elseBranch(it))
}
return irWhen
}
fun generateWhenExpression(expression: KtWhenExpression): IrExpression {
@@ -78,7 +89,8 @@ class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : Sta
for (ktEntry in expression.entries) {
if (ktEntry.isElse) {
irWhen.elseBranch = statementGenerator.generateExpression(ktEntry.expression!!)
val irElseResult = statementGenerator.generateExpression(ktEntry.expression!!)
irWhen.branches.add(IrBranchImpl.elseBranch(irElseResult))
break
}
@@ -94,7 +106,7 @@ class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : Sta
}
val irBranchResult = statementGenerator.generateExpression(ktEntry.expression!!)
irWhen.addBranch(irBranchCondition!!, irBranchResult)
irWhen.branches.add(IrBranchImpl(irBranchCondition!!, irBranchResult))
}
return generateWhenBody(expression, irSubject, irWhen)
@@ -102,13 +114,13 @@ class BranchingExpressionGenerator(statementGenerator: StatementGenerator) : Sta
private fun generateWhenBody(expression: KtWhenExpression, irSubject: IrVariable?, irWhen: IrWhen): IrExpression {
if (irSubject == null) {
if (irWhen.branchesCount == 0 && irWhen.elseBranch == null)
if (irWhen.branches.isEmpty())
return IrBlockImpl(expression.startOffset, expression.endOffset, context.builtIns.unitType, IrStatementOrigin.WHEN)
else
return irWhen
}
else {
if (irWhen.branchesCount == 0) {
if (irWhen.branches.isEmpty()) {
val irBlock = IrBlockImpl(expression.startOffset, expression.endOffset, context.builtIns.unitType, IrStatementOrigin.WHEN)
irBlock.statements.add(irSubject)
return irBlock
@@ -127,16 +127,11 @@ class InsertImplicitCasts(val builtIns: KotlinBuiltIns): IrElementTransformerVoi
val resultType = expression.type
for (i in expression.branchIndices) {
val nthCondition = expression.getNthCondition(i)!!
val nthResult = expression.getNthResult(i)!!
expression.putNthCondition(i, nthCondition.cast(builtIns.booleanType))
expression.putNthResult(i, nthResult.cast(resultType))
for (irBranch in expression.branches) {
irBranch.condition = irBranch.condition.cast(builtIns.booleanType)
irBranch.result = irBranch.result.cast(resultType)
}
expression.elseBranch = expression.elseBranch?.cast(resultType)
return expression
}
@@ -16,19 +16,23 @@
package org.jetbrains.kotlin.ir.expressions
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
interface IrWhen : IrExpression {
val origin: IrStatementOrigin?
val branchesCount: Int
fun getNthCondition(n: Int): IrExpression?
fun getNthResult(n: Int): IrExpression?
fun putNthCondition(n: Int, expression: IrExpression)
fun putNthResult(n: Int, expression: IrExpression)
var elseBranch: IrExpression?
val branches: MutableList<IrBranch>
}
val IrWhen.branchIndices: IntRange get() = 0 ..branchesCount - 1
interface IrBranch : IrElement {
var condition: IrExpression
var result: IrExpression
override fun <D> transform(transformer: IrElementTransformer<D>, data: D): IrBranch =
transformer.visitBranch(this, data)
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitBranch(this, data)
}
@@ -16,17 +16,19 @@
package org.jetbrains.kotlin.ir.expressions.impl
import org.jetbrains.kotlin.ir.expressions.IrBranch
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
import org.jetbrains.kotlin.ir.expressions.IrWhen
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.builtIns
import org.jetbrains.kotlin.utils.SmartList
class IrIfThenElseImpl(
startOffset: Int, endOffset: Int, type: KotlinType,
override val origin: IrStatementOrigin? = null
) : IrExpressionBase(startOffset, endOffset, type), IrWhen {
) : IrWhenBase(startOffset, endOffset, type) {
override val branches: MutableList<IrBranch> = SmartList()
constructor(
startOffset: Int, endOffset: Int, type: KotlinType,
condition: IrExpression,
@@ -34,56 +36,9 @@ class IrIfThenElseImpl(
elseBranch: IrExpression? = null,
origin: IrStatementOrigin? = null
) : this(startOffset, endOffset, type, origin) {
this.condition = condition
this.thenBranch = thenBranch
this.elseBranch = elseBranch
}
override val branchesCount: Int get() = 1
override fun getNthCondition(n: Int): IrExpression? =
if (n == 0) condition else null
override fun getNthResult(n: Int): IrExpression? =
when (n) {
0 -> {
thenBranch
}
1 -> {
elseBranch
}
else -> null
}
override fun putNthCondition(n: Int, expression: IrExpression) {
if (n == 0) condition = expression
else throw AssertionError("No such branch $n")
}
override fun putNthResult(n: Int, expression: IrExpression) {
if (n == 0) thenBranch = expression
else throw AssertionError("No such branch $n")
}
lateinit var condition: IrExpression
lateinit var thenBranch: IrExpression
override var elseBranch: IrExpression? = null
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitWhen(this, data)
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
condition.accept(visitor, data)
thenBranch.accept(visitor, data)
elseBranch?.accept(visitor, data)
}
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
condition = condition.transform(transformer, data)
thenBranch = thenBranch.transform(transformer, data)
elseBranch = elseBranch?.transform(transformer, data)
branches.add(IrBranchImpl(startOffset, endOffset, condition, thenBranch))
if (elseBranch != null) {
branches.add(IrBranchImpl.elseBranch(elseBranch))
}
}
}
@@ -16,57 +16,58 @@
package org.jetbrains.kotlin.ir.expressions.impl
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
import org.jetbrains.kotlin.ir.expressions.IrWhen
import org.jetbrains.kotlin.ir.IrElementBase
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.builtIns
import java.util.*
abstract class IrWhenBase(startOffset: Int, endOffset: Int, type: KotlinType, override val origin: IrStatementOrigin? = null) :
IrExpressionBase(startOffset, endOffset, type), IrWhen {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitWhen(this, data)
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
branches.forEach { it.accept(visitor, data) }
}
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
branches.forEachIndexed { i, irBranch ->
branches[i] = irBranch.transform(transformer, data)
}
}
}
class IrWhenImpl(
startOffset: Int,
endOffset: Int,
type: KotlinType,
override val origin: IrStatementOrigin? = null
) : IrExpressionBase(startOffset, endOffset, type), IrWhen {
private val branchParts = ArrayList<IrExpression>()
) : IrWhenBase(startOffset, endOffset, type) {
override val branches: MutableList<IrBranch> = ArrayList()
}
fun addBranch(condition: IrExpression, result: IrExpression) {
branchParts.add(condition)
branchParts.add(result)
}
override var elseBranch: IrExpression? = null
override val branchesCount: Int get() = branchParts.size / 2
override fun getNthCondition(n: Int): IrExpression? =
branchParts.getOrNull(n * 2)
override fun getNthResult(n: Int): IrExpression? =
branchParts.getOrNull(n * 2 + 1)
override fun putNthCondition(n: Int, expression: IrExpression) {
branchParts[n * 2] = expression
}
override fun putNthResult(n: Int, expression: IrExpression) {
branchParts[n * 2 + 1] = expression
}
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitWhen(this, data)
class IrBranchImpl(startOffset: Int, endOffset: Int, override var condition: IrExpression, override var result: IrExpression) :
IrElementBase(startOffset, endOffset), IrBranch {
constructor(condition: IrExpression, result: IrExpression) : this(condition.startOffset, condition.endOffset, condition, result)
override fun <D> acceptChildren(visitor: IrElementVisitor<Unit, D>, data: D) {
branchParts.forEach { it.accept(visitor, data) }
elseBranch?.accept(visitor, data)
condition.accept(visitor, data)
result.accept(visitor, data)
}
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
branchParts.forEachIndexed { i, irExpression ->
branchParts[i] = irExpression.transform(transformer, data)
}
elseBranch = elseBranch?.transform(transformer, data)
condition = condition.transform(transformer, data)
result = result.transform(transformer, data)
}
companion object {
fun elseBranch(result: IrExpression) =
IrBranchImpl(
IrConstImpl.boolean(result.startOffset, result.endOffset, result.type.builtIns.booleanType, true),
result
)
}
}
@@ -131,11 +131,16 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor<Unit, String> {
override fun visitWhen(expression: IrWhen, data: String) {
expression.dumpLabeledElementWith(data) {
for (i in 0 .. expression.branchesCount - 1) {
expression.getNthCondition(i)!!.accept(this, "if")
expression.getNthResult(i)!!.accept(this, "then")
expression.branches.forEach {
it.accept(this, "")
}
expression.elseBranch?.accept(this, "else")
}
}
override fun visitBranch(branch: IrBranch, data: String) {
branch.dumpLabeledElementWith(data) {
branch.condition.accept(this, "if")
branch.result.accept(this, "then")
}
}
@@ -155,6 +155,9 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
override fun visitWhen(expression: IrWhen, data: Nothing?): String =
"WHEN type=${expression.type.render()} origin=${expression.origin}"
override fun visitBranch(branch: IrBranch, data: Nothing?): String =
"BRANCH"
override fun visitWhileLoop(loop: IrWhileLoop, data: Nothing?): String =
"WHILE label=${loop.label} origin=${loop.origin}"
@@ -92,6 +92,13 @@ interface IrElementTransformer<in D> : IrElementVisitor<IrElement, D> {
override fun visitTypeOperator(expression: IrTypeOperatorCall, data: D) = visitExpression(expression, data)
override fun visitWhen(expression: IrWhen, data: D) = visitExpression(expression, data)
override fun visitBranch(branch: IrBranch, data: D): IrBranch =
branch.apply {
condition = condition.transform(this@IrElementTransformer, data)
result = result.transform(this@IrElementTransformer, data)
}
override fun visitLoop(loop: IrLoop, data: D) = visitExpression(loop, data)
override fun visitWhileLoop(loop: IrWhileLoop, data: D) = visitLoop(loop, data)
override fun visitDoWhileLoop(loop: IrDoWhileLoop, data: D) = visitLoop(loop, data)
@@ -78,6 +78,7 @@ interface IrElementVisitor<out R, in D> {
fun visitTypeOperator(expression: IrTypeOperatorCall, data: D) = visitExpression(expression, data)
fun visitWhen(expression: IrWhen, data: D) = visitExpression(expression, data)
fun visitBranch(branch: IrBranch, data: D) = visitElement(branch, data)
fun visitLoop(loop: IrLoop, data: D) = visitExpression(loop, data)
fun visitWhileLoop(loop: IrWhileLoop, data: D) = visitLoop(loop, data)
fun visitDoWhileLoop(loop: IrDoWhileLoop, data: D) = visitLoop(loop, data)
@@ -165,6 +165,9 @@ interface IrElementVisitorVoid : IrElementVisitor<Unit, Nothing?> {
fun visitWhen(expression: IrWhen) = visitExpression(expression)
override fun visitWhen(expression: IrWhen, data: Nothing?) = visitWhen(expression)
fun visitBranch(branch: IrBranch) = visitElement(branch)
override fun visitBranch(branch: IrBranch, data: Nothing?) = visitBranch(branch)
fun visitLoop(loop: IrLoop) = visitExpression(loop)
override fun visitLoop(loop: IrLoop, data: Nothing?) = visitLoop(loop)
+38 -33
View File
@@ -99,45 +99,50 @@ FILE /dataClasses.kt
FUN GENERATED_DATA_CLASS_MEMBER public open override fun equals(other: kotlin.Any?): kotlin.Boolean
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
if: CALL 'EQEQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQEQ
arg0: THIS of 'Test1' type=Test1
arg1: GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CALL 'EQEQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQEQ
arg0: THIS of 'Test1' type=Test1
arg1: GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='true'
WHEN type=kotlin.Unit origin=null
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=Test1
GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=Test1
GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
VAR IR_TEMPORARY_VARIABLE val tmp0_other_with_cast: Test1
TYPE_OP origin=CAST typeOperand=Test1
GET_VAR 'value-parameter other: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL '<get-x>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: THIS of 'Test1' type=Test1
arg1: CALL '<get-x>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
BRANCH
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL '<get-x>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: THIS of 'Test1' type=Test1
arg1: CALL '<get-x>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
WHEN type=kotlin.Unit origin=null
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL '<get-y>(): String' type=kotlin.String origin=GET_PROPERTY
$this: THIS of 'Test1' type=Test1
arg1: CALL '<get-y>(): String' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
BRANCH
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL '<get-y>(): String' type=kotlin.String origin=GET_PROPERTY
$this: THIS of 'Test1' type=Test1
arg1: CALL '<get-y>(): String' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
WHEN type=kotlin.Unit origin=null
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL '<get-z>(): Any' type=kotlin.Any origin=GET_PROPERTY
$this: THIS of 'Test1' type=Test1
arg1: CALL '<get-z>(): Any' type=kotlin.Any origin=GET_PROPERTY
$this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
BRANCH
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL '<get-z>(): Any' type=kotlin.Any origin=GET_PROPERTY
$this: THIS of 'Test1' type=Test1
arg1: CALL '<get-z>(): Any' type=kotlin.Any origin=GET_PROPERTY
$this: GET_VAR 'tmp0_other_with_cast: Test1' type=Test1 origin=null
then: RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='false'
RETURN type=kotlin.Nothing from='equals(Any?): Boolean'
CONST Boolean type=kotlin.Boolean value='true'
+25 -16
View File
@@ -6,11 +6,14 @@ FILE /bangbang.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_notnull: kotlin.Any?
GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Any origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_notnull: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL
else: GET_VAR 'tmp0_notnull: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_notnull: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_notnull: Any?' type=kotlin.Any? origin=null
FUN public fun test2(a: kotlin.Any?): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='test2(Any?): Int'
@@ -20,15 +23,21 @@ FILE /bangbang.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.Any?
GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'hashCode(): Int' type=kotlin.Int origin=null
$this: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'hashCode(): Int' type=kotlin.Int origin=null
$this: GET_VAR 'tmp0_safe_receiver: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Int origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_notnull: Int?' type=kotlin.Int? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL
else: GET_VAR 'tmp1_notnull: Int?' type=kotlin.Int? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_notnull: Int?' type=kotlin.Int? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CALL 'THROW_NPE(): Nothing' type=kotlin.Nothing origin=EXCLEXCL
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp1_notnull: Int?' type=kotlin.Int? origin=null
@@ -3,16 +3,22 @@ FILE /booleanOperators.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='test1(Boolean, Boolean): Boolean'
WHEN type=kotlin.Boolean origin=ANDAND
if: GET_VAR 'value-parameter a: Boolean' type=kotlin.Boolean origin=null
then: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null
else: CONST Boolean type=kotlin.Boolean value='false'
BRANCH
if: GET_VAR 'value-parameter a: Boolean' type=kotlin.Boolean origin=null
then: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST Boolean type=kotlin.Boolean value='false'
FUN public fun test2(a: kotlin.Boolean, b: kotlin.Boolean): kotlin.Boolean
BLOCK_BODY
RETURN type=kotlin.Nothing from='test2(Boolean, Boolean): Boolean'
WHEN type=kotlin.Boolean origin=OROR
if: GET_VAR 'value-parameter a: Boolean' type=kotlin.Boolean origin=null
then: CONST Boolean type=kotlin.Boolean value='true'
else: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null
BRANCH
if: GET_VAR 'value-parameter a: Boolean' type=kotlin.Boolean origin=null
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'value-parameter b: Boolean' type=kotlin.Boolean origin=null
FUN public fun test1x(a: kotlin.Boolean, b: kotlin.Boolean): kotlin.Boolean
BLOCK_BODY
RETURN type=kotlin.Nothing from='test1x(Boolean, Boolean): Boolean'
@@ -9,11 +9,14 @@ FILE /breakContinueInLoopHeader.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.Boolean?
GET_VAR 'value-parameter c: Boolean?' type=kotlin.Boolean? origin=null
WHEN type=kotlin.Boolean origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: BREAK label=null loop.label=L
else: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: BREAK label=null loop.label=L
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
FUN public fun test2(c: kotlin.Boolean?): kotlin.Unit
BLOCK_BODY
WHILE label=L origin=WHILE_LOOP
@@ -24,11 +27,14 @@ FILE /breakContinueInLoopHeader.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.Boolean?
GET_VAR 'value-parameter c: Boolean?' type=kotlin.Boolean? origin=null
WHEN type=kotlin.Boolean origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONTINUE label=null loop.label=L
else: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONTINUE label=null loop.label=L
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: Boolean?' type=kotlin.Boolean? origin=null
FUN public fun test3(ss: kotlin.collections.List<kotlin.String>?): kotlin.Unit
BLOCK_BODY
WHILE label=L origin=WHILE_LOOP
@@ -41,11 +47,14 @@ FILE /breakContinueInLoopHeader.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.collections.List<kotlin.String>?
GET_VAR 'value-parameter ss: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
WHEN type=kotlin.collections.List<kotlin.String> origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONTINUE label=null loop.label=L
else: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONTINUE label=null loop.label=L
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
WHILE label=null origin=FOR_LOOP_INNER_WHILE
condition: CALL 'hasNext(): Boolean' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
$this: GET_VAR 'tmp1_iterator: Iterator<String>' type=kotlin.collections.Iterator<kotlin.String> origin=null
@@ -65,11 +74,14 @@ FILE /breakContinueInLoopHeader.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.collections.List<kotlin.String>?
GET_VAR 'value-parameter ss: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
WHEN type=kotlin.collections.List<kotlin.String> origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: BREAK label=null loop.label=L
else: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: BREAK label=null loop.label=L
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: List<String>?' type=kotlin.collections.List<kotlin.String>? origin=null
WHILE label=null origin=FOR_LOOP_INNER_WHILE
condition: CALL 'hasNext(): Boolean' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
$this: GET_VAR 'tmp1_iterator: Iterator<String>' type=kotlin.collections.Iterator<kotlin.String> origin=null
+36 -24
View File
@@ -25,30 +25,42 @@ FILE /chainOfSafeCalls.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: C?
GET_VAR 'value-parameter nc: C?' type=C? origin=null
WHEN type=C? 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: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'foo(): C' type=C origin=null
$this: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null
BRANCH
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: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'foo(): C' type=C origin=null
$this: GET_VAR 'tmp0_safe_receiver: C?' type=C? origin=null
WHEN type=C? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'bar(): C?' type=C? origin=null
$this: GET_VAR 'tmp1_safe_receiver: C?' type=C? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'bar(): C?' type=C? origin=null
$this: GET_VAR 'tmp1_safe_receiver: C?' type=C? origin=null
WHEN type=C? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp2_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'foo(): C' type=C origin=null
$this: GET_VAR 'tmp2_safe_receiver: C?' type=C? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp2_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'foo(): C' type=C origin=null
$this: GET_VAR 'tmp2_safe_receiver: C?' type=C? origin=null
WHEN type=C? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp3_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'foo(): C' type=C origin=null
$this: GET_VAR 'tmp3_safe_receiver: C?' type=C? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp3_safe_receiver: C?' type=C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'foo(): C' type=C origin=null
$this: GET_VAR 'tmp3_safe_receiver: C?' type=C? origin=null
+22 -16
View File
@@ -26,24 +26,30 @@ FILE /coercionToUnit.kt
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,'
BRANCH
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'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: 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!'
BRANCH
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'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: 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!'
+9 -6
View File
@@ -11,9 +11,12 @@ FILE /dotQualified.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.String?
GET_VAR 'value-parameter s: String?' type=kotlin.String? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL '<get-length>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL '<get-length>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
+54 -37
View File
@@ -18,11 +18,14 @@ FILE /elvis.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.Any?
GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Any origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null
else: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
FUN public fun test2(a: kotlin.String?, b: kotlin.Any): kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='test2(String?, Any): Any'
@@ -30,35 +33,43 @@ FILE /elvis.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.String?
GET_VAR 'value-parameter a: String?' type=kotlin.String? origin=null
WHEN type=kotlin.Any origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null
else: GET_VAR 'tmp0_elvis_lhs: String?' type=kotlin.String? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter b: Any' type=kotlin.Any origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: String?' type=kotlin.String? origin=null
FUN public fun test3(a: kotlin.Any?, b: kotlin.Any?): kotlin.String
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='test3(Any?, Any?): String'
CONST String type=kotlin.String value=''
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='test3(Any?, Any?): String'
CONST String type=kotlin.String value=''
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='test3(Any?, Any?): String'
CONST String type=kotlin.String value=''
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='test3(Any?, Any?): String'
CONST String type=kotlin.String value=''
RETURN type=kotlin.Nothing from='test3(Any?, Any?): String'
BLOCK type=kotlin.String origin=ELVIS
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.Any?
GET_VAR 'value-parameter a: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.String origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null
else: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'value-parameter b: Any?' type=kotlin.Any? origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
FUN public fun test4(x: kotlin.Any): kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='test4(Any): Any'
@@ -66,11 +77,14 @@ FILE /elvis.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.Any?
CALL '<get-p>(): Any?' type=kotlin.Any? origin=GET_PROPERTY
WHEN type=kotlin.Any origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
else: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
FUN public fun test5(x: kotlin.Any): kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='test5(Any): Any'
@@ -78,8 +92,11 @@ FILE /elvis.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_elvis_lhs: kotlin.Any?
CALL 'foo(): Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Any origin=null
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
else: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: GET_VAR 'tmp0_elvis_lhs: Any?' type=kotlin.Any? origin=null
+15 -11
View File
@@ -3,14 +3,18 @@ FILE /ifElseIf.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='test(Int): Int'
WHEN type=kotlin.Int origin=WHEN
if: CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=GT
$this: GET_VAR 'value-parameter i: Int' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value='0'
then: CONST Int type=kotlin.Int value='1'
if: CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=LT
$this: GET_VAR 'value-parameter i: Int' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value='0'
then: CONST Int type=kotlin.Int value='-1'
else: CONST Int type=kotlin.Int value='0'
BRANCH
if: CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=GT
$this: GET_VAR 'value-parameter i: Int' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value='0'
then: CONST Int type=kotlin.Int value='1'
BRANCH
if: CALL 'LT0(Int): Boolean' type=kotlin.Boolean origin=LT
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=LT
$this: GET_VAR 'value-parameter i: Int' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value='0'
then: CONST Int type=kotlin.Int value='-1'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST Int type=kotlin.Int value='0'
@@ -29,12 +29,14 @@ FILE /jvmStaticFieldReference.kt
FIELD PROPERTY_BACKING_FIELD public final val test: kotlin.Int
EXPRESSION_BODY
WHEN type=kotlin.Int origin=WHEN
else: BLOCK type=kotlin.Int origin=null
CALL 'println(String!): Unit' type=kotlin.Unit origin=null
$this: TYPE_OP origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/test'
CONST Int type=kotlin.Int value='42'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: BLOCK type=kotlin.Int origin=null
CALL 'println(String!): Unit' type=kotlin.Unit origin=null
$this: TYPE_OP origin=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
GET_FIELD 'out: PrintStream!' type=java.io.PrintStream! origin=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/test'
CONST Int type=kotlin.Int value='42'
FUN DEFAULT_PROPERTY_ACCESSOR public final fun <get-test>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test>(): Int'
+11 -8
View File
@@ -24,11 +24,14 @@ FILE /safeAssignment.kt
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'
BRANCH
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'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: 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'
@@ -18,12 +18,15 @@ FILE /safeCallWithIncrementDecrement.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.Int?
$RECEIVER of 'inc() on Int?: Int?' type=kotlin.Int?
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: Int?' type=kotlin.Int? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'inc(): Int' type=kotlin.Int origin=null
$this: GET_VAR 'tmp0_safe_receiver: Int?' type=kotlin.Int? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: Int?' type=kotlin.Int? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'inc(): Int' type=kotlin.Int origin=null
$this: GET_VAR 'tmp0_safe_receiver: Int?' type=kotlin.Int? origin=null
FUN public operator fun kotlin.Int?.get(index: kotlin.Int): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='get(Int) on Int?: Int'
@@ -36,24 +39,27 @@ FILE /safeCallWithIncrementDecrement.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
GET_VAR 'value-parameter nc: C?' type=test.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=test.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: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp1_this: test.C?
GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.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'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
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
VAR IR_TEMPORARY_VARIABLE val tmp1_this: test.C?
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
CALL '<set-p>(Int) on C?: Unit' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'tmp1_this: C?' type=test.C? origin=null
value: CALL 'inc() on Int?: Int?' type=kotlin.Int? origin=POSTFIX_INCR
$receiver: GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
GET_VAR 'tmp2: Int' type=kotlin.Int origin=null
value: CALL 'inc() on Int?: Int?' type=kotlin.Int? origin=POSTFIX_INCR
$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
BLOCK_BODY
TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
@@ -63,12 +69,15 @@ FILE /safeCallWithIncrementDecrement.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: test.C?
GET_VAR 'value-parameter nc: C?' type=test.C? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL '<get-p>() on C?: Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL '<get-p>() on C?: Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: C?' type=test.C? origin=null
VAR IR_TEMPORARY_VARIABLE val tmp4_index0: kotlin.Int
CONST Int type=kotlin.Int value='0'
VAR IR_TEMPORARY_VARIABLE val tmp5: kotlin.Int
+49 -34
View File
@@ -31,12 +31,15 @@ FILE /safeCalls.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.String?
GET_VAR 'value-parameter x: String?' type=kotlin.String? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL '<get-length>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL '<get-length>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
FUN public fun test2(x: kotlin.String?): kotlin.Int?
BLOCK_BODY
RETURN type=kotlin.Nothing from='test2(String?): Int?'
@@ -44,12 +47,15 @@ FILE /safeCalls.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.String?
GET_VAR 'value-parameter x: String?' type=kotlin.String? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'hashCode(): Int' type=kotlin.Int origin=null
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'hashCode(): Int' type=kotlin.Int origin=null
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
FUN public fun test3(x: kotlin.String?, y: kotlin.Any?): kotlin.Boolean?
BLOCK_BODY
RETURN type=kotlin.Nothing from='test3(String?, Any?): Boolean?'
@@ -57,27 +63,33 @@ FILE /safeCalls.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.String?
GET_VAR 'value-parameter x: String?' type=kotlin.String? origin=null
WHEN type=kotlin.Boolean? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
other: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'equals(Any?): Boolean' type=kotlin.Boolean origin=null
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
other: GET_VAR 'value-parameter y: Any?' type=kotlin.Any? origin=null
FUN public fun test4(x: Ref?): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: Ref?
GET_VAR 'value-parameter x: Ref?' type=Ref? 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: Ref?' type=Ref? 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-value>(Int): Unit' type=kotlin.Unit origin=EQ
$this: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value='0'
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? 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'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL '<set-value>(Int): Unit' type=kotlin.Unit origin=EQ
$this: GET_VAR 'tmp0_safe_receiver: Ref?' type=Ref? origin=null
<set-?>: CONST Int type=kotlin.Int value='0'
FUN public fun IHost.test5(s: kotlin.String?): kotlin.Int?
BLOCK_BODY
RETURN type=kotlin.Nothing from='test5(String?) on IHost: Int?'
@@ -85,10 +97,13 @@ FILE /safeCalls.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.String?
GET_VAR 'value-parameter s: String?' type=kotlin.String? origin=null
WHEN type=kotlin.Int? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'extLength() on String: Int' type=kotlin.Int origin=null
$this: $RECEIVER of 'test5(String?) on IHost: Int?' type=IHost
$receiver: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'extLength() on String: Int' type=kotlin.Int origin=null
$this: $RECEIVER of 'test5(String?) on IHost: Int?' type=IHost
$receiver: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
@@ -6,11 +6,12 @@ FILE /Derived.kt
INSTANCE_INITIALIZER_CALL classDescriptor='Derived'
FUN public final fun setValue(v: kotlin.Any): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null
then: BLOCK type=kotlin.Unit origin=null
SET_FIELD 'value: String!' type=kotlin.Unit origin=EQ
receiver: THIS of 'Derived' type=Derived
value: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String!
GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null
then: BLOCK type=kotlin.Unit origin=null
SET_FIELD 'value: String!' type=kotlin.Unit origin=EQ
receiver: THIS of 'Derived' type=Derived
value: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String!
GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null
+17 -14
View File
@@ -13,10 +13,11 @@ FILE /smartCasts.kt
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
FUN public fun test1(x: kotlin.Any): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='test1(Any): Unit'
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='test1(Any): Unit'
CALL 'println(Int): Unit' type=kotlin.Unit origin=null
message: CALL '<get-length>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
@@ -34,22 +35,24 @@ FILE /smartCasts.kt
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
FUN public fun test2(x: kotlin.Any): kotlin.String
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='test2(Any): String'
CONST String type=kotlin.String value=''
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='test2(Any): String'
CONST String type=kotlin.String value=''
RETURN type=kotlin.Nothing from='test2(Any): String'
CALL 'overloaded(String): String' type=kotlin.String origin=null
s: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
FUN public fun test3(x: kotlin.Any): kotlin.String
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='test3(Any): String'
CONST String type=kotlin.String value=''
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='test3(Any): String'
CONST String type=kotlin.String value=''
RETURN type=kotlin.Nothing from='test3(Any): String'
TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
@@ -11,10 +11,11 @@ FILE /smartCastsWithDestructuring.kt
CONST String type=kotlin.String value=''
FUN public fun test(x: I1): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=I2
GET_VAR 'value-parameter x: I1' type=I1 origin=null
then: RETURN type=kotlin.Nothing from='test(I1): Unit'
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=I2
GET_VAR 'value-parameter x: I1' type=I1 origin=null
then: RETURN type=kotlin.Nothing from='test(I1): Unit'
COMPOSITE type=kotlin.Unit origin=DESTRUCTURING_DECLARATION
VAR IR_TEMPORARY_VARIABLE val tmp0_container: I1
GET_VAR 'value-parameter x: I1' type=I1 origin=null
+8 -7
View File
@@ -5,10 +5,11 @@ FILE /throw.kt
CALL 'constructor Throwable()' type=kotlin.Throwable origin=null
FUN public fun testImplicitCast(a: kotlin.Any): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Throwable
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: BLOCK type=kotlin.Nothing origin=null
THROW type=kotlin.Nothing
TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Throwable
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Throwable
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: BLOCK type=kotlin.Nothing origin=null
THROW type=kotlin.Nothing
TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Throwable
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
@@ -1,10 +1,11 @@
FILE /tryCatchWithImplicitCast.kt
FUN public fun testImplicitCast(a: kotlin.Any): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='testImplicitCast(Any): Unit'
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='testImplicitCast(Any): Unit'
VAR val t: kotlin.String
TRY type=kotlin.String
try: BLOCK type=kotlin.String origin=null
+9 -6
View File
@@ -3,10 +3,13 @@ FILE /typeArguments.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='test1(Any): Boolean'
WHEN type=kotlin.Boolean origin=ANDAND
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Array<*>
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
then: CALL 'isArrayOf() on Array<*>: Boolean' type=kotlin.Boolean origin=null
<reified T : Any>: String
$receiver: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Array<*>
BRANCH
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Array<*>
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
else: CONST Boolean type=kotlin.Boolean value='false'
then: CALL 'isArrayOf() on Array<*>: Boolean' type=kotlin.Boolean origin=null
<reified T : Any>: String
$receiver: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Array<*>
GET_VAR 'value-parameter x: Any' type=kotlin.Any origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST Boolean type=kotlin.Boolean value='false'
@@ -1,11 +1,12 @@
FILE /varargWithImplicitCast.kt
FUN public fun testScalar(a: kotlin.Any): kotlin.IntArray
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.Int
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='testScalar(Any): IntArray'
CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.Int
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='testScalar(Any): IntArray'
CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null
RETURN type=kotlin.Nothing from='testScalar(Any): IntArray'
CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null
elements: VARARG type=IntArray varargElementType=Int
@@ -13,11 +14,12 @@ FILE /varargWithImplicitCast.kt
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
FUN public fun testSpread(a: kotlin.Any): kotlin.IntArray
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.IntArray
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='testSpread(Any): IntArray'
CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=NOT_INSTANCEOF typeOperand=kotlin.IntArray
GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='testSpread(Any): IntArray'
CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null
RETURN type=kotlin.Nothing from='testSpread(Any): IntArray'
CALL 'intArrayOf(vararg Int): IntArray' type=kotlin.IntArray origin=null
elements: VARARG type=IntArray varargElementType=Int
@@ -34,16 +34,22 @@ FILE /variableAsFunctionCall.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_safe_receiver: kotlin.String?
GET_VAR 'value-parameter ns: String?' type=kotlin.String? origin=null
WHEN type=(() -> kotlin.String)? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'k() on String: () -> String' type=() -> kotlin.String origin=null
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'k() on String: () -> String' type=() -> kotlin.String origin=null
$this: GET_VAR 'tmp0_safe_receiver: String?' type=kotlin.String? origin=null
WHEN type=kotlin.String? origin=SAFE_CALL
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_safe_receiver: (() -> String)?' type=(() -> kotlin.String)? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
else: CALL 'invoke(): String' type=kotlin.String origin=null
$this: GET_VAR 'tmp1_safe_receiver: (() -> String)?' type=(() -> kotlin.String)? origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp1_safe_receiver: (() -> String)?' type=(() -> kotlin.String)? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST Null type=kotlin.Nothing? value='null'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'invoke(): String' type=kotlin.String origin=null
$this: GET_VAR 'tmp1_safe_receiver: (() -> String)?' type=(() -> kotlin.String)? origin=null
+109 -74
View File
@@ -11,46 +11,58 @@ FILE /when.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_subject: kotlin.Any?
GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.String origin=WHEN
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST String type=kotlin.String value='null'
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
arg1: GET_OBJECT 'A' type=A
then: CONST String type=kotlin.String value='A'
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.String
GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='String'
if: CALL 'contains(Any) on Iterable<Any>: Boolean' type=kotlin.Boolean origin=IN
<T>: Any
$receiver: CALL 'setOf(): Set<Nothing>' type=kotlin.collections.Set<kotlin.Nothing> origin=null
<T>: Nothing
element: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='nothingness?'
else: CONST String type=kotlin.String value='something'
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST String type=kotlin.String value='null'
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
arg1: GET_OBJECT 'A' type=A
then: CONST String type=kotlin.String value='A'
BRANCH
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.String
GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='String'
BRANCH
if: CALL 'contains(Any) on Iterable<Any>: Boolean' type=kotlin.Boolean origin=IN
<T>: Any
$receiver: CALL 'setOf(): Set<Nothing>' type=kotlin.collections.Set<kotlin.Nothing> origin=null
<T>: Nothing
element: GET_VAR 'tmp0_subject: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='nothingness?'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST String type=kotlin.String value='something'
FUN public fun test(x: kotlin.Any?): kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='test(Any?): String'
WHEN type=kotlin.String origin=WHEN
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST String type=kotlin.String value='null'
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
arg1: GET_OBJECT 'A' type=A
then: CONST String type=kotlin.String value='A'
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='String'
if: CALL 'contains(Any) on Iterable<Any>: Boolean' type=kotlin.Boolean origin=IN
<T>: Any
$receiver: CALL 'setOf(): Set<Nothing>' type=kotlin.collections.Set<kotlin.Nothing> origin=null
<T>: Nothing
element: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='nothingness?'
else: CONST String type=kotlin.String value='something'
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value='null'
then: CONST String type=kotlin.String value='null'
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
arg1: GET_OBJECT 'A' type=A
then: CONST String type=kotlin.String value='A'
BRANCH
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.String
GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='String'
BRANCH
if: CALL 'contains(Any) on Iterable<Any>: Boolean' type=kotlin.Boolean origin=IN
<T>: Any
$receiver: CALL 'setOf(): Set<Nothing>' type=kotlin.collections.Set<kotlin.Nothing> origin=null
<T>: Nothing
element: GET_VAR 'value-parameter x: Any?' type=kotlin.Any? origin=null
then: CONST String type=kotlin.String value='nothingness?'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST String type=kotlin.String value='something'
FUN public fun testComma(x: kotlin.Int): kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='testComma(Int): String'
@@ -58,46 +70,69 @@ FILE /when.kt
VAR IR_TEMPORARY_VARIABLE val tmp0_subject: kotlin.Int
GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=null
WHEN type=kotlin.String origin=WHEN
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='1'
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='2'
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='3'
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='4'
then: CONST String type=kotlin.String value='1234'
BRANCH
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='5'
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='6'
then: CONST Boolean type=kotlin.Boolean value='true'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='7'
then: CONST String type=kotlin.String value='567'
BRANCH
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='1'
arg1: CONST Int type=kotlin.Int value='8'
then: CONST Boolean type=kotlin.Boolean value='true'
else: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='2'
then: CONST Boolean type=kotlin.Boolean value='true'
else: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='3'
then: CONST Boolean type=kotlin.Boolean value='true'
else: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='4'
then: CONST String type=kotlin.String value='1234'
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='5'
then: CONST Boolean type=kotlin.Boolean value='true'
else: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='6'
then: CONST Boolean type=kotlin.Boolean value='true'
else: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='7'
then: CONST String type=kotlin.String value='567'
if: WHEN type=kotlin.Boolean origin=WHEN_COMMA
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='8'
then: CONST Boolean type=kotlin.Boolean value='true'
else: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'tmp0_subject: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='9'
then: CONST String type=kotlin.String value='89'
else: CONST String type=kotlin.String value='?'
arg1: CONST Int type=kotlin.Int value='9'
then: CONST String type=kotlin.String value='89'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST String type=kotlin.String value='?'
+3 -1
View File
@@ -3,4 +3,6 @@ FILE /whenElse.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='test(): Int'
WHEN type=kotlin.Int origin=WHEN
else: CONST Int type=kotlin.Int value='42'
BRANCH
if: CONST Boolean type=kotlin.Boolean value='true'
then: CONST Int type=kotlin.Int value='42'
+13 -12
View File
@@ -71,15 +71,16 @@ FILE /whileDoWhile.kt
BLOCK_BODY
VAR val a: kotlin.Any? = null
CONST Null type=kotlin.Nothing? value='null'
WHEN type=kotlin.Unit origin=IF
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Boolean
GET_VAR 'a: Any?' type=kotlin.Any? origin=null
then: BLOCK type=kotlin.Unit origin=null
WHILE label=null origin=WHILE_LOOP
condition: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
GET_VAR 'a: Any?' type=kotlin.Any? origin=null
body: BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Unit origin=null
condition: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
GET_VAR 'a: Any?' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP origin=INSTANCEOF typeOperand=kotlin.Boolean
GET_VAR 'a: Any?' type=kotlin.Any? origin=null
then: BLOCK type=kotlin.Unit origin=null
WHILE label=null origin=WHILE_LOOP
condition: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
GET_VAR 'a: Any?' type=kotlin.Any? origin=null
body: BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Unit origin=null
condition: TYPE_OP origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
GET_VAR 'a: Any?' type=kotlin.Any? origin=null
+12 -10
View File
@@ -34,11 +34,12 @@ FILE /nonLocalReturn.kt
action: BLOCK type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun <anonymous>(it: kotlin.Int): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='0'
then: RETURN type=kotlin.Nothing from='<anonymous>(Int): Unit'
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='0'
then: RETURN type=kotlin.Nothing from='<anonymous>(Int): Unit'
RETURN type=kotlin.Nothing from='<anonymous>(Int): Unit'
CALL 'print(Int): Unit' type=kotlin.Unit origin=null
message: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null
@@ -51,11 +52,12 @@ FILE /nonLocalReturn.kt
action: BLOCK type=(kotlin.Int) -> kotlin.Unit origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun <anonymous>(it: kotlin.Int): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='0'
then: RETURN type=kotlin.Nothing from='<anonymous>(Int): Unit'
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value='0'
then: RETURN type=kotlin.Nothing from='<anonymous>(Int): Unit'
RETURN type=kotlin.Nothing from='<anonymous>(Int): Unit'
CALL 'print(Int): Unit' type=kotlin.Unit origin=null
message: GET_VAR 'value-parameter it: Int' type=kotlin.Int origin=null
+13 -12
View File
@@ -14,18 +14,19 @@ FILE /coercionInLoop.kt
$this: GET_VAR 'x: DoubleIterator' type=kotlin.collections.DoubleIterator origin=null
body: TYPE_OP origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=IF
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'get(Int): Double' type=kotlin.Double origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'a: DoubleArray' type=kotlin.DoubleArray origin=null
index: GET_VAR 'i: Int' type=kotlin.Int origin=null
arg1: CALL 'next(): Double' type=kotlin.Double origin=null
$this: GET_VAR 'x: DoubleIterator' type=kotlin.collections.DoubleIterator origin=null
then: RETURN type=kotlin.Nothing from='box(): String'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value='Fail '
GET_VAR 'i: Int' type=kotlin.Int origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'NOT(Boolean): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'EQEQ(Any?, Any?): Boolean' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'get(Int): Double' type=kotlin.Double origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'a: DoubleArray' type=kotlin.DoubleArray origin=null
index: GET_VAR 'i: Int' type=kotlin.Int origin=null
arg1: CALL 'next(): Double' type=kotlin.Double origin=null
$this: GET_VAR 'x: DoubleIterator' type=kotlin.collections.DoubleIterator origin=null
then: RETURN type=kotlin.Nothing from='box(): String'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value='Fail '
GET_VAR 'i: Int' type=kotlin.Int origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE val tmp0: kotlin.Int
GET_VAR 'i: Int' type=kotlin.Int origin=POSTFIX_INCR