Fix OOM when there are several lambdas with extension function types
#KT-41335 Fixed
This commit is contained in:
Generated
+5
@@ -12622,6 +12622,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ class PostponedArgumentInputTypesResolver(
|
||||
getDeclaredParametersFromRelatedLambdas(argument, postponedArguments, variableDependencyProvider)
|
||||
|
||||
val annotationsFromConstraints = functionalTypesFromConstraints?.run {
|
||||
Annotations.create(flatMap { it.type.annotations })
|
||||
Annotations.create(flatMapTo(SmartSet.create()) { it.type.annotations }.toList())
|
||||
} ?: Annotations.EMPTY
|
||||
|
||||
val annotations = if (isThereExtensionFunctionAmongRelatedLambdas) {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
+5
@@ -13847,6 +13847,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
+5
@@ -13847,6 +13847,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
+5
@@ -12622,6 +12622,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
Generated
+5
@@ -10802,6 +10802,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
Generated
+5
@@ -10802,6 +10802,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
+5
@@ -10867,6 +10867,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt39824.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdasWithExtensionFunctionType.kt")
|
||||
public void testLambdasWithExtensionFunctionType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdasWithExtensionFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lastExpressionOfLambdaWithNothingConstraint.kt")
|
||||
public void testLastExpressionOfLambdaWithNothingConstraint() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
|
||||
|
||||
Reference in New Issue
Block a user