[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
+102
@@ -0,0 +1,102 @@
|
||||
// KT-13612 related tests (reassignment in try-catch-finally)
|
||||
|
||||
fun f1() {
|
||||
val n: Int
|
||||
try {
|
||||
n = 1
|
||||
throw Exception()
|
||||
}
|
||||
catch (e: Exception) {
|
||||
// KT-13612: reassignment
|
||||
n = 2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun f2() {
|
||||
val n: Int
|
||||
try {
|
||||
n = 1
|
||||
throw Exception()
|
||||
}
|
||||
finally {
|
||||
n = 2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun g1(flag: Boolean) {
|
||||
val n: Int
|
||||
try {
|
||||
if (flag) throw Exception()
|
||||
n = 1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
// KT-13612: ? reassignment or definite assignment ?
|
||||
n = 2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun g2(flag: Boolean) {
|
||||
val n: Int
|
||||
try {
|
||||
if (flag) throw Exception()
|
||||
n = 1
|
||||
}
|
||||
finally {
|
||||
n = 2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun h1(flag: Boolean) {
|
||||
val n = try {
|
||||
if (flag) throw Exception()
|
||||
1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun h2(flag: Boolean) {
|
||||
val n = try {
|
||||
if (flag) throw Exception()
|
||||
1
|
||||
}
|
||||
finally {
|
||||
2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun j(flag: Boolean) {
|
||||
if (flag) throw Exception()
|
||||
}
|
||||
|
||||
fun k1(flag: Boolean) {
|
||||
val n: Int
|
||||
try {
|
||||
n = 1
|
||||
j(flag)
|
||||
}
|
||||
catch (e: Exception) {
|
||||
// KT-13612: reassignment
|
||||
n = 2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
|
||||
fun k2(flag: Boolean) {
|
||||
val n: Int
|
||||
try {
|
||||
n = 1
|
||||
j(flag)
|
||||
}
|
||||
finally {
|
||||
n = 2
|
||||
}
|
||||
n.hashCode()
|
||||
}
|
||||
Reference in New Issue
Block a user