== myRun == inline fun myRun(block: () -> T): T { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } --------------------- : {<: () -> T} NEW: magic[FAKE_INITIALIZER](block: () -> T) -> { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } : {<: ContractBuilder.() -> Unit} NEW: r({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) -> contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } : * NEW: call(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }, contract|) -> block : {<: () -> T} NEW: r(block) -> block() : {<: T} NEW: call(block(), invoke|) -> return block() !: * { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } !: * COPY ===================== == anonymous_0 == { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } --------------------- : {<: ContractBuilder} NEW: magic[IMPLICIT_RECEIVER](callsInPlace(block, InvocationKind.EXACTLY_ONCE)) -> block : {<: Function} NEW: r(block) -> EXACTLY_ONCE : {<: InvocationKind} NEW: r(EXACTLY_ONCE) -> InvocationKind.EXACTLY_ONCE : {<: InvocationKind} COPY callsInPlace(block, InvocationKind.EXACTLY_ONCE) : * NEW: call(callsInPlace(block, InvocationKind.EXACTLY_ONCE), callsInPlace|, , ) -> callsInPlace(block, InvocationKind.EXACTLY_ONCE) : * COPY ===================== == someComputation == fun someComputation(): Int = 42 --------------------- 42 : Int NEW: r(42) -> ===================== == report == fun report(x: Int) = Unit --------------------- : Int NEW: magic[FAKE_INITIALIZER](x: Int) -> Unit : Unit NEW: r(Unit) -> ===================== == innerTryCatchFinally == fun innerTryCatchFinally() { val x: Int myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } x.inc() } --------------------- { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } : {<: () -> Unit} NEW: r({ try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }) -> myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } : * NEW: call(myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }, myRun|) -> x : Int NEW: r(x) -> inc() : * NEW: call(inc(), inc|) -> x.inc() : * COPY { val x: Int myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } x.inc() } : * COPY ===================== == inlined anonymous_1 == { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } --------------------- : {<: Exception} NEW: magic[FAKE_INITIALIZER](e: java.lang.Exception) -> someComputation() : Int NEW: call(someComputation(), someComputation) -> x : Int NEW: r(x) -> report(x) : * NEW: call(report(x), report|) -> { x = someComputation() report(x) } : * COPY 42 : Int NEW: r(42) -> x : Int NEW: r(x) -> report(x) : * NEW: call(report(x), report|) -> { x = 42 report(x) } : * COPY 0 : Int NEW: r(0) -> x = 0 !: * { x = 0 } !: * COPY try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } : * NEW: merge(try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 }|, ) -> try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } : * COPY =====================