Fix OOM when there are several lambdas with extension function types

#KT-41335 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-08-26 10:43:55 +03:00
parent 085e0dc1de
commit 567e6ca9ca
9 changed files with 78 additions and 1 deletions
@@ -0,0 +1,42 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
interface Stroke
interface Fill
data class Rectangle(val width: Int, val height: Int)
open class Ellipse()
data class Circle(val radius: Int) : Ellipse()
interface Canvas {
fun rect(rectangle: Rectangle, fill: Fill)
fun rect(rectangle: Rectangle, stroke: Stroke, fill: Fill?)
fun rect(rectangle: Rectangle, radius: Double, fill: Fill)
fun rect(rectangle: Rectangle, radius: Double, stroke: Stroke, fill: Fill?)
fun circle(circle: Circle, fill: Fill)
fun circle(circle: Circle, stroke: Stroke, fill: Fill?)
}
fun test() {
val rect = Rectangle(100, 100)
val circle = Circle(100)
listOf<Canvas.(Stroke, Fill) -> Unit>(
{ _, fill -> rect(rect, fill) },
{ _, fill -> rect(rect, 10.0, fill) },
{ stroke, fill -> rect(rect, stroke, fill) },
{ stroke, fill -> rect(rect, 10.0, stroke, fill) },
{ _, fill -> circle(circle, fill) },
{ stroke, fill -> circle(circle, stroke, fill) },
).forEach {
check(it)
}
}
fun check(block: Canvas.(Stroke, Fill) -> Unit) {}
fun box(): String {
test()
return "OK"
}