[FIR2IR] Don't replace while loop and when branch body blocks with single expression. Skip some empty blocks.

https://youtrack.jetbrains.com/issue/KT-60264/K2-while-loop-body-block-sometimes-replaced-with-single-expression

Merge-request: KT-MR-12035
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2023-09-18 15:27:19 +00:00
committed by Space Team
parent f4df4f8007
commit 9a2eff6487
61 changed files with 601 additions and 1102 deletions
@@ -6,10 +6,7 @@
package org.jetbrains.kotlin.fir.backend package org.jetbrains.kotlin.fir.backend
import com.intellij.psi.tree.IElementType import com.intellij.psi.tree.IElementType
import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.*
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.KtPsiSourceElement
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.contracts.description.LogicOperationKind import org.jetbrains.kotlin.contracts.description.LogicOperationKind
import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.Visibilities
@@ -26,6 +23,7 @@ import org.jetbrains.kotlin.fir.deserialization.toQualifiedPropertyAccessExpress
import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.expressions.impl.FirContractCallBlock import org.jetbrains.kotlin.fir.expressions.impl.FirContractCallBlock
import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition
import org.jetbrains.kotlin.fir.expressions.impl.FirEmptyExpressionBlock
import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression
import org.jetbrains.kotlin.fir.extensions.extensionService import org.jetbrains.kotlin.fir.extensions.extensionService
import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.references.*
@@ -59,6 +57,7 @@ import org.jetbrains.kotlin.psi.KtBinaryExpression
import org.jetbrains.kotlin.psi.KtForExpression import org.jetbrains.kotlin.psi.KtForExpression
import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.util.OperatorNameConventions import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.kotlin.utils.addIfNotNull
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
import org.jetbrains.kotlin.utils.addToStdlib.runUnless import org.jetbrains.kotlin.utils.addToStdlib.runUnless
@@ -1077,6 +1076,10 @@ class Fir2IrVisitor(
return it return it
} }
} }
if (source?.kind is KtRealSourceElementKind) {
val lastStatementHasNothingType = (statements.lastOrNull() as? FirExpression)?.resolvedType?.isNothing == true
return statements.convertToIrBlock(source, origin, forceUnitType = origin?.isLoop == true || lastStatementHasNothingType)
}
return statements.convertToIrExpressionOrBlock(source, origin) return statements.convertToIrExpressionOrBlock(source, origin)
} }
@@ -1111,18 +1114,19 @@ class Fir2IrVisitor(
return source.convertWithOffsets { startOffset, endOffset -> return source.convertWithOffsets { startOffset, endOffset ->
if (origin == IrStatementOrigin.DO_WHILE_LOOP) { if (origin == IrStatementOrigin.DO_WHILE_LOOP) {
IrCompositeImpl( IrCompositeImpl(
startOffset, endOffset, type, origin, startOffset, endOffset, type, null,
mapToIrStatements(recognizePostfixIncDec = false).filterNotNull() mapToIrStatements(recognizePostfixIncDec = false).filterNotNull()
) )
} else { } else {
val irStatements = mapToIrStatements() val irStatements = mapToIrStatements()
val singleStatement = irStatements.singleOrNull() val singleStatement = irStatements.singleOrNull()
if (singleStatement is IrBlock && if (origin?.isLoop != true && singleStatement is IrBlock &&
(singleStatement.origin == IrStatementOrigin.POSTFIX_INCR || singleStatement.origin == IrStatementOrigin.POSTFIX_DECR) (singleStatement.origin == IrStatementOrigin.POSTFIX_INCR || singleStatement.origin == IrStatementOrigin.POSTFIX_DECR)
) { ) {
singleStatement singleStatement
} else { } else {
IrBlockImpl(startOffset, endOffset, type, origin, irStatements.filterNotNull()) val blockOrigin = if (forceUnitType && origin != IrStatementOrigin.FOR_LOOP) null else origin
IrBlockImpl(startOffset, endOffset, type, blockOrigin, irStatements.filterNotNull())
} }
} }
} }
@@ -1322,32 +1326,35 @@ class Fir2IrVisitor(
condition = convertToIrExpression(whileLoop.condition) condition = convertToIrExpression(whileLoop.condition)
body = if (isForLoop) { body = if (isForLoop) {
/* /*
* for loops in IR should have specific for of their body, because some of lowerings (e.g. `ForLoopLowering`) expects * for loops in IR must have their body in the exact following form
* exactly that shape: * because some of the lowerings (e.g. `ForLoopLowering`) expect it:
* *
* for (x in list) { ...body...} * for (x in list) { ...body...}
* *
* IR (loop body): * IR (loop body):
* IrBlock: * IrBlock:
* x = <iterator>.next() * x = <iterator>.next()
* ... possible destructured loop variables, in case iterator is a tuple: `for ((a,b,c) in list) { ...body...}` ...
* IrBlock: * IrBlock:
* ...body... * ...body...
*/ */
firLoopBody.convertWithOffsets { innerStartOffset, innerEndOffset -> firLoopBody.convertWithOffsets { innerStartOffset, innerEndOffset ->
val loopBodyStatements = firLoopBody.statements val loopBodyStatements = firLoopBody.statements
if (loopBodyStatements.isEmpty()) { val firLoopVarStmt = loopBodyStatements.firstOrNull()
error("Unexpected shape of body of for loop") ?: error("Unexpected shape of for loop body: missing body statements")
val (destructuredLoopVariables, realStatements) = loopBodyStatements.drop(1).partition {
it is FirProperty && it.initializer is FirComponentCall
} }
val loopVariables = mutableListOf<IrStatement>() val firExpression = realStatements.singleOrNull() as? FirExpression
var loopVariableIndex = 0 ?: error("Unexpected shape of for loop body: must be single real loop statement, but got ${realStatements.size}")
for (loopBodyStatement in loopBodyStatements) {
if (loopVariableIndex > 0) { val irStatements = buildList {
if (loopBodyStatement !is FirProperty || loopBodyStatement.initializer !is FirComponentCall) { addIfNotNull(firLoopVarStmt.toIrStatement())
break destructuredLoopVariables.forEach { addIfNotNull(it.toIrStatement()) }
} if (firExpression !is FirEmptyExpressionBlock) {
add(convertToIrExpression(firExpression))
} }
loopBodyStatement.toIrStatement()?.let { loopVariables.add(it) }
loopVariableIndex++
} }
IrBlockImpl( IrBlockImpl(
@@ -1355,12 +1362,11 @@ class Fir2IrVisitor(
innerEndOffset, innerEndOffset,
irBuiltIns.unitType, irBuiltIns.unitType,
origin, origin,
loopVariables + irStatements,
loopBodyStatements.drop(loopVariableIndex).convertToIrExpressionOrBlock(firLoopBody.source, null)
) )
} }
} else { } else {
firLoopBody.convertToIrExpressionOrBlock() firLoopBody.convertToIrExpressionOrBlock(origin)
} }
loopMap.remove(whileLoop) loopMap.remove(whileLoop)
} }
@@ -84,12 +84,13 @@ FILE fqName:<root> fileName:/noSymbolForIntRangeIterator.kt
VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val] VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator declared in <root>.test.localFunc.<anonymous>' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'val tmp_2: kotlin.collections.IntIterator declared in <root>.test.localFunc.<anonymous>' type=kotlin.collections.IntIterator origin=null
CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder declared in kotlin.text' type=java.lang.StringBuilder origin=null BLOCK type=java.lang.StringBuilder origin=null
$receiver: GET_VAR '$this$buildString: java.lang.StringBuilder declared in <root>.test.localFunc.<anonymous>' type=java.lang.StringBuilder origin=null CALL 'public final fun appendLine (value: kotlin.String?): java.lang.StringBuilder declared in kotlin.text' type=java.lang.StringBuilder origin=null
value: STRING_CONCATENATION type=kotlin.String $receiver: GET_VAR '$this$buildString: java.lang.StringBuilder declared in <root>.test.localFunc.<anonymous>' type=java.lang.StringBuilder origin=null
CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL value: STRING_CONCATENATION type=kotlin.String
$this: GET_VAR 'val i: kotlin.Int declared in <root>.test.localFunc' type=kotlin.Int origin=null CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
other: GET_VAR 'val j: kotlin.Int declared in <root>.test.localFunc.<anonymous>' type=kotlin.Int origin=null $this: GET_VAR 'val i: kotlin.Int declared in <root>.test.localFunc' type=kotlin.Int origin=null
other: GET_VAR 'val j: kotlin.Int declared in <root>.test.localFunc.<anonymous>' type=kotlin.Int origin=null
CALL 'public final fun takeString (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null CALL 'public final fun takeString (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: GET_VAR 'val s: kotlin.String declared in <root>.test.localFunc' type=kotlin.String origin=null s: GET_VAR 'val s: kotlin.String declared in <root>.test.localFunc' type=kotlin.String origin=null
CALL 'local final fun localFunc (): kotlin.Unit declared in <root>.test' type=kotlin.Unit origin=null CALL 'local final fun localFunc (): kotlin.Unit declared in <root>.test' type=kotlin.Unit origin=null
@@ -1,83 +0,0 @@
FILE fqName:<root> fileName:/dp.kt
CLASS CLASS name:View modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.View
CONSTRUCTOR visibility:public <> () returnType:<root>.View [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:View modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:coefficient visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:coefficient type:kotlin.Int visibility:private [final]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-coefficient> visibility:public modality:FINAL <> ($this:<root>.View) returnType:kotlin.Int
correspondingProperty: PROPERTY name:coefficient visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.View
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-coefficient> (): kotlin.Int declared in <root>.View'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:coefficient type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.View declared in <root>.View.<get-coefficient>' type=<root>.View origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
PROPERTY name:dp visibility:public modality:FINAL [val]
FUN name:<get-dp> visibility:public modality:FINAL <> ($receiver:kotlin.Int, $context_receiver_0:<root>.View) returnType:kotlin.Int
correspondingProperty: PROPERTY name:dp visibility:public modality:FINAL [val]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int
VALUE_PARAMETER name:$context_receiver_0 index:0 type:<root>.View
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-dp> ($context_receiver_0: <root>.View): kotlin.Int declared in <root>'
CALL 'public final fun times (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: CALL 'public final fun <get-coefficient> (): kotlin.Int declared in <root>.View' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '$context_receiver_0: <root>.View declared in <root>.<get-dp>' type=<root>.View origin=null
other: GET_VAR '<this>: kotlin.Int declared in <root>.<get-dp>' type=kotlin.Int origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
CALL 'public final fun with <T, R> (receiver: T of kotlin.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.with, R of kotlin.with>): R of kotlin.with declared in kotlin' type=kotlin.Nothing origin=null
<T>: <root>.View
<R>: kotlin.Nothing
receiver: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.View' type=<root>.View origin=null
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.View, kotlin.Nothing> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.View) returnType:kotlin.Nothing
$receiver: VALUE_PARAMETER name:$this$with type:<root>.View
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun map <T, R> (transform: kotlin.Function1<T of kotlin.collections.map, R of kotlin.collections.map>): kotlin.collections.List<R of kotlin.collections.map> declared in kotlin.collections' type=kotlin.collections.List<kotlin.Int> origin=null
<T>: kotlin.Int
<R>: kotlin.Int
$receiver: CALL 'public final fun listOf <T> (vararg elements: T of kotlin.collections.listOf): kotlin.collections.List<T of kotlin.collections.listOf> declared in kotlin.collections' type=kotlin.collections.List<kotlin.Int> origin=null
<T>: kotlin.Int
elements: VARARG type=kotlin.Array<out kotlin.Int> varargElementType=kotlin.Int
CONST Int type=kotlin.Int value=1
CONST Int type=kotlin.Int value=2
CONST Int type=kotlin.Int value=10
transform: FUN_EXPR type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): kotlin.Int declared in <root>.box.<anonymous>'
CALL 'public final fun <get-dp> ($context_receiver_0: <root>.View): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
$receiver: GET_VAR 'it: kotlin.Int declared in <root>.box.<anonymous>.<anonymous>' type=kotlin.Int origin=null
$context_receiver_0: GET_VAR '$this$with: <root>.View declared in <root>.box.<anonymous>' type=<root>.View origin=null
arg1: CALL 'public final fun listOf <T> (vararg elements: T of kotlin.collections.listOf): kotlin.collections.List<T of kotlin.collections.listOf> declared in kotlin.collections' type=kotlin.collections.List<kotlin.Int> origin=null
<T>: kotlin.Int
elements: VARARG type=kotlin.Array<out kotlin.Int> varargElementType=kotlin.Int
CONST Int type=kotlin.Int value=42
CONST Int type=kotlin.Int value=84
CONST Int type=kotlin.Int value=420
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="fail"
@@ -1,30 +0,0 @@
class View {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
val coefficient: Int
field = 42
get
}
val Int.dp: Int
get($context_receiver_0: View): Int {
return $context_receiver_0.<get-coefficient>().times(other = <this>)
}
fun box(): String {
with<View, Nothing>(receiver = View(), block = local fun View.<anonymous>(): Nothing {
when {
EQEQ(arg0 = listOf<Int>(elements = [1, 2, 10]).map<Int, Int>(transform = local fun <anonymous>(it: Int): Int {
return it.<get-dp>($context_receiver_0 = $this$with)
}
), arg1 = listOf<Int>(elements = [42, 84, 420])) -> return "OK"
}
return "fail"
}
)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ContextReceivers // !LANGUAGE: +ContextReceivers
// WITH_STDLIB // WITH_STDLIB
class View { class View {
@@ -1,12 +0,0 @@
FILE fqName:<root> fileName:/localVarInDoWhile.kt
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP
VAR name:x type:kotlin.Int [val]
CONST Int type=kotlin.Int value=42
condition: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'val x: kotlin.Int declared in <root>.foo' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=42
@@ -1,7 +0,0 @@
fun foo() {
{ // BLOCK
do// COMPOSITE {
val x: Int = 42
// } while (EQEQ(arg0 = x, arg1 = 42).not())
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun foo() { fun foo() {
do { do {
val x = 42 val x = 42
@@ -1,53 +0,0 @@
FILE fqName:<root> fileName:/breakContinue.kt
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
WHILE label=null origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BREAK label=null loop.label=null
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: BREAK label=null loop.label=null
condition: CONST Boolean type=kotlin.Boolean value=true
WHILE label=null origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: CONTINUE label=null loop.label=null
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: CONTINUE label=null loop.label=null
condition: CONST Boolean type=kotlin.Boolean value=true
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
WHILE label=OUTER origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Nothing origin=null
WHILE label=INNER origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Nothing origin=null
BREAK label=INNER loop.label=INNER
BREAK label=OUTER loop.label=OUTER
BREAK label=OUTER loop.label=OUTER
WHILE label=OUTER origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Nothing origin=null
WHILE label=INNER origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Nothing origin=null
CONTINUE label=INNER loop.label=INNER
CONTINUE label=OUTER loop.label=OUTER
CONTINUE label=OUTER loop.label=OUTER
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
WHILE label=L origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Nothing origin=null
WHILE label=L origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BREAK label=L loop.label=L
BREAK label=L loop.label=L
WHILE label=L origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Nothing origin=null
WHILE label=L origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true
body: CONTINUE label=L loop.label=L
CONTINUE label=L loop.label=L
@@ -1,38 +0,0 @@
fun test1() {
while (true) break
{ // BLOCK
dobreak while (true)
}
while (true) continue
{ // BLOCK
docontinue while (true)
}
}
fun test2() {
OUTER@ while (true) { // BLOCK
INNER@ while (true) { // BLOCK
break@INNER
break@OUTER
}
break@OUTER
}
OUTER@ while (true) { // BLOCK
INNER@ while (true) { // BLOCK
continue@INNER
continue@OUTER
}
continue@OUTER
}
}
fun test3() {
L@ while (true) { // BLOCK
L@ while (true) break@L
break@L
}
L@ while (true) { // BLOCK
L@ while (true) continue@L
continue@L
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun test1() { fun test1() {
while (true) { break } while (true) { break }
do { break } while (true) do { break } while (true)
@@ -67,7 +67,6 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.String> declared in <root>.test3' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.String> declared in <root>.test3' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Unit origin=null
FUN name:test4 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>?) returnType:kotlin.Unit FUN name:test4 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>?) returnType:kotlin.Unit
VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>? VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>?
BLOCK_BODY BLOCK_BODY
@@ -96,7 +95,6 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<kotlin.String> declared in <root>.test4' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<kotlin.String> declared in <root>.test4' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Unit origin=null
FUN name:test5 visibility:public modality:FINAL <> () returnType:kotlin.Unit FUN name:test5 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY BLOCK_BODY
VAR name:i type:kotlin.Int [var] VAR name:i type:kotlin.Int [var]
@@ -114,11 +112,12 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
CONST Int type=kotlin.Int value=0 CONST Int type=kotlin.Int value=0
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=Inner origin=DO_WHILE_LOOP DO_WHILE label=Inner origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Int origin=null body: COMPOSITE type=kotlin.Unit origin=null
SET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Unit origin=PREFIX_INCR BLOCK type=kotlin.Int origin=null
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null SET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Unit origin=PREFIX_INCR
$this: GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null $this: GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
GET_VAR 'var j: kotlin.Int declared in <root>.test5' type=kotlin.Int origin=null
condition: WHEN type=kotlin.Boolean origin=IF condition: WHEN type=kotlin.Boolean origin=IF
BRANCH BRANCH
if: CALL 'public final fun greaterOrEqual (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GTEQ if: CALL 'public final fun greaterOrEqual (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GTEQ
@@ -36,8 +36,6 @@ fun test3(ss: List<String>?) {
}.iterator() }.iterator()
L2@ while (<iterator>.hasNext()) { // BLOCK L2@ while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next() val s: String = <iterator>.next()
{ // BLOCK
}
} }
} }
} }
@@ -55,8 +53,6 @@ fun test4(ss: List<String>?) {
}.iterator() }.iterator()
L2@ while (<iterator>.hasNext()) { // BLOCK L2@ while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next() val s: String = <iterator>.next()
{ // BLOCK
}
} }
} }
} }
@@ -71,10 +67,12 @@ fun test5() {
} /*~> Unit */ } /*~> Unit */
var j: Int = 0 var j: Int = 0
{ // BLOCK { // BLOCK
Inner@ do{ // BLOCK Inner@ do// COMPOSITE {
{ // BLOCK
j = j.inc() j = j.inc()
j j
} while (when { }
// } while (when {
greaterOrEqual(arg0 = j, arg1 = 3) -> false greaterOrEqual(arg0 = j, arg1 = 3) -> false
else -> break@Inner else -> break@Inner
}) })
@@ -23,12 +23,13 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
VAR FOR_LOOP_VARIABLE name:x type:kotlin.Int [val] VAR FOR_LOOP_VARIABLE name:x type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_0: kotlin.collections.IntIterator declared in <root>.testBreakFor' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'val tmp_0: kotlin.collections.IntIterator declared in <root>.testBreakFor' type=kotlin.collections.IntIterator origin=null
WHEN type=kotlin.Unit origin=WHEN BLOCK type=kotlin.Unit origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT BRANCH
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakFor' type=kotlin.Int origin=null if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg1: CONST Int type=kotlin.Int value=2 arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakFor' type=kotlin.Int origin=null
then: BREAK label=null loop.label=null arg1: CONST Int type=kotlin.Int value=2
then: BREAK label=null loop.label=null
FUN name:testBreakWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit FUN name:testBreakWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY BLOCK_BODY
VAR name:k type:kotlin.Int [var] VAR name:k type:kotlin.Int [var]
@@ -37,24 +38,26 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakWhile' type=kotlin.Int origin=null arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakWhile' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10 arg1: CONST Int type=kotlin.Int value=10
body: WHEN type=kotlin.Unit origin=WHEN body: BLOCK type=kotlin.Unit origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT BRANCH
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakWhile' type=kotlin.Int origin=null if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg1: CONST Int type=kotlin.Int value=2 arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakWhile' type=kotlin.Int origin=null
then: BREAK label=null loop.label=null arg1: CONST Int type=kotlin.Int value=2
then: BREAK label=null loop.label=null
FUN name:testBreakDoWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit FUN name:testBreakDoWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY BLOCK_BODY
VAR name:k type:kotlin.Int [var] VAR name:k type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0 CONST Int type=kotlin.Int value=0
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP
body: WHEN type=kotlin.Unit origin=WHEN body: COMPOSITE type=kotlin.Unit origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT BRANCH
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakDoWhile' type=kotlin.Int origin=null if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg1: CONST Int type=kotlin.Int value=2 arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakDoWhile' type=kotlin.Int origin=null
then: BREAK label=null loop.label=null arg1: CONST Int type=kotlin.Int value=2
then: BREAK label=null loop.label=null
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakDoWhile' type=kotlin.Int origin=null arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testBreakDoWhile' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10 arg1: CONST Int type=kotlin.Int value=10
@@ -82,12 +85,13 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
VAR FOR_LOOP_VARIABLE name:x type:kotlin.Int [val] VAR FOR_LOOP_VARIABLE name:x type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_1: kotlin.collections.IntIterator declared in <root>.testContinueFor' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'val tmp_1: kotlin.collections.IntIterator declared in <root>.testContinueFor' type=kotlin.collections.IntIterator origin=null
WHEN type=kotlin.Unit origin=WHEN BLOCK type=kotlin.Unit origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT BRANCH
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testContinueFor' type=kotlin.Int origin=null if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg1: CONST Int type=kotlin.Int value=2 arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testContinueFor' type=kotlin.Int origin=null
then: CONTINUE label=null loop.label=null arg1: CONST Int type=kotlin.Int value=2
then: CONTINUE label=null loop.label=null
FUN name:testContinueWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit FUN name:testContinueWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY BLOCK_BODY
VAR name:k type:kotlin.Int [var] VAR name:k type:kotlin.Int [var]
@@ -96,12 +100,13 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testContinueWhile' type=kotlin.Int origin=null arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testContinueWhile' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10 arg1: CONST Int type=kotlin.Int value=10
body: WHEN type=kotlin.Unit origin=WHEN body: BLOCK type=kotlin.Unit origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT BRANCH
arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testContinueWhile' type=kotlin.Int origin=null if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
arg1: CONST Int type=kotlin.Int value=2 arg0: GET_VAR 'var k: kotlin.Int declared in <root>.testContinueWhile' type=kotlin.Int origin=null
then: CONTINUE label=null loop.label=null arg1: CONST Int type=kotlin.Int value=2
then: CONTINUE label=null loop.label=null
FUN name:testContinueDoWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit FUN name:testContinueDoWhile visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY BLOCK_BODY
VAR name:k type:kotlin.Int [var] VAR name:k type:kotlin.Int [var]
@@ -110,7 +115,7 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
CONST String type=kotlin.String value="" CONST String type=kotlin.String value=""
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=null BLOCK type=kotlin.Int origin=null
SET_VAR 'var k: kotlin.Int declared in <root>.testContinueDoWhile' type=kotlin.Unit origin=PREFIX_INCR SET_VAR 'var k: kotlin.Int declared in <root>.testContinueDoWhile' type=kotlin.Unit origin=PREFIX_INCR
@@ -8,8 +8,10 @@ fun testBreakFor() {
val <iterator>: IntIterator = xs.iterator() val <iterator>: IntIterator = xs.iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val x: Int = <iterator>.next() val x: Int = <iterator>.next()
when { { // BLOCK
greater(arg0 = k, arg1 = 2) -> break when {
greater(arg0 = k, arg1 = 2) -> break
}
} }
} }
} }
@@ -17,17 +19,21 @@ fun testBreakFor() {
fun testBreakWhile() { fun testBreakWhile() {
var k: Int = 0 var k: Int = 0
while (less(arg0 = k, arg1 = 10)) when { while (less(arg0 = k, arg1 = 10)) { // BLOCK
greater(arg0 = k, arg1 = 2) -> break when {
greater(arg0 = k, arg1 = 2) -> break
}
} }
} }
fun testBreakDoWhile() { fun testBreakDoWhile() {
var k: Int = 0 var k: Int = 0
{ // BLOCK { // BLOCK
dowhen { do// COMPOSITE {
when {
greater(arg0 = k, arg1 = 2) -> break greater(arg0 = k, arg1 = 2) -> break
} while (less(arg0 = k, arg1 = 10)) }
// } while (less(arg0 = k, arg1 = 10))
} }
} }
@@ -41,8 +47,10 @@ fun testContinueFor() {
val <iterator>: IntIterator = xs.iterator() val <iterator>: IntIterator = xs.iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val x: Int = <iterator>.next() val x: Int = <iterator>.next()
when { { // BLOCK
greater(arg0 = k, arg1 = 2) -> continue when {
greater(arg0 = k, arg1 = 2) -> continue
}
} }
} }
} }
@@ -50,8 +58,10 @@ fun testContinueFor() {
fun testContinueWhile() { fun testContinueWhile() {
var k: Int = 0 var k: Int = 0
while (less(arg0 = k, arg1 = 10)) when { while (less(arg0 = k, arg1 = 10)) { // BLOCK
greater(arg0 = k, arg1 = 2) -> continue when {
greater(arg0 = k, arg1 = 2) -> continue
}
} }
} }
@@ -74,3 +84,4 @@ fun testContinueDoWhile() {
EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw AssertionError(p0 = s) EQEQ(arg0 = s, arg1 = "1;2;").not() -> throw AssertionError(p0 = s)
} }
} }
@@ -159,18 +159,19 @@ FILE fqName:<root> fileName:/exhaustiveWhenElseBranch.kt
then: CONST Int type=kotlin.Int value=0 then: CONST Int type=kotlin.Int value=0
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: BLOCK type=kotlin.Int origin=WHEN then: BLOCK type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:<root>.A [val] BLOCK type=kotlin.Int origin=WHEN
GET_VAR 'a: <root>.A declared in <root>.testIfTheElseStatement_empty' type=<root>.A origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:<root>.A [val]
WHEN type=kotlin.Int origin=WHEN GET_VAR 'a: <root>.A declared in <root>.testIfTheElseStatement_empty' type=<root>.A origin=null
BRANCH WHEN type=kotlin.Int origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_5: <root>.A declared in <root>.testIfTheElseStatement_empty' type=<root>.A origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:V1' type=<root>.A arg0: GET_VAR 'val tmp_5: <root>.A declared in <root>.testIfTheElseStatement_empty' type=<root>.A origin=null
then: CONST Int type=kotlin.Int value=1 arg1: GET_ENUM 'ENUM_ENTRY name:V1' type=<root>.A
BRANCH then: CONST Int type=kotlin.Int value=1
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
FUN name:testIfTheElseParenthesized_throwsJvm visibility:public modality:FINAL <> (a:<root>.A, flag:kotlin.Boolean) returnType:kotlin.Unit FUN name:testIfTheElseParenthesized_throwsJvm visibility:public modality:FINAL <> (a:<root>.A, flag:kotlin.Boolean) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A VALUE_PARAMETER name:a index:0 type:<root>.A
VALUE_PARAMETER name:flag index:1 type:kotlin.Boolean VALUE_PARAMETER name:flag index:1 type:kotlin.Boolean
@@ -182,18 +183,19 @@ FILE fqName:<root> fileName:/exhaustiveWhenElseBranch.kt
then: CONST Int type=kotlin.Int value=0 then: CONST Int type=kotlin.Int value=0
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: BLOCK type=kotlin.Int origin=WHEN then: BLOCK type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:<root>.A [val] BLOCK type=kotlin.Int origin=WHEN
GET_VAR 'a: <root>.A declared in <root>.testIfTheElseParenthesized_throwsJvm' type=<root>.A origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:<root>.A [val]
WHEN type=kotlin.Int origin=WHEN GET_VAR 'a: <root>.A declared in <root>.testIfTheElseParenthesized_throwsJvm' type=<root>.A origin=null
BRANCH WHEN type=kotlin.Int origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_6: <root>.A declared in <root>.testIfTheElseParenthesized_throwsJvm' type=<root>.A origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:V1' type=<root>.A arg0: GET_VAR 'val tmp_6: <root>.A declared in <root>.testIfTheElseParenthesized_throwsJvm' type=<root>.A origin=null
then: CONST Int type=kotlin.Int value=1 arg1: GET_ENUM 'ENUM_ENTRY name:V1' type=<root>.A
BRANCH then: CONST Int type=kotlin.Int value=1
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
FUN name:testIfTheElseAnnotated_throwsJvm visibility:public modality:FINAL <> (a:<root>.A, flag:kotlin.Boolean) returnType:kotlin.Unit FUN name:testIfTheElseAnnotated_throwsJvm visibility:public modality:FINAL <> (a:<root>.A, flag:kotlin.Boolean) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A VALUE_PARAMETER name:a index:0 type:<root>.A
VALUE_PARAMETER name:flag index:1 type:kotlin.Boolean VALUE_PARAMETER name:flag index:1 type:kotlin.Boolean
@@ -205,18 +207,19 @@ FILE fqName:<root> fileName:/exhaustiveWhenElseBranch.kt
then: CONST Int type=kotlin.Int value=0 then: CONST Int type=kotlin.Int value=0
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: BLOCK type=kotlin.Int origin=WHEN then: BLOCK type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:<root>.A [val] BLOCK type=kotlin.Int origin=WHEN
GET_VAR 'a: <root>.A declared in <root>.testIfTheElseAnnotated_throwsJvm' type=<root>.A origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:<root>.A [val]
WHEN type=kotlin.Int origin=WHEN GET_VAR 'a: <root>.A declared in <root>.testIfTheElseAnnotated_throwsJvm' type=<root>.A origin=null
BRANCH WHEN type=kotlin.Int origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_7: <root>.A declared in <root>.testIfTheElseAnnotated_throwsJvm' type=<root>.A origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:V1' type=<root>.A arg0: GET_VAR 'val tmp_7: <root>.A declared in <root>.testIfTheElseAnnotated_throwsJvm' type=<root>.A origin=null
then: CONST Int type=kotlin.Int value=1 arg1: GET_ENUM 'ENUM_ENTRY name:V1' type=<root>.A
BRANCH then: CONST Int type=kotlin.Int value=1
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
FUN name:testLambdaResultExpression_throws visibility:public modality:FINAL <> (a:<root>.A) returnType:kotlin.Unit FUN name:testLambdaResultExpression_throws visibility:public modality:FINAL <> (a:<root>.A) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A VALUE_PARAMETER name:a index:0 type:<root>.A
BLOCK_BODY BLOCK_BODY
@@ -73,10 +73,12 @@ fun testIfTheElseStatement_empty(a: A, flag: Boolean) {
when { when {
flag -> 0 flag -> 0
else -> { // BLOCK else -> { // BLOCK
val tmp5_subject: A = a { // BLOCK
when { val tmp5_subject: A = a
EQEQ(arg0 = tmp5_subject, arg1 = A.V1) -> 1 when {
else -> noWhenBranchMatchedException() EQEQ(arg0 = tmp5_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
} }
} }
} /*~> Unit */ } /*~> Unit */
@@ -86,10 +88,12 @@ fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) {
when { when {
flag -> 0 flag -> 0
else -> { // BLOCK else -> { // BLOCK
val tmp6_subject: A = a { // BLOCK
when { val tmp6_subject: A = a
EQEQ(arg0 = tmp6_subject, arg1 = A.V1) -> 1 when {
else -> noWhenBranchMatchedException() EQEQ(arg0 = tmp6_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
} }
} }
} /*~> Unit */ } /*~> Unit */
@@ -99,10 +103,12 @@ fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) {
when { when {
flag -> 0 flag -> 0
else -> { // BLOCK else -> { // BLOCK
val tmp7_subject: A = a { // BLOCK
when { val tmp7_subject: A = a
EQEQ(arg0 = tmp7_subject, arg1 = A.V1) -> 1 when {
else -> noWhenBranchMatchedException() EQEQ(arg0 = tmp7_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
} }
} }
} /*~> Unit */ } /*~> Unit */
@@ -120,3 +126,4 @@ fun testLambdaResultExpression_throws(a: A) {
} }
.invoke() /*~> Unit */ .invoke() /*~> Unit */
} }
+3 -4
View File
@@ -13,7 +13,6 @@ FILE fqName:<root> fileName:/for.kt
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_0: kotlin.collections.Iterator<kotlin.String> declared in <root>.testEmpty' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator<kotlin.String> declared in <root>.testEmpty' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Unit origin=null
FUN name:testIterable visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>) returnType:kotlin.Unit FUN name:testIterable visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String> VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>
BLOCK_BODY BLOCK_BODY
@@ -28,8 +27,9 @@ FILE fqName:<root> fileName:/for.kt
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_1: kotlin.collections.Iterator<kotlin.String> declared in <root>.testIterable' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_1: kotlin.collections.Iterator<kotlin.String> declared in <root>.testIterable' type=kotlin.collections.Iterator<kotlin.String> origin=null
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
message: GET_VAR 'val s: kotlin.String declared in <root>.testIterable' type=kotlin.String origin=null CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
message: GET_VAR 'val s: kotlin.String declared in <root>.testIterable' type=kotlin.String origin=null
FUN name:testDestructuring visibility:public modality:FINAL <> (pp:kotlin.collections.List<kotlin.Pair<kotlin.Int, kotlin.String>>) returnType:kotlin.Unit FUN name:testDestructuring visibility:public modality:FINAL <> (pp:kotlin.collections.List<kotlin.Pair<kotlin.Int, kotlin.String>>) returnType:kotlin.Unit
VALUE_PARAMETER name:pp index:0 type:kotlin.collections.List<kotlin.Pair<kotlin.Int, kotlin.String>> VALUE_PARAMETER name:pp index:0 type:kotlin.collections.List<kotlin.Pair<kotlin.Int, kotlin.String>>
BLOCK_BODY BLOCK_BODY
@@ -70,4 +70,3 @@ FILE fqName:<root> fileName:/for.kt
VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val] VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null $this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
BLOCK type=kotlin.Unit origin=null
+3 -5
View File
@@ -3,8 +3,6 @@ fun testEmpty(ss: List<String>) {
val <iterator>: Iterator<String> = ss.iterator() val <iterator>: Iterator<String> = ss.iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next() val s: String = <iterator>.next()
{ // BLOCK
}
} }
} }
} }
@@ -14,7 +12,9 @@ fun testIterable(ss: List<String>) {
val <iterator>: Iterator<String> = ss.iterator() val <iterator>: Iterator<String> = ss.iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next() val s: String = <iterator>.next()
println(message = s) { // BLOCK
println(message = s)
}
} }
} }
} }
@@ -39,8 +39,6 @@ fun testRange() {
val <iterator>: IntIterator = 1.rangeTo(other = 10).iterator() val <iterator>: IntIterator = 1.rangeTo(other = 10).iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val i: Int = <iterator>.next() val i: Int = <iterator>.next()
{ // BLOCK
}
} }
} }
} }
@@ -13,7 +13,8 @@ FILE fqName:<root> fileName:/forWithBreakContinue.kt
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_0: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForBreak1' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_0: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForBreak1' type=kotlin.collections.Iterator<kotlin.String> origin=null
BREAK label=null loop.label=null BLOCK type=kotlin.Unit origin=null
BREAK label=null loop.label=null
FUN name:testForBreak2 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>) returnType:kotlin.Unit FUN name:testForBreak2 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String> VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>
BLOCK_BODY BLOCK_BODY
@@ -28,7 +29,7 @@ FILE fqName:<root> fileName:/forWithBreakContinue.kt
VAR FOR_LOOP_VARIABLE name:s1 type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s1 type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_1: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForBreak2' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_1: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForBreak2' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Nothing origin=null BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Unit origin=FOR_LOOP BLOCK type=kotlin.Unit origin=FOR_LOOP
VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator<kotlin.String> [val] VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator<kotlin.String> [val]
CALL 'public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.List> declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=FOR_LOOP_ITERATOR CALL 'public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.List> declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=FOR_LOOP_ITERATOR
@@ -40,7 +41,7 @@ FILE fqName:<root> fileName:/forWithBreakContinue.kt
VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForBreak2' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForBreak2' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Nothing origin=null BLOCK type=kotlin.Unit origin=null
BREAK label=OUTER loop.label=OUTER BREAK label=OUTER loop.label=OUTER
BREAK label=INNER loop.label=INNER BREAK label=INNER loop.label=INNER
BREAK label=INNER loop.label=INNER BREAK label=INNER loop.label=INNER
@@ -59,7 +60,8 @@ FILE fqName:<root> fileName:/forWithBreakContinue.kt
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForContinue1' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_3: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForContinue1' type=kotlin.collections.Iterator<kotlin.String> origin=null
CONTINUE label=null loop.label=null BLOCK type=kotlin.Unit origin=null
CONTINUE label=null loop.label=null
FUN name:testForContinue2 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>) returnType:kotlin.Unit FUN name:testForContinue2 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String> VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>
BLOCK_BODY BLOCK_BODY
@@ -74,7 +76,7 @@ FILE fqName:<root> fileName:/forWithBreakContinue.kt
VAR FOR_LOOP_VARIABLE name:s1 type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s1 type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForContinue2' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForContinue2' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Nothing origin=null BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Unit origin=FOR_LOOP BLOCK type=kotlin.Unit origin=FOR_LOOP
VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator<kotlin.String> [val] VAR FOR_LOOP_ITERATOR name:tmp_5 type:kotlin.collections.Iterator<kotlin.String> [val]
CALL 'public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.List> declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=FOR_LOOP_ITERATOR CALL 'public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.List> declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=FOR_LOOP_ITERATOR
@@ -86,7 +88,7 @@ FILE fqName:<root> fileName:/forWithBreakContinue.kt
VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val] VAR FOR_LOOP_VARIABLE name:s2 type:kotlin.String [val]
CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT CALL 'public abstract fun next (): T of kotlin.collections.Iterator declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForContinue2' type=kotlin.collections.Iterator<kotlin.String> origin=null $this: GET_VAR 'val tmp_5: kotlin.collections.Iterator<kotlin.String> declared in <root>.testForContinue2' type=kotlin.collections.Iterator<kotlin.String> origin=null
BLOCK type=kotlin.Nothing origin=null BLOCK type=kotlin.Unit origin=null
CONTINUE label=OUTER loop.label=OUTER CONTINUE label=OUTER loop.label=OUTER
CONTINUE label=INNER loop.label=INNER CONTINUE label=INNER loop.label=INNER
CONTINUE label=INNER loop.label=INNER CONTINUE label=INNER loop.label=INNER
@@ -3,7 +3,9 @@ fun testForBreak1(ss: List<String>) {
val <iterator>: Iterator<String> = ss.iterator() val <iterator>: Iterator<String> = ss.iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next() val s: String = <iterator>.next()
break { // BLOCK
break
}
} }
} }
} }
@@ -36,7 +38,9 @@ fun testForContinue1(ss: List<String>) {
val <iterator>: Iterator<String> = ss.iterator() val <iterator>: Iterator<String> = ss.iterator()
while (<iterator>.hasNext()) { // BLOCK while (<iterator>.hasNext()) { // BLOCK
val s: String = <iterator>.next() val s: String = <iterator>.next()
continue { // BLOCK
continue
}
} }
} }
} }
@@ -63,3 +67,4 @@ fun testForContinue2(ss: List<String>) {
} }
} }
} }
@@ -119,5 +119,6 @@ FILE fqName:<root> fileName:/forWithImplicitReceivers.kt
CALL 'public open fun next (): kotlin.Int declared in <root>.IReceiver' type=kotlin.Int origin=null CALL 'public open fun next (): kotlin.Int declared in <root>.IReceiver' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.IReceiver declared in <root>.test' type=<root>.IReceiver origin=null $this: GET_VAR '<this>: <root>.IReceiver declared in <root>.test' type=<root>.IReceiver origin=null
$receiver: GET_VAR 'val tmp_1: <root>.IntCell declared in <root>.test' type=<root>.IntCell origin=null $receiver: GET_VAR 'val tmp_1: <root>.IntCell declared in <root>.test' type=<root>.IntCell origin=null
CALL 'public final fun println (message: kotlin.Int): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
message: GET_VAR 'val i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null CALL 'public final fun println (message: kotlin.Int): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null
message: GET_VAR 'val i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
@@ -45,7 +45,10 @@ fun IReceiver.test() {
val <iterator>: IntCell = (<this>, FiveTimes).iterator() val <iterator>: IntCell = (<this>, FiveTimes).iterator()
while ((<this>, <iterator>).hasNext()) { // BLOCK while ((<this>, <iterator>).hasNext()) { // BLOCK
val i: Int = (<this>, <iterator>).next() val i: Int = (<this>, <iterator>).next()
println(message = i) { // BLOCK
println(message = i)
}
} }
} }
} }
@@ -1,40 +0,0 @@
FILE fqName:<root> fileName:/samConversionInVarargsMixed.kt
CLASS INTERFACE name:MyRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyRunnable
FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.MyRunnable) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.MyRunnable
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test visibility:public modality:FINAL <> (a:kotlin.Any, r:<root>.MyRunnable) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
VALUE_PARAMETER name:r index:1 type:<root>.MyRunnable
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.MyRunnable
GET_VAR 'a: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
then: CALL 'public final fun foo (vararg rs: <root>.MyRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
rs: VARARG type=kotlin.Array<out <root>.MyRunnable> varargElementType=<root>.MyRunnable
TYPE_OP type=<root>.MyRunnable origin=SAM_CONVERSION typeOperand=<root>.MyRunnable
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
GET_VAR 'r: <root>.MyRunnable declared in <root>.test' type=<root>.MyRunnable origin=null
TYPE_OP type=<root>.MyRunnable origin=IMPLICIT_CAST typeOperand=<root>.MyRunnable
GET_VAR 'a: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
FUN name:foo visibility:public modality:FINAL <> (rs:kotlin.Array<out <root>.MyRunnable>) returnType:kotlin.Unit
VALUE_PARAMETER name:rs index:0 type:kotlin.Array<out <root>.MyRunnable> varargElementType:<root>.MyRunnable [vararg]
BLOCK_BODY
@@ -1,16 +0,0 @@
fun interface MyRunnable {
abstract fun run()
}
fun test(a: Any, r: MyRunnable) {
when {
a is MyRunnable -> foo(rs = [local fun <anonymous>() {
return Unit
}
/*-> MyRunnable */, r, a /*as MyRunnable */])
}
}
fun foo(vararg rs: MyRunnable) {
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun interface MyRunnable { fun interface MyRunnable {
fun run() fun run()
} }
@@ -42,9 +42,10 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null r: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:<root>.KRunnable) returnType:kotlin.Unit FUN name:test2 visibility:public modality:FINAL <> (a:<root>.KRunnable) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.KRunnable VALUE_PARAMETER name:a index:0 type:<root>.KRunnable
BLOCK_BODY BLOCK_BODY
@@ -61,11 +62,12 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public final fun run2 (r1: <root>.KRunnable, r2: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable CALL 'public final fun run2 (r1: <root>.KRunnable, r2: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null r1: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
r2: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null r2: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit> VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
VALUE_PARAMETER name:b index:1 type:kotlin.Function0<kotlin.Unit> VALUE_PARAMETER name:b index:1 type:kotlin.Function0<kotlin.Unit>
@@ -74,11 +76,12 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public final fun run2 (r1: <root>.KRunnable, r2: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable CALL 'public final fun run2 (r1: <root>.KRunnable, r2: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null r1: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
r2: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null r2: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY BLOCK_BODY
@@ -86,9 +89,10 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
then: CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null r: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY BLOCK_BODY
@@ -19,7 +19,9 @@ fun <T> test0(a: T) where T : KRunnable, T : Function0<Unit> {
fun test1(a: Function0<Unit>) { fun test1(a: Function0<Unit>) {
when { when {
a is KRunnable -> run1(r = a /*as KRunnable */) a is KRunnable -> { // BLOCK
run1(r = a /*as KRunnable */)
}
} }
} }
@@ -30,19 +32,25 @@ fun test2(a: KRunnable) {
fun test3(a: Function0<Unit>) { fun test3(a: Function0<Unit>) {
when { when {
a is KRunnable -> run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */) a is KRunnable -> { // BLOCK
run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */)
}
} }
} }
fun test4(a: Function0<Unit>, b: Function0<Unit>) { fun test4(a: Function0<Unit>, b: Function0<Unit>) {
when { when {
a is KRunnable -> run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */) a is KRunnable -> { // BLOCK
run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */)
}
} }
} }
fun test5(a: Any) { fun test5(a: Any) {
when { when {
a is KRunnable -> run1(r = a /*as KRunnable */) a is KRunnable -> { // BLOCK
run1(r = a /*as KRunnable */)
}
} }
} }
@@ -89,3 +97,4 @@ fun test8(a: Function0<Unit>) {
fun test9() { fun test9() {
run1(r = ::test9 /*-> KRunnable */) run1(r = ::test9 /*-> KRunnable */)
} }
@@ -1,20 +0,0 @@
FILE fqName:<root> fileName:/kt48708.kt
FUN name:test visibility:public modality:FINAL <> (b:kotlin.Boolean) returnType:kotlin.Unit
VALUE_PARAMETER name:b index:0 type:kotlin.Boolean
BLOCK_BODY
VAR name:x type:kotlin.Int [val]
WHEN type=kotlin.Int origin=IF
BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test' type=kotlin.Boolean origin=null
then: CONST Int type=kotlin.Int value=3
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: BLOCK type=kotlin.Int origin=null
THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.lang.Exception' type=java.lang.Exception origin=null
CONST Int type=kotlin.Int value=0
CALL 'public final fun takeInt (x: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
x: GET_VAR 'val x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
FUN name:takeInt visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER name:x index:0 type:kotlin.Int
BLOCK_BODY
@@ -1,13 +0,0 @@
fun test(b: Boolean) {
val x: Int = when {
b -> 3
else -> { // BLOCK
throw Exception()
0
}
}
takeInt(x = x)
}
fun takeInt(x: Int) {
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6 // IGNORE_BACKEND: JS_IR_ES6
// ISSUE: KT-48708 // ISSUE: KT-48708
+8 -5
View File
@@ -5,8 +5,9 @@ FILE fqName:<root> fileName:/kt50028.kt
WHEN type=kotlin.Nothing origin=WHEN WHEN type=kotlin.Nothing origin=WHEN
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: RETURN type=kotlin.Nothing from='public final fun test_1 (): kotlin.String declared in <root>' then: BLOCK type=kotlin.Unit origin=null
CONST String type=kotlin.String value="" RETURN type=kotlin.Nothing from='public final fun test_1 (): kotlin.String declared in <root>'
CONST String type=kotlin.String value=""
FUN name:test_2 visibility:public modality:FINAL <> (b:kotlin.Boolean) returnType:kotlin.Boolean FUN name:test_2 visibility:public modality:FINAL <> (b:kotlin.Boolean) returnType:kotlin.Boolean
VALUE_PARAMETER name:b index:0 type:kotlin.Boolean VALUE_PARAMETER name:b index:0 type:kotlin.Boolean
BLOCK_BODY BLOCK_BODY
@@ -14,8 +15,10 @@ FILE fqName:<root> fileName:/kt50028.kt
WHEN type=kotlin.Boolean origin=IF WHEN type=kotlin.Boolean origin=IF
BRANCH BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test_2' type=kotlin.Boolean origin=null if: GET_VAR 'b: kotlin.Boolean declared in <root>.test_2' type=kotlin.Boolean origin=null
then: CONST Boolean type=kotlin.Boolean value=true then: BLOCK type=kotlin.Boolean origin=null
CONST Boolean type=kotlin.Boolean value=true
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: THROW type=kotlin.Nothing then: BLOCK type=kotlin.Unit origin=null
CONSTRUCTOR_CALL 'public constructor <init> (message: kotlin.String) declared in kotlin.NotImplementedError' type=kotlin.NotImplementedError origin=null THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> (message: kotlin.String) declared in kotlin.NotImplementedError' type=kotlin.NotImplementedError origin=null
+10 -3
View File
@@ -1,12 +1,19 @@
fun test_1(): String { fun test_1(): String {
return when { return when {
else -> return "" else -> { // BLOCK
return ""
}
} }
} }
fun test_2(b: Boolean): Boolean { fun test_2(b: Boolean): Boolean {
return when { return when {
b -> true b -> { // BLOCK
else -> throw NotImplementedError() true
}
else -> { // BLOCK
throw NotImplementedError()
}
} }
} }
@@ -6,17 +6,18 @@ FILE fqName:<root> fileName:/genericSamSmartcast.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.A<*> if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.A<*>
GET_VAR 'x: kotlin.Any declared in <root>.f' type=kotlin.Any origin=null GET_VAR 'x: kotlin.Any declared in <root>.f' type=kotlin.Any origin=null
then: RETURN type=kotlin.Nothing from='public final fun f (x: kotlin.Any): kotlin.String declared in <root>' then: BLOCK type=kotlin.Unit origin=null
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String RETURN type=kotlin.Nothing from='public final fun f (x: kotlin.Any): kotlin.String declared in <root>'
CALL 'public open fun call (block: @[FlexibleNullability] <root>.A.I<@[FlexibleNullability] T of <root>.A?>?): @[FlexibleNullability] kotlin.String? declared in <root>.A' type=@[FlexibleNullability] kotlin.String? origin=null TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
$this: TYPE_OP type=<root>.A<*> origin=IMPLICIT_CAST typeOperand=<root>.A<*> CALL 'public open fun call (block: @[FlexibleNullability] <root>.A.I<@[FlexibleNullability] T of <root>.A?>?): @[FlexibleNullability] kotlin.String? declared in <root>.A' type=@[FlexibleNullability] kotlin.String? origin=null
GET_VAR 'x: kotlin.Any declared in <root>.f' type=kotlin.Any origin=null $this: TYPE_OP type=<root>.A<*> origin=IMPLICIT_CAST typeOperand=<root>.A<*>
block: TYPE_OP type=@[FlexibleNullability] <root>.A.I<out @[FlexibleNullability] kotlin.Any?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.A.I<out @[FlexibleNullability] kotlin.Any?>? GET_VAR 'x: kotlin.Any declared in <root>.f' type=kotlin.Any origin=null
FUN_EXPR type=kotlin.Function1<kotlin.Any?, @[FlexibleNullability] kotlin.String?> origin=LAMBDA block: TYPE_OP type=@[FlexibleNullability] <root>.A.I<out @[FlexibleNullability] kotlin.Any?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.A.I<out @[FlexibleNullability] kotlin.Any?>?
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (y:kotlin.Any?) returnType:@[FlexibleNullability] kotlin.String? FUN_EXPR type=kotlin.Function1<kotlin.Any?, @[FlexibleNullability] kotlin.String?> origin=LAMBDA
VALUE_PARAMETER name:y index:0 type:kotlin.Any? FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (y:kotlin.Any?) returnType:@[FlexibleNullability] kotlin.String?
BLOCK_BODY VALUE_PARAMETER name:y index:0 type:kotlin.Any?
RETURN type=kotlin.Nothing from='local final fun <anonymous> (y: kotlin.Any?): @[FlexibleNullability] kotlin.String? declared in <root>.f' BLOCK_BODY
CONST String type=kotlin.String value="OK" RETURN type=kotlin.Nothing from='local final fun <anonymous> (y: kotlin.Any?): @[FlexibleNullability] kotlin.String? declared in <root>.f'
CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='public final fun f (x: kotlin.Any): kotlin.String declared in <root>' RETURN type=kotlin.Nothing from='public final fun f (x: kotlin.Any): kotlin.String declared in <root>'
CONST String type=kotlin.String value="Fail" CONST String type=kotlin.String value="Fail"
@@ -1,9 +1,12 @@
fun f(x: Any): String { fun f(x: Any): String {
when { when {
x is A<*> -> return x /*as A<*> */.call(block = local fun <anonymous>(y: Any?): @FlexibleNullability String? { x is A<*> -> { // BLOCK
return "OK" return x /*as A<*> */.call(block = local fun <anonymous>(y: Any?): @FlexibleNullability String? {
} return "OK"
}
/*-> @FlexibleNullability I<out @FlexibleNullability Any?>? */) /*!! String */ /*-> @FlexibleNullability I<out @FlexibleNullability Any?>? */) /*!! String */
}
} }
return "Fail" return "Fail"
} }
@@ -6,9 +6,10 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public open fun runStatic (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable CALL 'public open fun runStatic (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit> VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY BLOCK_BODY
@@ -16,10 +17,11 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable $this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=null r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit> VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY BLOCK_BODY
@@ -27,12 +29,13 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable $this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r2: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null r2: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit> VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
VALUE_PARAMETER name:b index:1 type:kotlin.Function0<kotlin.Unit> VALUE_PARAMETER name:b index:1 type:kotlin.Function0<kotlin.Unit>
@@ -41,12 +44,13 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
then: CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable $this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r2: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable? GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null r2: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable?
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY BLOCK_BODY
@@ -54,10 +58,11 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
then: CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable $this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY BLOCK_BODY
@@ -1,30 +1,40 @@
fun test1(a: Function0<Unit>) { fun test1(a: Function0<Unit>) {
when { when {
a is Runnable -> runStatic(r = a /*as Runnable */) a is Runnable -> { // BLOCK
runStatic(r = a /*as Runnable */)
}
} }
} }
fun test2(a: Function0<Unit>) { fun test2(a: Function0<Unit>) {
when { when {
a is Runnable -> J().run1(r = a /*as Runnable */) a is Runnable -> { // BLOCK
J().run1(r = a /*as Runnable */)
}
} }
} }
fun test3(a: Function0<Unit>) { fun test3(a: Function0<Unit>) {
when { when {
a is Runnable -> J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */) a is Runnable -> { // BLOCK
J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */)
}
} }
} }
fun test4(a: Function0<Unit>, b: Function0<Unit>) { fun test4(a: Function0<Unit>, b: Function0<Unit>) {
when { when {
a is Runnable -> J().run2(r1 = a /*as Runnable */, r2 = b /*-> @FlexibleNullability Runnable? */) a is Runnable -> { // BLOCK
J().run2(r1 = a /*as Runnable */, r2 = b /*-> @FlexibleNullability Runnable? */)
}
} }
} }
fun test5(a: Any) { fun test5(a: Any) {
when { when {
a is Runnable -> J().run1(r = a /*as Runnable */) a is Runnable -> { // BLOCK
J().run1(r = a /*as Runnable */)
}
} }
} }
@@ -54,3 +64,4 @@ fun test8(a: Function0<Unit>) {
fun test9() { fun test9() {
J().run1(r = ::test9 /*-> @FlexibleNullability Runnable? */) J().run1(r = ::test9 /*-> @FlexibleNullability Runnable? */)
} }
@@ -1,15 +0,0 @@
FILE fqName:<root> fileName:/throw.kt
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Throwable' type=kotlin.Throwable origin=null
FUN name:testImplicitCast visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Throwable
GET_VAR 'a: kotlin.Any declared in <root>.testImplicitCast' type=kotlin.Any origin=null
then: THROW type=kotlin.Nothing
TYPE_OP type=kotlin.Throwable origin=IMPLICIT_CAST typeOperand=kotlin.Throwable
GET_VAR 'a: kotlin.Any declared in <root>.testImplicitCast' type=kotlin.Any origin=null
@@ -1,9 +0,0 @@
fun test1() {
throw Throwable()
}
fun testImplicitCast(a: Any) {
when {
a is Throwable -> throw a /*as Throwable */
}
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun test1() { fun test1() {
throw Throwable() throw Throwable()
} }
@@ -82,59 +82,61 @@ FILE fqName:<root> fileName:/whenSmartCastToEnum.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.En if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.En
GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
then: BLOCK type=kotlin.Unit origin=WHEN then: BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.En [val] BLOCK type=kotlin.Unit origin=WHEN
TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.En [val]
GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En
WHEN type=kotlin.Unit origin=WHEN GET_VAR 'val x: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
then: BLOCK type=kotlin.Unit origin=null arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ then: BLOCK type=kotlin.Unit origin=null
CONST String type=kotlin.String value="when1" SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ
BRANCH CONST String type=kotlin.String value="when1"
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
then: BLOCK type=kotlin.Unit origin=null arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En
BRANCH then: BLOCK type=kotlin.Unit origin=null
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En arg0: GET_VAR 'val tmp_0: <root>.En declared in <root>.test' type=<root>.En origin=null
then: BLOCK type=kotlin.Unit origin=null arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En
BRANCH then: BLOCK type=kotlin.Unit origin=null
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
VAR name:y type:kotlin.Any [val] VAR name:y type:kotlin.Any [val]
GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
WHEN type=kotlin.Unit origin=IF WHEN type=kotlin.Unit origin=IF
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.En if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.En
GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
then: BLOCK type=kotlin.Unit origin=WHEN then: BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.En [val] BLOCK type=kotlin.Unit origin=WHEN
TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.En [val]
GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null TYPE_OP type=<root>.En origin=IMPLICIT_CAST typeOperand=<root>.En
WHEN type=kotlin.Unit origin=WHEN GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
then: BLOCK type=kotlin.Unit origin=null arg1: GET_ENUM 'ENUM_ENTRY name:A' type=<root>.En
SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ then: BLOCK type=kotlin.Unit origin=null
CONST String type=kotlin.String value="when2" SET_VAR 'var r: kotlin.String declared in <root>.test' type=kotlin.Unit origin=EQ
BRANCH CONST String type=kotlin.String value="when2"
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
then: BLOCK type=kotlin.Unit origin=null arg1: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.En
BRANCH then: BLOCK type=kotlin.Unit origin=null
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En arg0: GET_VAR 'val tmp_1: <root>.En declared in <root>.test' type=<root>.En origin=null
then: BLOCK type=kotlin.Unit origin=null arg1: GET_ENUM 'ENUM_ENTRY name:C' type=<root>.En
BRANCH then: BLOCK type=kotlin.Unit origin=null
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun noWhenBranchMatchedException (): kotlin.Nothing declared in kotlin.internal.ir' type=kotlin.Nothing origin=null
@@ -25,33 +25,38 @@ fun test() {
val x: Any? = En.A val x: Any? = En.A
when { when {
x is En -> { // BLOCK x is En -> { // BLOCK
val tmp0_subject: En = x /*as En */ { // BLOCK
when { val tmp0_subject: En = x /*as En */
EQEQ(arg0 = tmp0_subject, arg1 = En.A) -> { // BLOCK when {
r = "when1" EQEQ(arg0 = tmp0_subject, arg1 = En.A) -> { // BLOCK
r = "when1"
}
EQEQ(arg0 = tmp0_subject, arg1 = En.B) -> { // BLOCK
}
EQEQ(arg0 = tmp0_subject, arg1 = En.C) -> { // BLOCK
}
else -> noWhenBranchMatchedException()
} }
EQEQ(arg0 = tmp0_subject, arg1 = En.B) -> { // BLOCK
}
EQEQ(arg0 = tmp0_subject, arg1 = En.C) -> { // BLOCK
}
else -> noWhenBranchMatchedException()
} }
} }
} }
val y: Any = En.A val y: Any = En.A
when { when {
y is En -> { // BLOCK y is En -> { // BLOCK
val tmp1_subject: En = y /*as En */ { // BLOCK
when { val tmp1_subject: En = y /*as En */
EQEQ(arg0 = tmp1_subject, arg1 = En.A) -> { // BLOCK when {
r = "when2" EQEQ(arg0 = tmp1_subject, arg1 = En.A) -> { // BLOCK
r = "when2"
}
EQEQ(arg0 = tmp1_subject, arg1 = En.B) -> { // BLOCK
}
EQEQ(arg0 = tmp1_subject, arg1 = En.C) -> { // BLOCK
}
else -> noWhenBranchMatchedException()
} }
EQEQ(arg0 = tmp1_subject, arg1 = En.B) -> { // BLOCK
}
EQEQ(arg0 = tmp1_subject, arg1 = En.C) -> { // BLOCK
}
else -> noWhenBranchMatchedException()
} }
} }
} }
} }
@@ -7,18 +7,19 @@ FILE fqName:<root> fileName:/whenUnusedExpression.kt
WHEN type=kotlin.Int? origin=IF WHEN type=kotlin.Int? origin=IF
BRANCH BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test' type=kotlin.Boolean origin=null if: GET_VAR 'b: kotlin.Boolean declared in <root>.test' type=kotlin.Boolean origin=null
then: BLOCK type=kotlin.Int? origin=WHEN then: BLOCK type=kotlin.Int? origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] BLOCK type=kotlin.Int? origin=WHEN
GET_VAR 'i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
WHEN type=kotlin.Int? origin=WHEN GET_VAR 'i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
BRANCH WHEN type=kotlin.Int? origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: CONST Int type=kotlin.Int value=0 arg0: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
then: CONST Int type=kotlin.Int value=1 arg1: CONST Int type=kotlin.Int value=0
BRANCH then: CONST Int type=kotlin.Int value=1
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: CONST Null type=kotlin.Nothing? value=null if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Null type=kotlin.Nothing? value=null
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Null type=kotlin.Nothing? value=null then: CONST Null type=kotlin.Nothing? value=null
@@ -1,12 +1,15 @@
fun test(b: Boolean, i: Int) { fun test(b: Boolean, i: Int) {
when { when {
b -> { // BLOCK b -> { // BLOCK
val tmp0_subject: Int = i { // BLOCK
when { val tmp0_subject: Int = i
EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1 when {
else -> null EQEQ(arg0 = tmp0_subject, arg1 = 0) -> 1
else -> null
}
} }
} }
else -> null else -> null
} /*~> Unit */ } /*~> Unit */
} }
@@ -23,16 +23,17 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=10 arg1: CONST Int type=kotlin.Int value=10
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR body: BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=POSTFIX_INCR
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=null
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=0 arg1: CONST Int type=kotlin.Int value=0
@@ -50,13 +51,14 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
arg1: CONST Int type=kotlin.Int value=15 arg1: CONST Int type=kotlin.Int value=15
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR body: COMPOSITE type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=POSTFIX_INCR
GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null SET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null arg0: GET_VAR 'var x: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=20 arg1: CONST Int type=kotlin.Int value=20
@@ -75,6 +77,6 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
body: BLOCK type=kotlin.Unit origin=null body: BLOCK type=kotlin.Unit origin=null
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP body: COMPOSITE type=kotlin.Unit origin=null
condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
GET_VAR 'val a: kotlin.Any? declared in <root>.testSmartcastInCondition' type=kotlin.Any? origin=null GET_VAR 'val a: kotlin.Any? declared in <root>.testSmartcastInCondition' type=kotlin.Any? origin=null
@@ -8,9 +8,11 @@ fun test() {
<unary> <unary>
} }
while (less(arg0 = x, arg1 = 10)) { // BLOCK while (less(arg0 = x, arg1 = 10)) { // BLOCK
val <unary>: Int = x { // BLOCK
x = <unary>.inc() val <unary>: Int = x
<unary> x = <unary>.inc()
<unary>
}
} }
{ // BLOCK { // BLOCK
do// COMPOSITE { do// COMPOSITE {
@@ -24,11 +26,13 @@ fun test() {
} while (less(arg0 = x, arg1 = 15)) } while (less(arg0 = x, arg1 = 15))
} }
{ // BLOCK { // BLOCK
do{ // BLOCK do// COMPOSITE {
{ // BLOCK
val <unary>: Int = x val <unary>: Int = x
x = <unary>.inc() x = <unary>.inc()
<unary> <unary>
} while (less(arg0 = x, arg1 = 20)) }
// } while (less(arg0 = x, arg1 = 20))
} }
} }
@@ -45,3 +49,4 @@ fun testSmartcastInCondition() {
} }
} }
} }
+41 -35
View File
@@ -284,7 +284,7 @@ FILE fqName:<root> fileName:/ArrayMap.kt
BRANCH BRANCH
if: CALL 'private final fun <get-notVisited> (): kotlin.Boolean declared in <root>.OneElementArrayMap.iterator.<no name provided>' type=kotlin.Boolean origin=GET_PROPERTY if: CALL 'private final fun <get-notVisited> (): kotlin.Boolean declared in <root>.OneElementArrayMap.iterator.<no name provided>' type=kotlin.Boolean origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> declared in <root>.OneElementArrayMap.iterator.<no name provided>.next' type=<root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> origin=null $this: GET_VAR '<this>: <root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> declared in <root>.OneElementArrayMap.iterator.<no name provided>.next' type=<root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> origin=null
then: BLOCK type=kotlin.Nothing origin=null then: BLOCK type=kotlin.Unit origin=null
CALL 'private final fun <set-notVisited> (<set-?>: kotlin.Boolean): kotlin.Unit declared in <root>.OneElementArrayMap.iterator.<no name provided>' type=kotlin.Unit origin=EQ CALL 'private final fun <set-notVisited> (<set-?>: kotlin.Boolean): kotlin.Unit declared in <root>.OneElementArrayMap.iterator.<no name provided>' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> declared in <root>.OneElementArrayMap.iterator.<no name provided>.next' type=<root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> origin=null $this: GET_VAR '<this>: <root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> declared in <root>.OneElementArrayMap.iterator.<no name provided>.next' type=<root>.OneElementArrayMap.iterator.<no name provided><T of <root>.OneElementArrayMap> origin=null
<set-?>: CONST Boolean type=kotlin.Boolean value=false <set-?>: CONST Boolean type=kotlin.Boolean value=false
@@ -293,8 +293,9 @@ FILE fqName:<root> fileName:/ArrayMap.kt
$this: GET_VAR '<this>: <root>.OneElementArrayMap<T of <root>.OneElementArrayMap> declared in <root>.OneElementArrayMap.iterator' type=<root>.OneElementArrayMap<T of <root>.OneElementArrayMap> origin=null $this: GET_VAR '<this>: <root>.OneElementArrayMap<T of <root>.OneElementArrayMap> declared in <root>.OneElementArrayMap.iterator' type=<root>.OneElementArrayMap<T of <root>.OneElementArrayMap> origin=null
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: THROW type=kotlin.Nothing then: BLOCK type=kotlin.Unit origin=null
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.util.NoSuchElementException' type=java.util.NoSuchElementException origin=null THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.util.NoSuchElementException' type=java.util.NoSuchElementException origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden: overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.collections.Iterator public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.collections.Iterator
@@ -464,14 +465,15 @@ FILE fqName:<root> fileName:/ArrayMap.kt
arg1: CONST Null type=kotlin.Nothing? value=null arg1: CONST Null type=kotlin.Nothing? value=null
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=null BLOCK type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=null
CALL 'public open fun <get-size> (): kotlin.Int declared in <root>.ArrayMapImpl' type=kotlin.Int origin=GET_PROPERTY VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
CALL 'public open fun <get-size> (): kotlin.Int declared in <root>.ArrayMapImpl' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.set' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
CALL 'private open fun <set-size> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.set' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.set' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
CALL 'private open fun <set-size> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl' type=kotlin.Unit origin=EQ <set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.set' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.ArrayMapImpl.set' type=kotlin.Int origin=null
<set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null GET_VAR 'val tmp_0: kotlin.Int declared in <root>.ArrayMapImpl.set' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.ArrayMapImpl.set' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int declared in <root>.ArrayMapImpl.set' type=kotlin.Int origin=null
CALL 'public final fun set (index: kotlin.Int, value: T of kotlin.Array): kotlin.Unit declared in kotlin.Array' type=kotlin.Unit origin=null CALL 'public final fun set (index: kotlin.Int, value: T of kotlin.Array): kotlin.Unit declared in kotlin.Array' type=kotlin.Unit origin=null
$this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY $this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.set' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.set' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
@@ -542,15 +544,16 @@ FILE fqName:<root> fileName:/ArrayMap.kt
BLOCK_BODY BLOCK_BODY
BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP DO_WHILE label=null origin=DO_WHILE_LOOP
body: BLOCK type=kotlin.Int origin=POSTFIX_INCR body: COMPOSITE type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=POSTFIX_INCR
CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
CALL 'private final fun <set-index> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null $this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
CALL 'private final fun <set-index> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=POSTFIX_INCR <set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null $this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
<set-?>: CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=kotlin.Int origin=null
condition: WHEN type=kotlin.Boolean origin=ANDAND condition: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH BRANCH
if: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT if: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
@@ -577,18 +580,20 @@ FILE fqName:<root> fileName:/ArrayMap.kt
arg1: CALL 'public final fun <get-size> (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY arg1: CALL 'public final fun <get-size> (): kotlin.Int declared in kotlin.Array' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY $this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
then: CALL 'protected final fun done (): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null CALL 'protected final fun done (): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
BRANCH BRANCH
if: CONST Boolean type=kotlin.Boolean value=true if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'protected final fun setNext (value: T of <root>.ArrayMapImpl): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=null then: BLOCK type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null CALL 'protected final fun setNext (value: T of <root>.ArrayMapImpl): kotlin.Unit declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Unit origin=null
value: TYPE_OP type=T of <root>.ArrayMapImpl origin=CAST typeOperand=T of <root>.ArrayMapImpl $this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.Any? origin=null value: TYPE_OP type=T of <root>.ArrayMapImpl origin=CAST typeOperand=T of <root>.ArrayMapImpl
$this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=kotlin.Any? origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY
index: CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY $this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null index: CALL 'private final fun <get-index> (): kotlin.Int declared in <root>.ArrayMapImpl.iterator.<no name provided>' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.iterator.<no name provided>.computeNext' type=<root>.ArrayMapImpl.iterator.<no name provided><T of <root>.ArrayMapImpl> origin=null
FUN FAKE_OVERRIDE name:done visibility:protected modality:FINAL <> ($this:kotlin.collections.AbstractIterator<T of <root>.ArrayMapImpl>) returnType:kotlin.Unit [fake_override] FUN FAKE_OVERRIDE name:done visibility:protected modality:FINAL <> ($this:kotlin.collections.AbstractIterator<T of <root>.ArrayMapImpl>) returnType:kotlin.Unit [fake_override]
overridden: overridden:
protected final fun done (): kotlin.Unit declared in kotlin.collections.AbstractIterator protected final fun done (): kotlin.Unit declared in kotlin.collections.AbstractIterator
@@ -635,14 +640,15 @@ FILE fqName:<root> fileName:/ArrayMap.kt
arg1: CONST Null type=kotlin.Nothing? value=null arg1: CONST Null type=kotlin.Nothing? value=null
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=kotlin.Int origin=null BLOCK type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val] BLOCK type=kotlin.Int origin=null
CALL 'public open fun <get-size> (): kotlin.Int declared in <root>.ArrayMapImpl' type=kotlin.Int origin=GET_PROPERTY VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
CALL 'public open fun <get-size> (): kotlin.Int declared in <root>.ArrayMapImpl' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.remove' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
CALL 'private open fun <set-size> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.remove' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.remove' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
CALL 'private open fun <set-size> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.ArrayMapImpl' type=kotlin.Unit origin=EQ <set-?>: CALL 'public final fun dec (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.remove' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.ArrayMapImpl.remove' type=kotlin.Int origin=null
<set-?>: CALL 'public final fun dec (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null GET_VAR 'val tmp_2: kotlin.Int declared in <root>.ArrayMapImpl.remove' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.ArrayMapImpl.remove' type=kotlin.Int origin=null
GET_VAR 'val tmp_2: kotlin.Int declared in <root>.ArrayMapImpl.remove' type=kotlin.Int origin=null
CALL 'public final fun set (index: kotlin.Int, value: T of kotlin.Array): kotlin.Unit declared in kotlin.Array' type=kotlin.Unit origin=null CALL 'public final fun set (index: kotlin.Int, value: T of kotlin.Array): kotlin.Unit declared in kotlin.Array' type=kotlin.Unit origin=null
$this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY $this: CALL 'private final fun <get-data> (): kotlin.Array<kotlin.Any?> declared in <root>.ArrayMapImpl' type=kotlin.Array<kotlin.Any?> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.remove' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null $this: GET_VAR '<this>: <root>.ArrayMapImpl<T of <root>.ArrayMapImpl> declared in <root>.ArrayMapImpl.remove' type=<root>.ArrayMapImpl<T of <root>.ArrayMapImpl> origin=null
+24 -11
View File
@@ -132,7 +132,9 @@ internal class OneElementArrayMap<T : Any> : ArrayMap<T> {
<this>.<set-notVisited>(<set-?> = false) <this>.<set-notVisited>(<set-?> = false)
return <this>.<get-value>() return <this>.<get-value>()
} }
else -> throw NoSuchElementException() else -> { // BLOCK
throw NoSuchElementException()
}
} }
} }
@@ -194,9 +196,11 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
<this>.ensureCapacity(index = index) <this>.ensureCapacity(index = index)
when { when {
EQEQ(arg0 = <this>.<get-data>().get(index = index), arg1 = null) -> { // BLOCK EQEQ(arg0 = <this>.<get-data>().get(index = index), arg1 = null) -> { // BLOCK
val <unary>: Int = <this>.<get-size>() { // BLOCK
<this>.<set-size>(<set-?> = <unary>.inc()) val <unary>: Int = <this>.<get-size>()
<unary> <this>.<set-size>(<set-?> = <unary>.inc())
<unary>
}
} /*~> Unit */ } /*~> Unit */
} }
<this>.<get-data>().set(index = index, value = value) <this>.<get-data>().set(index = index, value = value)
@@ -226,18 +230,24 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
protected override fun computeNext() { protected override fun computeNext() {
{ // BLOCK { // BLOCK
do{ // BLOCK do// COMPOSITE {
{ // BLOCK
val <unary>: Int = <this>.<get-index>() val <unary>: Int = <this>.<get-index>()
<this>.<set-index>(<set-?> = <unary>.inc()) <this>.<set-index>(<set-?> = <unary>.inc())
<unary> <unary>
} while (when { }
// } while (when {
less(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> EQEQ(arg0 = <this>.<get-data>().get(index = <this>.<get-index>()), arg1 = null) less(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> EQEQ(arg0 = <this>.<get-data>().get(index = <this>.<get-index>()), arg1 = null)
else -> false else -> false
}) })
} }
when { when {
greaterOrEqual(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> <this>.done() greaterOrEqual(arg0 = <this>.<get-index>(), arg1 = <this>.<get-data>().<get-size>()) -> { // BLOCK
else -> <this>.setNext(value = <this>.<get-data>().get(index = <this>.<get-index>()) as T) <this>.done()
}
else -> { // BLOCK
<this>.setNext(value = <this>.<get-data>().get(index = <this>.<get-index>()) as T)
}
} }
} }
@@ -250,9 +260,11 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
fun remove(index: Int) { fun remove(index: Int) {
when { when {
EQEQ(arg0 = <this>.<get-data>().get(index = index), arg1 = null).not() -> { // BLOCK EQEQ(arg0 = <this>.<get-data>().get(index = index), arg1 = null).not() -> { // BLOCK
val <unary>: Int = <this>.<get-size>() { // BLOCK
<this>.<set-size>(<set-?> = <unary>.dec()) val <unary>: Int = <this>.<get-size>()
<unary> <this>.<set-size>(<set-?> = <unary>.dec())
<unary>
}
} /*~> Unit */ } /*~> Unit */
} }
<this>.<get-data>().set(index = index, value = null) <this>.<get-data>().set(index = index, value = null)
@@ -328,3 +340,4 @@ internal class ArrayMapImpl<T : Any> : ArrayMap<T> {
} }
} }
@@ -187,23 +187,24 @@ FILE fqName:<root> fileName:/DeepCopyIrTree.kt
VAR name:otherTypeParameter type:<root>.IrTypeParameter [val] VAR name:otherTypeParameter type:<root>.IrTypeParameter [val]
CALL 'public final fun component2 (): B of kotlin.Pair declared in kotlin.Pair' type=<root>.IrTypeParameter origin=COMPONENT_N(index=2) CALL 'public final fun component2 (): B of kotlin.Pair declared in kotlin.Pair' type=<root>.IrTypeParameter origin=COMPONENT_N(index=2)
$this: GET_VAR 'val tmp_1: kotlin.Pair<<root>.IrTypeParameter, <root>.IrTypeParameter> declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=kotlin.Pair<<root>.IrTypeParameter, <root>.IrTypeParameter> origin=null $this: GET_VAR 'val tmp_1: kotlin.Pair<<root>.IrTypeParameter, <root>.IrTypeParameter> declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=kotlin.Pair<<root>.IrTypeParameter, <root>.IrTypeParameter> origin=null
CALL 'public final fun mapTo <T, R, C> (destination: C of kotlin.collections.mapTo, transform: kotlin.Function1<T of kotlin.collections.mapTo, R of kotlin.collections.mapTo>): C of kotlin.collections.mapTo declared in kotlin.collections' type=kotlin.collections.MutableList<<root>.IrType> origin=null BLOCK type=kotlin.collections.MutableList<<root>.IrType> origin=null
<T>: <root>.IrType CALL 'public final fun mapTo <T, R, C> (destination: C of kotlin.collections.mapTo, transform: kotlin.Function1<T of kotlin.collections.mapTo, R of kotlin.collections.mapTo>): C of kotlin.collections.mapTo declared in kotlin.collections' type=kotlin.collections.MutableList<<root>.IrType> origin=null
<R>: <root>.IrType <T>: <root>.IrType
<C>: kotlin.collections.MutableList<<root>.IrType> <R>: <root>.IrType
$receiver: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY <C>: kotlin.collections.MutableList<<root>.IrType>
$this: GET_VAR 'val otherTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null $receiver: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY
destination: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY $this: GET_VAR 'val otherTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
$this: GET_VAR 'val thisTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null destination: CALL 'public abstract fun <get-superTypes> (): kotlin.collections.MutableList<<root>.IrType> declared in <root>.IrTypeParameter' type=kotlin.collections.MutableList<<root>.IrType> origin=GET_PROPERTY
transform: FUN_EXPR type=kotlin.Function1<<root>.IrType, <root>.IrType> origin=LAMBDA $this: GET_VAR 'val thisTypeParameter: <root>.IrTypeParameter declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' type=<root>.IrTypeParameter origin=null
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IrType) returnType:<root>.IrType transform: FUN_EXPR type=kotlin.Function1<<root>.IrType, <root>.IrType> origin=LAMBDA
VALUE_PARAMETER name:it index:0 type:<root>.IrType FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.IrType) returnType:<root>.IrType
BLOCK_BODY VALUE_PARAMETER name:it index:0 type:<root>.IrType
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.IrType): <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>' BLOCK_BODY
CALL 'public abstract fun remapType (type: <root>.IrType): <root>.IrType declared in <root>.TypeRemapper' type=<root>.IrType origin=null RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.IrType): <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>'
$this: CALL 'private final fun <get-typeRemapper> (): <root>.TypeRemapper declared in <root>.DeepCopyIrTreeWithSymbols' type=<root>.TypeRemapper origin=GET_PROPERTY CALL 'public abstract fun remapType (type: <root>.IrType): <root>.IrType declared in <root>.TypeRemapper' type=<root>.IrType origin=null
$this: GET_VAR '<this>: <root>.DeepCopyIrTreeWithSymbols declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=<root>.DeepCopyIrTreeWithSymbols origin=null $this: CALL 'private final fun <get-typeRemapper> (): <root>.TypeRemapper declared in <root>.DeepCopyIrTreeWithSymbols' type=<root>.TypeRemapper origin=GET_PROPERTY
type: GET_VAR 'it: <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>.<anonymous>' type=<root>.IrType origin=null $this: GET_VAR '<this>: <root>.DeepCopyIrTreeWithSymbols declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom' type=<root>.DeepCopyIrTreeWithSymbols origin=null
type: GET_VAR 'it: <root>.IrType declared in <root>.DeepCopyIrTreeWithSymbols.copyTypeParametersFrom.<anonymous>.<anonymous>' type=<root>.IrType origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden: overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
@@ -59,10 +59,12 @@ class DeepCopyIrTreeWithSymbols {
val <destruct>: Pair<IrTypeParameter, IrTypeParameter> = <iterator>.next() val <destruct>: Pair<IrTypeParameter, IrTypeParameter> = <iterator>.next()
val thisTypeParameter: IrTypeParameter = <destruct>.component1() val thisTypeParameter: IrTypeParameter = <destruct>.component1()
val otherTypeParameter: IrTypeParameter = <destruct>.component2() val otherTypeParameter: IrTypeParameter = <destruct>.component2()
otherTypeParameter.<get-superTypes>().mapTo<IrType, IrType, MutableList<IrType>>(destination = thisTypeParameter.<get-superTypes>(), transform = local fun <anonymous>(it: IrType): IrType { { // BLOCK
return <this>.<get-typeRemapper>().remapType(type = it) otherTypeParameter.<get-superTypes>().mapTo<IrType, IrType, MutableList<IrType>>(destination = thisTypeParameter.<get-superTypes>(), transform = local fun <anonymous>(it: IrType): IrType {
} return <this>.<get-typeRemapper>().remapType(type = it)
}
) )
}
} }
} }
} }
@@ -1,168 +0,0 @@
FILE fqName:<root> fileName:/Modality.kt
CLASS INTERFACE name:Substitutable modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Substitutable<T of <root>.Substitutable>
TYPE_PARAMETER name:T index:0 variance:out superTypes:[<root>.DeclarationDescriptorNonRoot] reified:false
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:ResolutionPart modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.ResolutionPart
CONSTRUCTOR visibility:public <> () returnType:<root>.ResolutionPart [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ResolutionPart modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
FUN name:process visibility:public modality:ABSTRACT <> ($this:<root>.ResolutionPart, $receiver:<root>.KotlinResolutionCandidate) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.ResolutionPart
$receiver: VALUE_PARAMETER name:<this> type:<root>.KotlinResolutionCandidate
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:KotlinResolutionCandidate modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KotlinResolutionCandidate
CONSTRUCTOR visibility:public <> (resolvedCall:<root>.Atom) returnType:<root>.KotlinResolutionCandidate [primary]
VALUE_PARAMETER name:resolvedCall index:0 type:<root>.Atom
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:KotlinResolutionCandidate modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:resolvedCall visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:resolvedCall type:<root>.Atom visibility:private [final]
EXPRESSION_BODY
GET_VAR 'resolvedCall: <root>.Atom declared in <root>.KotlinResolutionCandidate.<init>' type=<root>.Atom origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-resolvedCall> visibility:public modality:FINAL <> ($this:<root>.KotlinResolutionCandidate) returnType:<root>.Atom
correspondingProperty: PROPERTY name:resolvedCall visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.KotlinResolutionCandidate
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-resolvedCall> (): <root>.Atom declared in <root>.KotlinResolutionCandidate'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:resolvedCall type:<root>.Atom visibility:private [final]' type=<root>.Atom origin=null
receiver: GET_VAR '<this>: <root>.KotlinResolutionCandidate declared in <root>.KotlinResolutionCandidate.<get-resolvedCall>' type=<root>.KotlinResolutionCandidate origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Atom modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Atom
CONSTRUCTOR visibility:public <> (candidateDescriptor:<root>.CallableDescriptor) returnType:<root>.Atom [primary]
VALUE_PARAMETER name:candidateDescriptor index:0 type:<root>.CallableDescriptor
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Atom modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:candidateDescriptor visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:candidateDescriptor type:<root>.CallableDescriptor visibility:private [final]
EXPRESSION_BODY
GET_VAR 'candidateDescriptor: <root>.CallableDescriptor declared in <root>.Atom.<init>' type=<root>.CallableDescriptor origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-candidateDescriptor> visibility:public modality:FINAL <> ($this:<root>.Atom) returnType:<root>.CallableDescriptor
correspondingProperty: PROPERTY name:candidateDescriptor visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Atom
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-candidateDescriptor> (): <root>.CallableDescriptor declared in <root>.Atom'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:candidateDescriptor type:<root>.CallableDescriptor visibility:private [final]' type=<root>.CallableDescriptor origin=null
receiver: GET_VAR '<this>: <root>.Atom declared in <root>.Atom.<get-candidateDescriptor>' type=<root>.Atom origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS OBJECT name:Owner modality:FINAL visibility:public superTypes:[<root>.ResolutionPart]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Owner
CONSTRUCTOR visibility:private <> () returnType:<root>.Owner [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.ResolutionPart'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Owner modality:FINAL visibility:public superTypes:[<root>.ResolutionPart]'
FUN name:process visibility:public modality:OPEN <> ($this:<root>.Owner, $receiver:<root>.KotlinResolutionCandidate) returnType:kotlin.String
overridden:
public abstract fun process (): kotlin.String declared in <root>.ResolutionPart
$this: VALUE_PARAMETER name:<this> type:<root>.Owner
$receiver: VALUE_PARAMETER name:<this> type:<root>.KotlinResolutionCandidate
BLOCK_BODY
VAR name:candidateDescriptor type:<root>.CallableDescriptor [val]
CALL 'public final fun <get-candidateDescriptor> (): <root>.CallableDescriptor declared in <root>.Atom' type=<root>.CallableDescriptor origin=GET_PROPERTY
$this: CALL 'public final fun <get-resolvedCall> (): <root>.Atom declared in <root>.KotlinResolutionCandidate' type=<root>.Atom origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.KotlinResolutionCandidate declared in <root>.Owner.process' type=<root>.KotlinResolutionCandidate origin=null
WHEN type=kotlin.Unit origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.MemberDescriptor
GET_VAR 'val candidateDescriptor: <root>.CallableDescriptor declared in <root>.Owner.process' type=<root>.CallableDescriptor origin=null
then: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public abstract fun getModality (): @[FlexibleNullability] <root>.Modality? declared in <root>.MemberDescriptor' type=@[FlexibleNullability] <root>.Modality? origin=GET_PROPERTY
$this: TYPE_OP type=<root>.MemberDescriptor origin=IMPLICIT_CAST typeOperand=<root>.MemberDescriptor
GET_VAR 'val candidateDescriptor: <root>.CallableDescriptor declared in <root>.Owner.process' type=<root>.CallableDescriptor origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=false
then: RETURN type=kotlin.Nothing from='public open fun process (): kotlin.String declared in <root>.Owner'
CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='public open fun process (): kotlin.String declared in <root>.Owner'
CONST String type=kotlin.String value="FAIL"
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.ResolutionPart
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in <root>.ResolutionPart
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in <root>.ResolutionPart
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS OBJECT name:Final modality:FINAL visibility:public superTypes:[<root>.Modality]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Final
CONSTRUCTOR visibility:private <> () returnType:<root>.Final [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Final modality:FINAL visibility:public superTypes:[<root>.Modality]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Modality
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in <root>.Modality
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in <root>.Modality
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -1,69 +0,0 @@
interface Substitutable<out T : DeclarationDescriptorNonRoot> {
}
abstract class ResolutionPart {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
abstract fun KotlinResolutionCandidate.process(): String
}
class KotlinResolutionCandidate {
constructor(resolvedCall: Atom) /* primary */ {
super/*Any*/()
/* <init>() */
}
val resolvedCall: Atom
field = resolvedCall
get
}
class Atom {
constructor(candidateDescriptor: CallableDescriptor) /* primary */ {
super/*Any*/()
/* <init>() */
}
val candidateDescriptor: CallableDescriptor
field = candidateDescriptor
get
}
object Owner : ResolutionPart {
private constructor() /* primary */ {
super/*ResolutionPart*/()
/* <init>() */
}
override fun KotlinResolutionCandidate.process(): String {
val candidateDescriptor: CallableDescriptor = <this>.<get-resolvedCall>().<get-candidateDescriptor>()
when {
when {
candidateDescriptor is MemberDescriptor -> EQEQ(arg0 = candidateDescriptor /*as MemberDescriptor */.getModality(), arg1 = null).not()
else -> false
} -> return "OK"
}
return "FAIL"
}
}
object Final : Modality {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: Modality.java // FILE: Modality.java
public interface Modality public interface Modality
+6 -5
View File
@@ -30,11 +30,12 @@ FILE fqName:<root> fileName:/Box.kt
BRANCH BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.Foo.Buz if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.Foo.Buz
GET_VAR 'var foo: <root>.Foo declared in <root>.Box.<get-str>' type=<root>.Foo origin=null GET_VAR 'var foo: <root>.Foo declared in <root>.Box.<get-str>' type=<root>.Foo origin=null
then: RETURN type=kotlin.Nothing from='public final fun <get-str> (): kotlin.String declared in <root>.Box' then: BLOCK type=kotlin.Unit origin=null
TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String RETURN type=kotlin.Nothing from='public final fun <get-str> (): kotlin.String declared in <root>.Box'
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:str type:@[FlexibleNullability] kotlin.String? visibility:public' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
receiver: TYPE_OP type=<root>.Foo.Buz origin=IMPLICIT_CAST typeOperand=<root>.Foo.Buz GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:str type:@[FlexibleNullability] kotlin.String? visibility:public' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY
GET_VAR 'var foo: <root>.Foo declared in <root>.Box.<get-str>' type=<root>.Foo origin=null receiver: TYPE_OP type=<root>.Foo.Buz origin=IMPLICIT_CAST typeOperand=<root>.Foo.Buz
GET_VAR 'var foo: <root>.Foo declared in <root>.Box.<get-str>' type=<root>.Foo origin=null
RETURN type=kotlin.Nothing from='public final fun <get-str> (): kotlin.String declared in <root>.Box' RETURN type=kotlin.Nothing from='public final fun <get-str> (): kotlin.String declared in <root>.Box'
CONST String type=kotlin.String value="" CONST String type=kotlin.String value=""
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
+4 -1
View File
@@ -13,9 +13,12 @@ class Box<out T : Foo> {
get(): String { get(): String {
var foo: Foo = <this>.<get-foo>() var foo: Foo = <this>.<get-foo>()
when { when {
foo is Buz -> return foo /*as Buz */.#str /*!! String */ foo is Buz -> { // BLOCK
return foo /*as Buz */.#str /*!! String */
}
} }
return "" return ""
} }
} }
@@ -1,50 +0,0 @@
FILE fqName:<root> fileName:/reflectGetOnNullableTypeAlias.kt
TYPEALIAS name:PropAlias visibility:private expandedType:kotlin.reflect.KProperty1<T of <root>.PropAlias, kotlin.Any?>?
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:backRefProp type:kotlin.reflect.KProperty1<<root>.Foo, kotlin.Any?>? [val]
PROPERTY_REFERENCE 'public final bar: kotlin.String' field=null getter='public final fun <get-bar> (): kotlin.String declared in <root>.Foo' setter=null type=kotlin.reflect.KProperty1<<root>.Foo, kotlin.String> origin=null
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'val backRefProp: kotlin.reflect.KProperty1<<root>.Foo, kotlin.Any?>? declared in <root>.box' type=kotlin.reflect.KProperty1<<root>.Foo, kotlin.Any?>? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
TYPE_OP type=kotlin.String origin=CAST typeOperand=kotlin.String
CALL 'public abstract fun get (receiver: T of kotlin.reflect.KProperty1): V of kotlin.reflect.KProperty1 declared in kotlin.reflect.KProperty1' type=kotlin.Any? origin=null
$this: GET_VAR 'val backRefProp: kotlin.reflect.KProperty1<<root>.Foo, kotlin.Any?>? declared in <root>.box' type=kotlin.reflect.KProperty1<<root>.Foo, kotlin.Any?>? origin=null
receiver: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Foo' type=<root>.Foo origin=null
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo
CONSTRUCTOR visibility:public <> () returnType:<root>.Foo [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Foo modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:bar visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.String visibility:private [final]
EXPRESSION_BODY
CONST String type=kotlin.String value="OK"
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-bar> visibility:public modality:FINAL <> ($this:<root>.Foo) returnType:kotlin.String
correspondingProperty: PROPERTY name:bar visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Foo
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-bar> (): kotlin.String declared in <root>.Foo'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.Foo declared in <root>.Foo.<get-bar>' type=<root>.Foo origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -1,21 +0,0 @@
private typealias PropAlias<T : Any?> = KProperty1<T, Any?>?
fun box(): String {
val backRefProp: KProperty1<Foo, Any?>? = Foo::bar
when {
EQEQ(arg0 = backRefProp, arg1 = null).not() -> return backRefProp.get(receiver = Foo()) as String
}
return "FAIL"
}
class Foo {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
val bar: String
field = "OK"
get
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_KLIB_TEST // SKIP_KLIB_TEST
// WITH_REFLECT // WITH_REFLECT
@@ -12,7 +12,7 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
WHILE label=null origin=WHILE_LOOP WHILE label=null origin=WHILE_LOOP
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.DoubleIterator' type=kotlin.Boolean origin=null condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.DoubleIterator' type=kotlin.Boolean origin=null
$this: GET_VAR 'val x: kotlin.collections.DoubleIterator declared in <root>.box' type=kotlin.collections.DoubleIterator origin=null $this: GET_VAR 'val x: kotlin.collections.DoubleIterator declared in <root>.box' type=kotlin.collections.DoubleIterator origin=null
body: BLOCK type=kotlin.Int origin=null body: BLOCK type=kotlin.Unit origin=null
WHEN type=kotlin.Unit origin=IF WHEN type=kotlin.Unit origin=IF
BRANCH BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
+47 -44
View File
@@ -11,51 +11,54 @@ FILE fqName:<root> fileName:/kt24114.kt
BLOCK_BODY BLOCK_BODY
WHILE label=null origin=WHILE_LOOP WHILE label=null origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Unit origin=WHEN body: BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] BLOCK type=kotlin.Unit origin=WHEN
CALL 'public final fun one (): kotlin.Int declared in <root>' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
WHEN type=kotlin.Unit origin=WHEN CALL 'public final fun one (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: CONST Int type=kotlin.Int value=1 arg0: GET_VAR 'val tmp_0: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
then: BLOCK type=kotlin.Unit origin=WHEN arg1: CONST Int type=kotlin.Int value=1
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val] then: BLOCK type=kotlin.Unit origin=null
CALL 'public final fun two (): kotlin.Int declared in <root>' type=kotlin.Int origin=null BLOCK type=kotlin.Unit origin=WHEN
WHEN type=kotlin.Unit origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
BRANCH CALL 'public final fun two (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ WHEN type=kotlin.Unit origin=WHEN
arg0: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null BRANCH
arg1: CONST Int type=kotlin.Int value=2 if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
then: RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Int declared in <root>' arg0: GET_VAR 'val tmp_1: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
CONST Int type=kotlin.Int value=2 arg1: CONST Int type=kotlin.Int value=2
BRANCH then: RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Int declared in <root>'
if: CONST Boolean type=kotlin.Boolean value=true CONST Int type=kotlin.Int value=2
then: RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Int declared in <root>' BRANCH
CONST Int type=kotlin.Int value=3 if: CONST Boolean type=kotlin.Boolean value=true
then: RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=3
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Int FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY BLOCK_BODY
WHILE label=null origin=WHILE_LOOP WHILE label=null origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value=true condition: CONST Boolean type=kotlin.Boolean value=true
body: BLOCK type=kotlin.Unit origin=WHEN body: BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val] BLOCK type=kotlin.Unit origin=WHEN
CALL 'public final fun one (): kotlin.Int declared in <root>' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
WHEN type=kotlin.Unit origin=WHEN CALL 'public final fun one (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: CONST Int type=kotlin.Int value=1 arg0: GET_VAR 'val tmp_2: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
then: BLOCK type=kotlin.Unit origin=WHEN arg1: CONST Int type=kotlin.Int value=1
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val] then: BLOCK type=kotlin.Unit origin=WHEN
CALL 'public final fun two (): kotlin.Int declared in <root>' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
WHEN type=kotlin.Unit origin=WHEN CALL 'public final fun two (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
BRANCH WHEN type=kotlin.Unit origin=WHEN
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ BRANCH
arg0: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg1: CONST Int type=kotlin.Int value=2 arg0: GET_VAR 'val tmp_3: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
then: RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in <root>' arg1: CONST Int type=kotlin.Int value=2
CONST Int type=kotlin.Int value=2 then: RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in <root>'
BRANCH CONST Int type=kotlin.Int value=2
if: CONST Boolean type=kotlin.Boolean value=true BRANCH
then: RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in <root>' if: CONST Boolean type=kotlin.Boolean value=true
CONST Int type=kotlin.Int value=3 then: RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=3
+21 -14
View File
@@ -8,30 +8,37 @@ fun two(): Int {
fun test1(): Int { fun test1(): Int {
while (true) { // BLOCK while (true) { // BLOCK
val tmp0_subject: Int = one() { // BLOCK
when { val tmp0_subject: Int = one()
EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK when {
val tmp1_subject: Int = two() EQEQ(arg0 = tmp0_subject, arg1 = 1) -> { // BLOCK
when { { // BLOCK
EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2 val tmp1_subject: Int = two()
when {
EQEQ(arg0 = tmp1_subject, arg1 = 2) -> return 2
}
}
} }
else -> return 3
} }
else -> return 3
} }
} }
} }
fun test2(): Int { fun test2(): Int {
while (true) { // BLOCK while (true) { // BLOCK
val tmp2_subject: Int = one() { // BLOCK
when { val tmp2_subject: Int = one()
EQEQ(arg0 = tmp2_subject, arg1 = 1) -> { // BLOCK when {
val tmp3_subject: Int = two() EQEQ(arg0 = tmp2_subject, arg1 = 1) -> { // BLOCK
when { val tmp3_subject: Int = two()
EQEQ(arg0 = tmp3_subject, arg1 = 2) -> return 2 when {
EQEQ(arg0 = tmp3_subject, arg1 = 2) -> return 2
}
} }
else -> return 3
} }
else -> return 3
} }
} }
} }