K2: implement BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION

#KT-59390 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-11-29 08:09:41 +01:00
committed by Space Team
parent 299d279915
commit 526bc1744a
25 changed files with 219 additions and 23 deletions
@@ -4976,6 +4976,14 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION) { firDiagnostic ->
BuilderInferenceMultiLambdaRestrictionImpl(
firDiagnostic.a,
firDiagnostic.b,
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirJvmErrors.OVERRIDE_CANNOT_BE_STATIC) { firDiagnostic ->
OverrideCannotBeStaticImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -3463,6 +3463,12 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
val containingDeclarationName: Name
}
interface BuilderInferenceMultiLambdaRestriction : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = BuilderInferenceMultiLambdaRestriction::class
val typeParameterName: Name
val containingDeclarationName: Name
}
interface OverrideCannotBeStatic : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = OverrideCannotBeStatic::class
}
@@ -4176,6 +4176,13 @@ internal class BuilderInferenceStubReceiverImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.BuilderInferenceStubReceiver
internal class BuilderInferenceMultiLambdaRestrictionImpl(
override val typeParameterName: Name,
override val containingDeclarationName: Name,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.BuilderInferenceMultiLambdaRestriction
internal class OverrideCannotBeStaticImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
@@ -16733,6 +16733,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("builderInferenceAnnotationInLambdaWithTVExpectedType.kt")
public void testBuilderInferenceAnnotationInLambdaWithTVExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/builderInferenceAnnotationInLambdaWithTVExpectedType.kt");
}
@Test
@TestMetadata("changingResolveIfDontUseBuilderInference.kt")
public void testChangingResolveIfDontUseBuilderInference() throws Exception {
@@ -16733,6 +16733,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/builderInference"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("builderInferenceAnnotationInLambdaWithTVExpectedType.kt")
public void testBuilderInferenceAnnotationInLambdaWithTVExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/builderInferenceAnnotationInLambdaWithTVExpectedType.kt");
}
@Test
@TestMetadata("changingResolveIfDontUseBuilderInference.kt")
public void testChangingResolveIfDontUseBuilderInference() throws Exception {