[FIR] Allow, but also warn, KMutableProperty with captured types
^KT-63589 Fixed
This commit is contained in:
committed by
Space Team
parent
80d9933543
commit
b077293396
+6
@@ -2662,6 +2662,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.MUTABLE_PROPERTY_WITH_CAPTURED_TYPE) { firDiagnostic ->
|
||||
MutablePropertyWithCapturedTypeImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.NOTHING_TO_OVERRIDE) { firDiagnostic ->
|
||||
NothingToOverrideImpl(
|
||||
firSymbolBuilder.callableBuilder.buildCallableSymbol(firDiagnostic.a),
|
||||
|
||||
+4
@@ -1885,6 +1885,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = UnsupportedClassLiteralsWithEmptyLhs::class
|
||||
}
|
||||
|
||||
interface MutablePropertyWithCapturedType : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = MutablePropertyWithCapturedType::class
|
||||
}
|
||||
|
||||
interface NothingToOverride : KtFirDiagnostic<KtModifierListOwner> {
|
||||
override val diagnosticClass get() = NothingToOverride::class
|
||||
val declaration: KtCallableSymbol
|
||||
|
||||
+5
@@ -2266,6 +2266,11 @@ internal class UnsupportedClassLiteralsWithEmptyLhsImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.UnsupportedClassLiteralsWithEmptyLhs
|
||||
|
||||
internal class MutablePropertyWithCapturedTypeImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.MutablePropertyWithCapturedType
|
||||
|
||||
internal class NothingToOverrideImpl(
|
||||
override val declaration: KtCallableSymbol,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
|
||||
+12
@@ -4177,6 +4177,18 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mutablePropertyGenericButNotCapturedType.kt")
|
||||
public void testMutablePropertyGenericButNotCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/mutablePropertyGenericButNotCapturedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mutablePropertyWithCapturedType.kt")
|
||||
public void testMutablePropertyWithCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/mutablePropertyWithCapturedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referenceToExtension.kt")
|
||||
public void testReferenceToExtension() throws Exception {
|
||||
|
||||
+12
@@ -4177,6 +4177,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mutablePropertyGenericButNotCapturedType.kt")
|
||||
public void testMutablePropertyGenericButNotCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/mutablePropertyGenericButNotCapturedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mutablePropertyWithCapturedType.kt")
|
||||
public void testMutablePropertyWithCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/references/mutablePropertyWithCapturedType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("referenceToExtension.kt")
|
||||
public void testReferenceToExtension() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user