JVM prune exception edges in DFA in some cases

This commit is contained in:
Dmitry Petrov
2022-02-22 15:09:16 +03:00
committed by Space
parent 817f9f13b7
commit 872b81ac8a
14 changed files with 219 additions and 73 deletions
@@ -35,9 +35,13 @@ inline fun Builder.t2(body: Builder.() -> Unit) {
val expectedLength = 1906
fun doStuff(b: Builder) {
b.t2 { t2 { t2 { t2 { t2 { t2 { t2 { text("1") } } } } } } }
}
fun box(): String {
val b = Builder("")
b.t2 { t2 { t2 { t2 { t2 { t2 { t2 { text("1") } } } } } } }
doStuff(b)
if (b.content.length != expectedLength)
return "${b.content.length}"
else
@@ -0,0 +1,45 @@
// TARGET_BACKEND: JVM
// ^ this test might be rather slow
class Builder(var content: String)
fun Builder.begin(t: String) {
content += "<$t>"
}
fun Builder.text(t: String) {
content += t
}
fun Builder.end(t: String) {
content += "</$t>"
}
fun err(e: Throwable) {}
fun Builder.tag(t: String, body: Builder.() -> Unit) {
begin(t)
try {
body()
} catch (e: Throwable) {
err(e)
} finally {
end(t)
}
}
fun Builder.t2(body: Builder.() -> Unit) {
tag("t", body)
tag("t", body)
}
val expectedLength = 1906
fun box(): String {
val b = Builder("")
b.t2 { t2 { t2 { t2 { t2 { t2 { t2 { text("1") } } } } } } }
if (b.content.length != expectedLength)
return "${b.content.length}"
else
return "OK"
}