== myRun == inline fun myRun(block: () -> Unit): Unit { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } --------------------- L0: 1 INIT: in: {} out: {} v(block: () -> Unit) INIT: in: {} out: {} magic[FAKE_INITIALIZER](block: () -> Unit) -> INIT: in: {} out: {} w(block|) INIT: in: {} out: {} 2 mark({ contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() }) INIT: in: {} out: {} mark({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) jmp?(L2) d({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) L2 [after local declaration]: r({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) -> mark(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) call(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }, contract|) -> r(block) -> mark(block()) call(block(), invoke|) -> ret(*|) L1 L1: 1 error: sink: USE: in: {} out: {} ===================== == anonymous_0 == { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } --------------------- L3: 3 INIT: in: {} out: {} 4 mark(callsInPlace(block, InvocationKind.EXACTLY_ONCE)) magic[IMPLICIT_RECEIVER](callsInPlace(block, InvocationKind.EXACTLY_ONCE)) -> r(block) -> mark(InvocationKind.EXACTLY_ONCE) r(EXACTLY_ONCE) -> mark(callsInPlace(block, InvocationKind.EXACTLY_ONCE)) call(callsInPlace(block, InvocationKind.EXACTLY_ONCE), callsInPlace|, , ) -> L4: 3 error: sink: USE: in: {} out: {} ===================== == unknownRun == inline fun unknownRun(block: () -> Unit) { block() } --------------------- L0: 1 INIT: in: {} out: {} v(block: () -> Unit) INIT: in: {} out: {} magic[FAKE_INITIALIZER](block: () -> Unit) -> INIT: in: {} out: {} w(block|) INIT: in: {} out: {} 2 mark({ block() }) INIT: in: {} out: {} r(block) -> mark(block()) call(block(), invoke|) -> L1: 1 error: sink: USE: in: {} out: {} ===================== == foo == fun foo() { val x: Int myRun { unknownRun { println("shouldn't change anything") } x = 42 } println(x) } --------------------- L0: 1 INIT: in: {} out: {} USE: in: {} out: {} 2 mark({ val x: Int myRun { unknownRun { println("shouldn't change anything") } x = 42 } println(x) }) v(val x: Int) INIT: in: {} out: {x=D} mark({ unknownRun { println("shouldn't change anything") } x = 42 }) INIT: in: {x=D} out: {x=D} r({ unknownRun { println("shouldn't change anything") } x = 42 }) -> mark(myRun { unknownRun { println("shouldn't change anything") } x = 42 }) call(myRun { unknownRun { println("shouldn't change anything") } x = 42 }, myRun|) -> L2 [before inlined declaration]: inlined({ unknownRun { println("shouldn't change anything") } x = 42 }) INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} L3 [after inlined declaration]: r(x) -> USE: in: {} out: {x=READ} mark(println(x)) call(println(x), println|) -> L1: 1 INIT: in: {} out: {} error: sink: USE: in: {} out: {} ===================== == inlined anonymous_1 == { unknownRun { println("shouldn't change anything") } x = 42 } --------------------- L4: 3 INIT: in: {x=D} out: {x=D} 4 mark(unknownRun { println("shouldn't change anything") } x = 42) mark({ println("shouldn't change anything") }) jmp?(L6) d({ println("shouldn't change anything") }) INIT: in: {x=I?} out: {x=I?} USE: in: {x=READ} out: {x=READ} L6 [after local declaration]: r({ println("shouldn't change anything") }) -> INIT: in: {x=D} out: {x=D} mark(unknownRun { println("shouldn't change anything") }) call(unknownRun { println("shouldn't change anything") }, unknownRun|) -> r(42) -> USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} w(x|) INIT: in: {x=D} out: {x=ID} USE: in: {x=READ} out: {x=WRITTEN_AFTER_READ} L5: 3 INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} error: - sink: INIT: in: {x=I?} out: {x=I?} USE: in: {x=READ} out: {x=READ} ===================== == anonymous_2 == { println("shouldn't change anything") } --------------------- L7: 5 INIT: in: {x=D} out: {x=D} 6 mark(println("shouldn't change anything")) mark("shouldn't change anything") r("shouldn't change anything") -> mark(println("shouldn't change anything")) call(println("shouldn't change anything"), println|) -> L8: 5 error: INIT: in: {} out: {} sink: INIT: in: {x=I?} out: {x=I?} USE: in: {x=READ} out: {x=READ} =====================