[FIR] Relax MULTIPLE_DEFAULTS_* to account for the K1 behavior

^KT-56442
^KT-36188
This commit is contained in:
Nikolay Lunyak
2023-08-18 12:18:52 +03:00
committed by Space Team
parent 3f1bf6112f
commit 13a7bb95b3
29 changed files with 505 additions and 27 deletions
@@ -2602,6 +2602,34 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_DEPRECATION.errorFactory) { firDiagnostic ->
MultipleDefaultsInheritedFromSupertypesDeprecationErrorImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_DEPRECATION.warningFactory) { firDiagnostic ->
MultipleDefaultsInheritedFromSupertypesDeprecationWarningImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE_DEPRECATION.errorFactory) { firDiagnostic ->
MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationErrorImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE_DEPRECATION.warningFactory) { firDiagnostic ->
MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationWarningImpl(
firSymbolBuilder.buildSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.TYPEALIAS_EXPANDS_TO_ARRAY_OF_NOTHINGS) { firDiagnostic ->
TypealiasExpandsToArrayOfNothingsImpl(
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
@@ -1849,6 +1849,26 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
val valueParameter: KtSymbol
}
interface MultipleDefaultsInheritedFromSupertypesDeprecationError : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = MultipleDefaultsInheritedFromSupertypesDeprecationError::class
val valueParameter: KtSymbol
}
interface MultipleDefaultsInheritedFromSupertypesDeprecationWarning : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = MultipleDefaultsInheritedFromSupertypesDeprecationWarning::class
val valueParameter: KtSymbol
}
interface MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationError : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationError::class
val valueParameter: KtSymbol
}
interface MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationWarning : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationWarning::class
val valueParameter: KtSymbol
}
interface TypealiasExpandsToArrayOfNothings : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = TypealiasExpandsToArrayOfNothings::class
val type: KtType
@@ -2221,6 +2221,30 @@ internal class MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideImpl
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverride
internal class MultipleDefaultsInheritedFromSupertypesDeprecationErrorImpl(
override val valueParameter: KtSymbol,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.MultipleDefaultsInheritedFromSupertypesDeprecationError
internal class MultipleDefaultsInheritedFromSupertypesDeprecationWarningImpl(
override val valueParameter: KtSymbol,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.MultipleDefaultsInheritedFromSupertypesDeprecationWarning
internal class MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationErrorImpl(
override val valueParameter: KtSymbol,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationError
internal class MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationWarningImpl(
override val valueParameter: KtSymbol,
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.MultipleDefaultsInheritedFromSupertypesWhenNoExplicitOverrideDeprecationWarning
internal class TypealiasExpandsToArrayOfNothingsImpl(
override val type: KtType,
firDiagnostic: KtPsiDiagnostic,
@@ -357,6 +357,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/falseNegativeDuplicateDefaultValues1.kt");
}
@Test
@TestMetadata("falseNegativeDuplicateDefaultValues1_error.kt")
public void testFalseNegativeDuplicateDefaultValues1_error() throws Exception {
runTest("compiler/testData/diagnostics/tests/falseNegativeDuplicateDefaultValues1_error.kt");
}
@Test
@TestMetadata("falseNegativeDuplicateDefaultValues2.kt")
public void testFalseNegativeDuplicateDefaultValues2() throws Exception {
@@ -753,12 +759,30 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/missingIteratorMissing.kt");
}
@Test
@TestMetadata("missingMultipleDefaultsOnTransitiveInheritance1.kt")
public void testMissingMultipleDefaultsOnTransitiveInheritance1() throws Exception {
runTest("compiler/testData/diagnostics/tests/missingMultipleDefaultsOnTransitiveInheritance1.kt");
}
@Test
@TestMetadata("missingMultipleDefaultsOnTransitiveInheritance2.kt")
public void testMissingMultipleDefaultsOnTransitiveInheritance2() throws Exception {
runTest("compiler/testData/diagnostics/tests/missingMultipleDefaultsOnTransitiveInheritance2.kt");
}
@Test
@TestMetadata("missingWrongAnnotationTarget.kt")
public void testMissingWrongAnnotationTarget() throws Exception {
runTest("compiler/testData/diagnostics/tests/missingWrongAnnotationTarget.kt");
}
@Test
@TestMetadata("moreThanOneOverriddenMissingK2.kt")
public void testMoreThanOneOverriddenMissingK2() throws Exception {
runTest("compiler/testData/diagnostics/tests/moreThanOneOverriddenMissingK2.kt");
}
@Test
@TestMetadata("MultilineStringTemplates.kt")
public void testMultilineStringTemplates() throws Exception {
@@ -771,6 +795,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/MultipleBounds.kt");
}
@Test
@TestMetadata("multipleDefaultsIncorrectlyAllowed1.kt")
public void testMultipleDefaultsIncorrectlyAllowed1() throws Exception {
runTest("compiler/testData/diagnostics/tests/multipleDefaultsIncorrectlyAllowed1.kt");
}
@Test
@TestMetadata("multipleDefaultsIncorrectlyAllowed2.kt")
public void testMultipleDefaultsIncorrectlyAllowed2() throws Exception {
runTest("compiler/testData/diagnostics/tests/multipleDefaultsIncorrectlyAllowed2.kt");
}
@Test
@TestMetadata("multipleDefaultsNoSource.kt")
public void testMultipleDefaultsNoSource() throws Exception {
@@ -357,6 +357,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/falseNegativeDuplicateDefaultValues1.kt");
}
@Test
@TestMetadata("falseNegativeDuplicateDefaultValues1_error.kt")
public void testFalseNegativeDuplicateDefaultValues1_error() throws Exception {
runTest("compiler/testData/diagnostics/tests/falseNegativeDuplicateDefaultValues1_error.kt");
}
@Test
@TestMetadata("falseNegativeDuplicateDefaultValues2.kt")
public void testFalseNegativeDuplicateDefaultValues2() throws Exception {
@@ -753,12 +759,30 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/missingIteratorMissing.kt");
}
@Test
@TestMetadata("missingMultipleDefaultsOnTransitiveInheritance1.kt")
public void testMissingMultipleDefaultsOnTransitiveInheritance1() throws Exception {
runTest("compiler/testData/diagnostics/tests/missingMultipleDefaultsOnTransitiveInheritance1.kt");
}
@Test
@TestMetadata("missingMultipleDefaultsOnTransitiveInheritance2.kt")
public void testMissingMultipleDefaultsOnTransitiveInheritance2() throws Exception {
runTest("compiler/testData/diagnostics/tests/missingMultipleDefaultsOnTransitiveInheritance2.kt");
}
@Test
@TestMetadata("missingWrongAnnotationTarget.kt")
public void testMissingWrongAnnotationTarget() throws Exception {
runTest("compiler/testData/diagnostics/tests/missingWrongAnnotationTarget.kt");
}
@Test
@TestMetadata("moreThanOneOverriddenMissingK2.kt")
public void testMoreThanOneOverriddenMissingK2() throws Exception {
runTest("compiler/testData/diagnostics/tests/moreThanOneOverriddenMissingK2.kt");
}
@Test
@TestMetadata("MultilineStringTemplates.kt")
public void testMultilineStringTemplates() throws Exception {
@@ -771,6 +795,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/MultipleBounds.kt");
}
@Test
@TestMetadata("multipleDefaultsIncorrectlyAllowed1.kt")
public void testMultipleDefaultsIncorrectlyAllowed1() throws Exception {
runTest("compiler/testData/diagnostics/tests/multipleDefaultsIncorrectlyAllowed1.kt");
}
@Test
@TestMetadata("multipleDefaultsIncorrectlyAllowed2.kt")
public void testMultipleDefaultsIncorrectlyAllowed2() throws Exception {
runTest("compiler/testData/diagnostics/tests/multipleDefaultsIncorrectlyAllowed2.kt");
}
@Test
@TestMetadata("multipleDefaultsNoSource.kt")
public void testMultipleDefaultsNoSource() throws Exception {