[FIR] Don't assume that exit lambda node is target for exceptional exit for inplace lambdas

#KT-39709 Fixed
#KT-43156 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-11-12 11:39:18 +03:00
committed by teamcityserver
parent 440cf78884
commit 87380d1913
9 changed files with 18 additions and 24 deletions
@@ -30,7 +30,7 @@ fun innerTryCatchInitializes() {
}
}
// Can get here only when inlined lambda exited properly, i.e. x is initialized
<!UNINITIALIZED_VARIABLE!>x<!>.inc()
x.inc()
outerComputation()
} catch (e: java.lang.Exception) {
@@ -44,4 +44,4 @@ fun innerTryCatchInitializes() {
}
// Here x=I because outer try-catch either exited normally (x=I) or catched exception (x=I, with reassingment, though)
x.inc()
}
}
@@ -26,7 +26,7 @@ fun throwIfNotCalled() {
}
// x *is* initialized here, because if myRun was never called -> exception
// were thrown and control flow wouldn't be here
println(<!UNINITIALIZED_VARIABLE!>x<!>)
println(x)
}
fun catchThrowIfNotCalled() {
@@ -45,4 +45,4 @@ fun catchThrowIfNotCalled() {
// x *isn't* initialized here!
println(<!UNINITIALIZED_VARIABLE!>x<!>)
}
}
@@ -43,7 +43,7 @@ fun possibleReassignmentInTryCatch() {
}
x.inc()
}
<!UNINITIALIZED_VARIABLE!>x<!>.inc()
x.inc()
}
fun tryCatchOuter() {
@@ -98,7 +98,7 @@ class DefiniteInitializationAfterThrow {
if (bar()) throw RuntimeException()
a = 42
}
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
a.hashCode()
}
fun bar() = false
}