K1: add diagnostic BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION

Let's call builder lambdas (BL) a lambda that has non-fixed input type
projection at the moment of lambda arguments analysis, such lambdas
is a subject to be analyzed with builder inference
Due to bug in constraint system joining algorithm, currently system
of two or more such lambdas may lead to unsound type inference

Diagnostic added here should be reported in case when there are two
BL that shares a common constraint system, while not annotated with
@BuilderInference, as a protection against aforementioned bug

It's reported by ConstraintSystemCompleter when such situation has
occurred during builder inference phase, it is the same place that
decides wherever lambdas is subject to builder inference or not

KT-53740
This commit is contained in:
Simon Ogorodnik
2022-08-26 16:24:11 +02:00
committed by teamcity
parent db0d8d9f57
commit 105358dcf6
19 changed files with 415 additions and 13 deletions
@@ -14457,6 +14457,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/inference/builderInference/labaledCall.kt");
}
@Test
@TestMetadata("multiLambdaRestriction.kt")
public void testMultiLambdaRestriction() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/multiLambdaRestriction.kt");
}
@Test
@TestMetadata("multiLambdaRestrictionDisabled.kt")
public void testMultiLambdaRestrictionDisabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/multiLambdaRestrictionDisabled.kt");
}
@Test
@TestMetadata("propertySubstitution.kt")
public void testPropertySubstitution() throws Exception {