Convert EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR into deprecation error
#KT-28078 Fixed
This commit is contained in:
+11
-2
@@ -1045,8 +1045,17 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR) { firDiagnostic ->
|
||||
ExposedPropertyTypeInConstructorImpl(
|
||||
add(FirErrors.EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR.errorFactory) { firDiagnostic ->
|
||||
ExposedPropertyTypeInConstructorErrorImpl(
|
||||
firDiagnostic.a,
|
||||
firSymbolBuilder.buildSymbol(firDiagnostic.b.fir),
|
||||
firDiagnostic.c,
|
||||
firDiagnostic as FirPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR.warningFactory) { firDiagnostic ->
|
||||
ExposedPropertyTypeInConstructorWarningImpl(
|
||||
firDiagnostic.a,
|
||||
firSymbolBuilder.buildSymbol(firDiagnostic.b.fir),
|
||||
firDiagnostic.c,
|
||||
|
||||
+9
-2
@@ -754,8 +754,15 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract val restrictingVisibility: EffectiveVisibility
|
||||
}
|
||||
|
||||
abstract class ExposedPropertyTypeInConstructor : KtFirDiagnostic<KtNamedDeclaration>() {
|
||||
override val diagnosticClass get() = ExposedPropertyTypeInConstructor::class
|
||||
abstract class ExposedPropertyTypeInConstructorError : KtFirDiagnostic<KtNamedDeclaration>() {
|
||||
override val diagnosticClass get() = ExposedPropertyTypeInConstructorError::class
|
||||
abstract val elementVisibility: EffectiveVisibility
|
||||
abstract val restrictingDeclaration: KtSymbol
|
||||
abstract val restrictingVisibility: EffectiveVisibility
|
||||
}
|
||||
|
||||
abstract class ExposedPropertyTypeInConstructorWarning : KtFirDiagnostic<KtNamedDeclaration>() {
|
||||
override val diagnosticClass get() = ExposedPropertyTypeInConstructorWarning::class
|
||||
abstract val elementVisibility: EffectiveVisibility
|
||||
abstract val restrictingDeclaration: KtSymbol
|
||||
abstract val restrictingVisibility: EffectiveVisibility
|
||||
|
||||
+10
-2
@@ -903,13 +903,21 @@ internal class ExposedPropertyTypeImpl(
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.ExposedPropertyType(), KtAbstractFirDiagnostic<KtNamedDeclaration>
|
||||
|
||||
internal class ExposedPropertyTypeInConstructorImpl(
|
||||
internal class ExposedPropertyTypeInConstructorErrorImpl(
|
||||
override val elementVisibility: EffectiveVisibility,
|
||||
override val restrictingDeclaration: KtSymbol,
|
||||
override val restrictingVisibility: EffectiveVisibility,
|
||||
override val firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.ExposedPropertyTypeInConstructor(), KtAbstractFirDiagnostic<KtNamedDeclaration>
|
||||
) : KtFirDiagnostic.ExposedPropertyTypeInConstructorError(), KtAbstractFirDiagnostic<KtNamedDeclaration>
|
||||
|
||||
internal class ExposedPropertyTypeInConstructorWarningImpl(
|
||||
override val elementVisibility: EffectiveVisibility,
|
||||
override val restrictingDeclaration: KtSymbol,
|
||||
override val restrictingVisibility: EffectiveVisibility,
|
||||
override val firDiagnostic: FirPsiDiagnostic,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.ExposedPropertyTypeInConstructorWarning(), KtAbstractFirDiagnostic<KtNamedDeclaration>
|
||||
|
||||
internal class ExposedParameterTypeImpl(
|
||||
override val elementVisibility: EffectiveVisibility,
|
||||
|
||||
+6
@@ -10377,6 +10377,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/exposed/propertyInPrivateConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyInPrivateConstructorError.kt")
|
||||
public void testPropertyInPrivateConstructorError() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/exposed/propertyInPrivateConstructorError.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyInSimpleConstructor.kt")
|
||||
public void testPropertyInSimpleConstructor() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user