Files
kotlin-fork/compiler/testData/cfg/controlStructures/Finally.values
T
Alexey Sedunov 9fee8600cb Pseudocode: Do not generate implicit return instruction inside of
Unit-typed lambdas
 #KT-5549 Fixed
2014-08-05 18:14:40 +04:00

470 lines
45 KiB
Plaintext

== t1 ==
fun t1() {
try {
1
} finally {
2
}
}
---------------------
1 <v0>: * NEW: r(1) -> <v0>
{ 1 } <v0>: * COPY
2 <v1>: * NEW: r(2) -> <v1>
{ 2 } <v1>: * COPY
try { 1 } finally { 2 } <v2>: * NEW: merge(try { 1 } finally { 2 }|<v0>) -> <v2>
{ try { 1 } finally { 2 } } <v2>: * COPY
=====================
== t2 ==
fun t2() {
try {
1
if (2 > 3) {
return
}
} finally {
2
}
}
---------------------
1 <v0>: * NEW: r(1) -> <v0>
2 <v1>: {<: Comparable<Int>} NEW: r(2) -> <v1>
3 <v2>: Int NEW: r(3) -> <v2>
2 > 3 <v3>: Boolean NEW: call(2 > 3, compareTo|<v1>, <v2>) -> <v3>
return !<v5>: *
{ return } !<v5>: * COPY
if (2 > 3) { return } <v6>: * NEW: merge(if (2 > 3) { return }|!<v5>) -> <v6>
{ 1 if (2 > 3) { return } } <v6>: * COPY
2 <v4>: * NEW: r(2) -> <v4>
{ 2 } <v4>: * COPY
try { 1 if (2 > 3) { return } } finally { 2 } <v7>: * NEW: merge(try { 1 if (2 > 3) { return } } finally { 2 }|<v6>) -> <v7>
{ try { 1 if (2 > 3) { return } } finally { 2 } } <v7>: * COPY
=====================
== t3 ==
fun t3() {
try {
1
@l{ () ->
if (2 > 3) {
return@l
}
}
} finally {
2
}
}
---------------------
1 <v0>: * NEW: r(1) -> <v0>
{ () -> if (2 > 3) { return@l } } <v1>: * NEW: r({ () -> if (2 > 3) { return@l } }) -> <v1>
@l{ () -> if (2 > 3) { return@l } } <v1>: * COPY
{ 1 @l{ () -> if (2 > 3) { return@l } } } <v1>: * COPY
2 <v2>: * NEW: r(2) -> <v2>
{ 2 } <v2>: * COPY
try { 1 @l{ () -> if (2 > 3) { return@l } } } finally { 2 } <v3>: * NEW: merge(try { 1 @l{ () -> if (2 > 3) { return@l } } } finally { 2 }|<v1>) -> <v3>
{ try { 1 @l{ () -> if (2 > 3) { return@l } } } finally { 2 } } <v3>: * COPY
=====================
== anonymous_0 ==
{ () ->
if (2 > 3) {
return@l
}
}
---------------------
2 <v0>: {<: Comparable<Int>} NEW: r(2) -> <v0>
3 <v1>: Int NEW: r(3) -> <v1>
2 > 3 <v2>: Boolean NEW: call(2 > 3, compareTo|<v0>, <v1>) -> <v2>
return@l !<v3>: *
{ return@l } !<v3>: * COPY
if (2 > 3) { return@l } <v4>: * NEW: merge(if (2 > 3) { return@l }|!<v3>) -> <v4>
if (2 > 3) { return@l } <v4>: * COPY
=====================
== t4 ==
fun t4() {
@l{ () ->
try {
1
if (2 > 3) {
return@l
}
} finally {
2
}
}
}
---------------------
{ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } } <v0>: * NEW: r({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) -> <v0>
@l{ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } } <v0>: * COPY
{ @l{ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } } } <v0>: * COPY
=====================
== anonymous_1 ==
{ () ->
try {
1
if (2 > 3) {
return@l
}
} finally {
2
}
}
---------------------
1 <v0>: * NEW: r(1) -> <v0>
2 <v1>: {<: Comparable<Int>} NEW: r(2) -> <v1>
3 <v2>: Int NEW: r(3) -> <v2>
2 > 3 <v3>: Boolean NEW: call(2 > 3, compareTo|<v1>, <v2>) -> <v3>
return@l !<v5>: *
{ return@l } !<v5>: * COPY
if (2 > 3) { return@l } <v6>: * NEW: merge(if (2 > 3) { return@l }|!<v5>) -> <v6>
{ 1 if (2 > 3) { return@l } } <v6>: * COPY
2 <v4>: * NEW: r(2) -> <v4>
{ 2 } <v4>: * COPY
try { 1 if (2 > 3) { return@l } } finally { 2 } <v7>: * NEW: merge(try { 1 if (2 > 3) { return@l } } finally { 2 }|<v6>) -> <v7>
try { 1 if (2 > 3) { return@l } } finally { 2 } <v7>: * COPY
=====================
== t5 ==
fun t5() {
@l while(true) {
try {
1
if (2 > 3) {
break @l
}
} finally {
2
}
}
}
---------------------
<v1>: * NEW: magic[VALUE_CONSUMER](true|<v0>) -> <v1>
true <v0>: Boolean NEW: r(true) -> <v0>
1 <v2>: * NEW: r(1) -> <v2>
2 <v3>: {<: Comparable<Int>} NEW: r(2) -> <v3>
3 <v4>: Int NEW: r(3) -> <v4>
2 > 3 <v5>: Boolean NEW: call(2 > 3, compareTo|<v3>, <v4>) -> <v5>
break @l !<v7>: *
{ break @l } !<v7>: * COPY
if (2 > 3) { break @l } <v8>: * NEW: merge(if (2 > 3) { break @l }|!<v7>) -> <v8>
{ 1 if (2 > 3) { break @l } } <v8>: * COPY
2 <v6>: * NEW: r(2) -> <v6>
{ 2 } <v6>: * COPY
try { 1 if (2 > 3) { break @l } } finally { 2 } <v9>: * NEW: merge(try { 1 if (2 > 3) { break @l } } finally { 2 }|<v8>) -> <v9>
{ try { 1 if (2 > 3) { break @l } } finally { 2 } } <v9>: * COPY
while(true) { try { 1 if (2 > 3) { break @l } } finally { 2 } } !<v10>: *
@l while(true) { try { 1 if (2 > 3) { break @l } } finally { 2 } } !<v10>: * COPY
{ @l while(true) { try { 1 if (2 > 3) { break @l } } finally { 2 } } } !<v10>: * COPY
=====================
== t6 ==
fun t6() {
try {
@l while(true) {
1
if (2 > 3) {
break @l
}
}
5
} finally {
2
}
}
---------------------
<v1>: * NEW: magic[VALUE_CONSUMER](true|<v0>) -> <v1>
true <v0>: Boolean NEW: r(true) -> <v0>
1 <v2>: * NEW: r(1) -> <v2>
2 <v3>: {<: Comparable<Int>} NEW: r(2) -> <v3>
3 <v4>: Int NEW: r(3) -> <v4>
2 > 3 <v5>: Boolean NEW: call(2 > 3, compareTo|<v3>, <v4>) -> <v5>
break @l !<v6>: *
{ break @l } !<v6>: * COPY
if (2 > 3) { break @l } <v7>: * NEW: merge(if (2 > 3) { break @l }|!<v6>) -> <v7>
{ 1 if (2 > 3) { break @l } } <v7>: * COPY
while(true) { 1 if (2 > 3) { break @l } } !<v8>: *
@l while(true) { 1 if (2 > 3) { break @l } } !<v8>: * COPY
5 <v9>: * NEW: r(5) -> <v9>
{ @l while(true) { 1 if (2 > 3) { break @l } } 5 } <v9>: * COPY
2 <v10>: * NEW: r(2) -> <v10>
{ 2 } <v10>: * COPY
try { @l while(true) { 1 if (2 > 3) { break @l } } 5 } finally { 2 } <v11>: * NEW: merge(try { @l while(true) { 1 if (2 > 3) { break @l } } 5 } finally { 2 }|<v9>) -> <v11>
{ try { @l while(true) { 1 if (2 > 3) { break @l } } 5 } finally { 2 } } <v11>: * COPY
=====================
== t7 ==
fun t7() {
try {
@l while(true) {
1
if (2 > 3) {
break @l
}
}
} finally {
2
}
}
---------------------
<v1>: * NEW: magic[VALUE_CONSUMER](true|<v0>) -> <v1>
true <v0>: Boolean NEW: r(true) -> <v0>
1 <v2>: * NEW: r(1) -> <v2>
2 <v3>: {<: Comparable<Int>} NEW: r(2) -> <v3>
3 <v4>: Int NEW: r(3) -> <v4>
2 > 3 <v5>: Boolean NEW: call(2 > 3, compareTo|<v3>, <v4>) -> <v5>
break @l !<v6>: *
{ break @l } !<v6>: * COPY
if (2 > 3) { break @l } <v7>: * NEW: merge(if (2 > 3) { break @l }|!<v6>) -> <v7>
{ 1 if (2 > 3) { break @l } } <v7>: * COPY
while(true) { 1 if (2 > 3) { break @l } } !<v8>: *
@l while(true) { 1 if (2 > 3) { break @l } } !<v8>: * COPY
{ @l while(true) { 1 if (2 > 3) { break @l } } } !<v8>: * COPY
2 <v9>: * NEW: r(2) -> <v9>
{ 2 } <v9>: * COPY
try { @l while(true) { 1 if (2 > 3) { break @l } } } finally { 2 } <v10>: * NEW: merge(try { @l while(true) { 1 if (2 > 3) { break @l } } } finally { 2 }|!<v8>) -> <v10>
{ try { @l while(true) { 1 if (2 > 3) { break @l } } } finally { 2 } } <v10>: * COPY
=====================
== t8 ==
fun t8(a : Int) {
@l for (i in 1..a) {
try {
1
if (2 > 3) {
continue @l
}
} finally {
2
}
}
}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](a : Int) -> <v0>
<v4>: Int NEW: magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>
1 <v1>: Int NEW: r(1) -> <v1>
a <v2>: Int NEW: r(a) -> <v2>
1..a <v3>: {<: Iterable<Int>} NEW: call(1..a, rangeTo|<v1>, <v2>) -> <v3>
1 <v5>: * NEW: r(1) -> <v5>
2 <v6>: {<: Comparable<Int>} NEW: r(2) -> <v6>
3 <v7>: Int NEW: r(3) -> <v7>
2 > 3 <v8>: Boolean NEW: call(2 > 3, compareTo|<v6>, <v7>) -> <v8>
continue @l !<v10>: *
{ continue @l } !<v10>: * COPY
if (2 > 3) { continue @l } <v11>: * NEW: merge(if (2 > 3) { continue @l }|!<v10>) -> <v11>
{ 1 if (2 > 3) { continue @l } } <v11>: * COPY
2 <v9>: * NEW: r(2) -> <v9>
{ 2 } <v9>: * COPY
try { 1 if (2 > 3) { continue @l } } finally { 2 } <v12>: * NEW: merge(try { 1 if (2 > 3) { continue @l } } finally { 2 }|<v11>) -> <v12>
{ try { 1 if (2 > 3) { continue @l } } finally { 2 } } <v12>: * COPY
for (i in 1..a) { try { 1 if (2 > 3) { continue @l } } finally { 2 } } !<v13>: *
@l for (i in 1..a) { try { 1 if (2 > 3) { continue @l } } finally { 2 } } !<v13>: * COPY
{ @l for (i in 1..a) { try { 1 if (2 > 3) { continue @l } } finally { 2 } } } !<v13>: * COPY
=====================
== t9 ==
fun t9(a : Int) {
try {
@l for (i in 1..a) {
1
if (2 > 3) {
continue @l
}
}
5
} finally {
2
}
}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](a : Int) -> <v0>
<v4>: Int NEW: magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>
1 <v1>: Int NEW: r(1) -> <v1>
a <v2>: Int NEW: r(a) -> <v2>
1..a <v3>: {<: Iterable<Int>} NEW: call(1..a, rangeTo|<v1>, <v2>) -> <v3>
1 <v5>: * NEW: r(1) -> <v5>
2 <v6>: {<: Comparable<Int>} NEW: r(2) -> <v6>
3 <v7>: Int NEW: r(3) -> <v7>
2 > 3 <v8>: Boolean NEW: call(2 > 3, compareTo|<v6>, <v7>) -> <v8>
continue @l !<v9>: *
{ continue @l } !<v9>: * COPY
if (2 > 3) { continue @l } <v10>: * NEW: merge(if (2 > 3) { continue @l }|!<v9>) -> <v10>
{ 1 if (2 > 3) { continue @l } } <v10>: * COPY
for (i in 1..a) { 1 if (2 > 3) { continue @l } } !<v11>: *
@l for (i in 1..a) { 1 if (2 > 3) { continue @l } } !<v11>: * COPY
5 <v12>: * NEW: r(5) -> <v12>
{ @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } 5 } <v12>: * COPY
2 <v13>: * NEW: r(2) -> <v13>
{ 2 } <v13>: * COPY
try { @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } 5 } finally { 2 } <v14>: * NEW: merge(try { @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } 5 } finally { 2 }|<v12>) -> <v14>
{ try { @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } 5 } finally { 2 } } <v14>: * COPY
=====================
== t10 ==
fun t10(a : Int) {
try {
@l for (i in 1..a) {
1
if (2 > 3) {
continue @l
}
}
} finally {
2
}
}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](a : Int) -> <v0>
<v4>: Int NEW: magic[LOOP_RANGE_ITERATION](1..a|<v3>) -> <v4>
1 <v1>: Int NEW: r(1) -> <v1>
a <v2>: Int NEW: r(a) -> <v2>
1..a <v3>: {<: Iterable<Int>} NEW: call(1..a, rangeTo|<v1>, <v2>) -> <v3>
1 <v5>: * NEW: r(1) -> <v5>
2 <v6>: {<: Comparable<Int>} NEW: r(2) -> <v6>
3 <v7>: Int NEW: r(3) -> <v7>
2 > 3 <v8>: Boolean NEW: call(2 > 3, compareTo|<v6>, <v7>) -> <v8>
continue @l !<v9>: *
{ continue @l } !<v9>: * COPY
if (2 > 3) { continue @l } <v10>: * NEW: merge(if (2 > 3) { continue @l }|!<v9>) -> <v10>
{ 1 if (2 > 3) { continue @l } } <v10>: * COPY
for (i in 1..a) { 1 if (2 > 3) { continue @l } } !<v11>: *
@l for (i in 1..a) { 1 if (2 > 3) { continue @l } } !<v11>: * COPY
{ @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } } !<v11>: * COPY
2 <v12>: * NEW: r(2) -> <v12>
{ 2 } <v12>: * COPY
try { @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } } finally { 2 } <v13>: * NEW: merge(try { @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } } finally { 2 }|!<v11>) -> <v13>
{ try { @l for (i in 1..a) { 1 if (2 > 3) { continue @l } } } finally { 2 } } <v13>: * COPY
=====================
== t11 ==
fun t11() {
try {
return 1
}
finally {
return 2
}
}
---------------------
1 <v0>: Unit NEW: r(1) -> <v0>
return 1 !<v3>: *
{ return 1 } !<v3>: * COPY
2 <v1>: Unit NEW: r(2) -> <v1>
return 2 !<v2>: *
{ return 2 } !<v2>: * COPY
try { return 1 } finally { return 2 } <v4>: * NEW: merge(try { return 1 } finally { return 2 }|!<v3>) -> <v4>
{ try { return 1 } finally { return 2 } } <v4>: * COPY
=====================
== t12 ==
fun t12() : Int {
try {
return 1
}
finally {
doSmth(3)
}
}
---------------------
1 <v0>: Int NEW: r(1) -> <v0>
return 1 !<v3>: *
{ return 1 } !<v3>: * COPY
3 <v1>: Int NEW: r(3) -> <v1>
doSmth(3) <v2>: * NEW: call(doSmth(3), doSmth|<v1>) -> <v2>
{ doSmth(3) } <v2>: * COPY
try { return 1 } finally { doSmth(3) } <v4>: * NEW: merge(try { return 1 } finally { doSmth(3) }|!<v3>) -> <v4>
{ try { return 1 } finally { doSmth(3) } } <v4>: * COPY
=====================
== t13 ==
fun t13() : Int {
try {
return 1
}
catch (e: UnsupportedOperationException) {
doSmth(2)
}
finally {
doSmth(3)
}
}
---------------------
<v4>: {<: UnsupportedOperationException} NEW: magic[FAKE_INITIALIZER](e: UnsupportedOperationException) -> <v4>
1 <v0>: Int NEW: r(1) -> <v0>
return 1 !<v3>: *
{ return 1 } !<v3>: * COPY
2 <v5>: Int NEW: r(2) -> <v5>
doSmth(2) <v6>: * NEW: call(doSmth(2), doSmth|<v5>) -> <v6>
{ doSmth(2) } <v6>: * COPY
3 <v1>: Int NEW: r(3) -> <v1>
doSmth(3) <v2>: * NEW: call(doSmth(3), doSmth|<v1>) -> <v2>
{ doSmth(3) } <v2>: * COPY
try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } finally { doSmth(3) } <v7>: * NEW: merge(try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } finally { doSmth(3) }|!<v3>, <v6>) -> <v7>
{ try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } finally { doSmth(3) } } <v7>: * COPY
=====================
== t14 ==
fun t14() : Int {
try {
return 1
}
catch (e: UnsupportedOperationException) {
doSmth(2)
}
}
---------------------
<v2>: {<: UnsupportedOperationException} NEW: magic[FAKE_INITIALIZER](e: UnsupportedOperationException) -> <v2>
1 <v0>: Int NEW: r(1) -> <v0>
return 1 !<v1>: *
{ return 1 } !<v1>: * COPY
2 <v3>: Int NEW: r(2) -> <v3>
doSmth(2) <v4>: * NEW: call(doSmth(2), doSmth|<v3>) -> <v4>
{ doSmth(2) } <v4>: * COPY
try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } <v5>: * NEW: merge(try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) }|!<v1>, <v4>) -> <v5>
{ try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } } <v5>: * COPY
=====================
== t15 ==
fun t15() : Int {
try {
return 1
}
catch (e: UnsupportedOperationException) {
return 2
}
finally {
doSmth(3)
}
}
---------------------
<v4>: {<: UnsupportedOperationException} NEW: magic[FAKE_INITIALIZER](e: UnsupportedOperationException) -> <v4>
1 <v0>: Int NEW: r(1) -> <v0>
return 1 !<v3>: *
{ return 1 } !<v3>: * COPY
2 <v5>: Int NEW: r(2) -> <v5>
return 2 !<v6>: *
{ return 2 } !<v6>: * COPY
3 <v1>: Int NEW: r(3) -> <v1>
doSmth(3) <v2>: * NEW: call(doSmth(3), doSmth|<v1>) -> <v2>
{ doSmth(3) } <v2>: * COPY
try { return 1 } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } <v7>: * NEW: merge(try { return 1 } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) }|!<v3>, !<v6>) -> <v7>
{ try { return 1 } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } } <v7>: * COPY
=====================
== t16 ==
fun t16() : Int {
try {
doSmth(1)
}
catch (e: UnsupportedOperationException) {
return 2
}
finally {
doSmth(3)
}
}
---------------------
<v2>: {<: UnsupportedOperationException} NEW: magic[FAKE_INITIALIZER](e: UnsupportedOperationException) -> <v2>
1 <v0>: Int NEW: r(1) -> <v0>
doSmth(1) <v1>: * NEW: call(doSmth(1), doSmth|<v0>) -> <v1>
{ doSmth(1) } <v1>: * COPY
2 <v3>: Int NEW: r(2) -> <v3>
return 2 !<v6>: *
{ return 2 } !<v6>: * COPY
3 <v4>: Int NEW: r(3) -> <v4>
doSmth(3) <v5>: * NEW: call(doSmth(3), doSmth|<v4>) -> <v5>
{ doSmth(3) } <v5>: * COPY
try { doSmth(1) } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } <v7>: * NEW: merge(try { doSmth(1) } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) }|<v1>, !<v6>) -> <v7>
{ try { doSmth(1) } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } } <v7>: * COPY
=====================
== doSmth ==
fun doSmth(i: Int) {
}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](i: Int) -> <v0>
=====================