[FIR] Make UNSAFE_INFIX_CALL and UNSAFE_OPERATOR_CALL parameter nullable
This fixes an NPE in the IDE in presence of a syntax error when the argument expression has no source. #KT-64062 Fixed
This commit is contained in:
committed by
Space Team
parent
b059754f64
commit
8496722603
+2
-2
@@ -4045,7 +4045,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||
firDiagnostic.b.source!!.psi as KtExpression,
|
||||
firDiagnostic.c,
|
||||
firDiagnostic.d.source!!.psi as KtExpression,
|
||||
firDiagnostic.d?.source?.psi as? KtExpression,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
@@ -4055,7 +4055,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||
firDiagnostic.b.source!!.psi as KtExpression,
|
||||
firDiagnostic.c,
|
||||
firDiagnostic.d.source!!.psi as KtExpression,
|
||||
firDiagnostic.d?.source?.psi as? KtExpression,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
|
||||
+2
-2
@@ -2822,7 +2822,7 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
val receiverType: KtType
|
||||
val receiverExpression: KtExpression
|
||||
val operator: String
|
||||
val argumentExpression: KtExpression
|
||||
val argumentExpression: KtExpression?
|
||||
}
|
||||
|
||||
interface UnsafeOperatorCall : KtFirDiagnostic<KtExpression> {
|
||||
@@ -2830,7 +2830,7 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
val receiverType: KtType
|
||||
val receiverExpression: KtExpression
|
||||
val operator: String
|
||||
val argumentExpression: KtExpression
|
||||
val argumentExpression: KtExpression?
|
||||
}
|
||||
|
||||
interface IteratorOnNullable : KtFirDiagnostic<KtExpression> {
|
||||
|
||||
+2
-2
@@ -3396,7 +3396,7 @@ internal class UnsafeInfixCallImpl(
|
||||
override val receiverType: KtType,
|
||||
override val receiverExpression: KtExpression,
|
||||
override val operator: String,
|
||||
override val argumentExpression: KtExpression,
|
||||
override val argumentExpression: KtExpression?,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.UnsafeInfixCall
|
||||
@@ -3405,7 +3405,7 @@ internal class UnsafeOperatorCallImpl(
|
||||
override val receiverType: KtType,
|
||||
override val receiverExpression: KtExpression,
|
||||
override val operator: String,
|
||||
override val argumentExpression: KtExpression,
|
||||
override val argumentExpression: KtExpression?,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<KtExpression>(firDiagnostic, token), KtFirDiagnostic.UnsafeOperatorCall
|
||||
|
||||
+6
@@ -26348,6 +26348,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsafeCallOnOperatorRedCode.kt")
|
||||
public void testUnsafeCallOnOperatorRedCode() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/unsafeCallOnOperatorRedCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("uselessElvis.kt")
|
||||
public void testUselessElvis() throws Exception {
|
||||
|
||||
+6
@@ -26348,6 +26348,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsafeCallOnOperatorRedCode.kt")
|
||||
public void testUnsafeCallOnOperatorRedCode() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/unsafeCallOnOperatorRedCode.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("uselessElvis.kt")
|
||||
public void testUselessElvis() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user