[FIR] Disallow operators not on functions
Introduce `NOT_FUNCTION_AS_OPERATOR` and use it instead of `PROPERTY_AS_OPERATOR` ^KT-65881 Fixed Merge-request: KT-MR-14547
This commit is contained in:
committed by
Space Team
parent
df9d59851d
commit
2d4f4b9bb5
+4
-3
@@ -4529,9 +4529,10 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.PROPERTY_AS_OPERATOR) { firDiagnostic ->
|
||||
PropertyAsOperatorImpl(
|
||||
firSymbolBuilder.variableLikeBuilder.buildVariableSymbol(firDiagnostic.a),
|
||||
add(FirErrors.NOT_FUNCTION_AS_OPERATOR) { firDiagnostic ->
|
||||
NotFunctionAsOperatorImpl(
|
||||
firDiagnostic.a,
|
||||
firSymbolBuilder.buildSymbol(firDiagnostic.b),
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
|
||||
+4
-3
@@ -3156,9 +3156,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
val operator: String
|
||||
}
|
||||
|
||||
interface PropertyAsOperator : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = PropertyAsOperator::class
|
||||
val property: KtVariableSymbol
|
||||
interface NotFunctionAsOperator : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = NotFunctionAsOperator::class
|
||||
val elementName: String
|
||||
val elementSymbol: KtSymbol
|
||||
}
|
||||
|
||||
interface DslScopeViolation : KtFirDiagnostic<PsiElement> {
|
||||
|
||||
+4
-3
@@ -3800,11 +3800,12 @@ internal class AssignmentOperatorShouldReturnUnitImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.AssignmentOperatorShouldReturnUnit
|
||||
|
||||
internal class PropertyAsOperatorImpl(
|
||||
override val property: KtVariableSymbol,
|
||||
internal class NotFunctionAsOperatorImpl(
|
||||
override val elementName: String,
|
||||
override val elementSymbol: KtSymbol,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.PropertyAsOperator
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.NotFunctionAsOperator
|
||||
|
||||
internal class DslScopeViolationImpl(
|
||||
override val calleeSymbol: KtSymbol,
|
||||
|
||||
Reference in New Issue
Block a user