From f26059a7d334ea1edd722f4e776d8656c2f0e280 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 26 Oct 2021 17:35:31 +0300 Subject: [PATCH] [FE] Add clear warning about future changes about nullability of safe call with non nullable receiver ^KT-46860 --- .../diagnostics/KtFirDataClassConverters.kt | 7 +++ .../api/fir/diagnostics/KtFirDiagnostics.kt | 5 ++ .../fir/diagnostics/KtFirDiagnosticsImpl.kt | 6 +++ .../resolve/arguments/lambdaInLambda.kt | 2 +- .../boundSmartcasts/boundSmartcasts.kt | 4 +- .../diagnostics/FirDiagnosticsList.kt | 1 + .../fir/analysis/diagnostics/FirErrors.kt | 2 + .../FirUnnecessarySafeCallChecker.kt | 5 ++ .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../resolve/calls/CallExpressionResolver.kt | 16 +++++- .../jsr305/defaultAnnotationAppliedToType.kt | 4 +- ...tAnnotationAppliedToTypeForCompiledJava.kt | 2 +- .../jsr305/springNullableWithTypeUse.kt | 6 +-- .../jsr305/typeUseVsMethodConflict.fir.kt | 4 +- .../jsr305/typeUseVsMethodConflict.kt | 4 +- .../nullabilityWarnings/safeCalls.fir.kt | 2 +- .../jsr305/nullabilityWarnings/safeCalls.kt | 2 +- .../fieldsAreNullable.fir.kt | 2 +- .../typeQualifierDefault/fieldsAreNullable.kt | 2 +- .../typeQualifierDefault/fieldsAreNullable.kt | 2 +- .../typeQualifierDefault/forceFlexibility.kt | 2 +- .../nullabilityFromOverridden.kt | 2 +- .../overridingDefaultQualifier.kt | 8 +-- .../typeQualifierDefault/springNullable.kt | 2 +- .../springNullablePackage.kt | 2 +- .../tests/lombokSimple.kt | 4 +- .../tests/ExtensionCallInvoke.fir.kt | 2 +- .../diagnostics/tests/ExtensionCallInvoke.kt | 2 +- .../tests/FunctionCalleeExpressions.fir.kt | 2 +- .../tests/FunctionCalleeExpressions.kt | 2 +- .../diagnostics/tests/SafeCallInvoke.fir.kt | 2 +- .../diagnostics/tests/SafeCallInvoke.kt | 4 +- .../tests/SafeCallNonNullReceiver.kt | 2 +- .../tests/SafeCallNonNullReceiver2.kt | 2 +- .../SafeCallNonNullReceiverReturnNull.fir.kt | 2 +- .../SafeCallNonNullReceiverReturnNull.kt | 2 +- .../deadCode/deadCallInReceiver.fir.kt | 2 +- .../deadCode/deadCallInReceiver.kt | 4 +- .../controlFlowAnalysis/throwInLambda.fir.kt | 2 +- .../controlFlowAnalysis/throwInLambda.kt | 4 +- .../extensions/ExtensionFunctions.fir.kt | 4 +- .../tests/extensions/ExtensionFunctions.kt | 4 +- .../diagnostics/tests/generics/kt9985.fir.kt | 8 +-- .../diagnostics/tests/generics/kt9985.kt | 8 +-- .../generics/nullability/smartCasts.fir.kt | 8 +-- .../tests/generics/nullability/smartCasts.kt | 8 +-- .../nullability/smartCastsOnThis.fir.kt | 6 +-- .../generics/nullability/smartCastsOnThis.kt | 6 +-- .../builderInference/stubTypes/memberScope.kt | 6 +-- .../stubTypes/nullability.fir.kt | 16 +++--- .../builderInference/stubTypes/nullability.kt | 12 ++--- .../tests/inference/findViewById.fir.kt | 2 +- .../tests/inference/findViewById.kt | 2 +- .../nestedCalls/makeNullableIfSafeCall.kt | 6 +-- ...martCastInLambdaReturnAfterIntersection.kt | 2 +- .../tests/inference/regressions/kt702.kt | 2 +- .../diagnostics/tests/inline/functions.kt | 2 +- .../tests/inline/nullabilityOperations.kt | 2 +- .../duplicateMethod/classGenericsInParams.kt | 2 +- .../classGenericsInParamsBoundMismatch.kt | 2 +- .../classGenericsInParamsIndexMismatch.kt | 4 +- .../classGenericsInParamsNameMismatch.kt | 2 +- .../classGenericsInReturnType.kt | 2 +- ...sVsFunctionGenericsInParamsMismatch.fir.kt | 2 +- ...classVsFunctionGenericsInParamsMismatch.kt | 2 +- .../covariantReturnTypes.fir.kt | 2 +- .../duplicateMethod/covariantReturnTypes.kt | 2 +- .../duplicateMethod/differenceInParamNames.kt | 2 +- .../differentGenericsInParams.kt | 4 +- .../differentNumberOfParams.fir.kt | 2 +- .../differentNumberOfParams.kt | 4 +- .../differentReturnTypes.fir.kt | 4 +- .../duplicateMethod/differentReturnTypes.kt | 4 +- .../functionGenericsInParams.kt | 2 +- .../functionGenericsInParamsBoundsMismatch.kt | 4 +- .../functionGenericsInParamsEqNull.kt | 4 +- .../functionGenericsInParamsNotIs.kt | 2 +- .../functionGenericsInParamsReturnFooT.kt | 4 +- .../functionGenericsInParamsReturnT.kt | 2 +- .../duplicateMethod/noGenericsInParams.kt | 2 +- .../multimodule/duplicateMethod/noParams.kt | 2 +- .../duplicateMethod/sameGenericsInParams.kt | 2 +- .../duplicateMethod/simpleWithInheritance.kt | 2 +- .../substitutedGenericInParams.kt | 2 +- .../ReceiverNullability.kt | 6 +-- .../definitelyNotNullWithNullableBound.kt | 4 +- ...afeCallOnTypeWithNullableUpperBound.fir.kt | 4 +- .../safeCallOnTypeWithNullableUpperBound.kt | 4 +- .../nullableTypes/safeCallOperators.fir.kt | 54 +++++++++---------- .../tests/nullableTypes/safeCallOperators.kt | 54 +++++++++---------- .../noInheritanceReturnType.kt | 4 +- .../notNullTypeParameter/onTypeProjection.kt | 4 +- ...notNullTypeMarkedWithNullableAnnotation.kt | 2 +- .../nullabilityWarnings/safeCall.kt | 8 +-- .../tests/regressions/Jet72.fir.kt | 2 +- .../diagnostics/tests/regressions/Jet72.kt | 4 +- .../regressions/SpecififcityByReceiver.fir.kt | 2 +- .../regressions/SpecififcityByReceiver.kt | 2 +- .../tests/regressions/kt701.fir.kt | 2 +- .../diagnostics/tests/regressions/kt701.kt | 2 +- .../tests/resolve/invoke/kt30695_2.fir.kt | 2 +- .../tests/resolve/invoke/kt30695_2.kt | 2 +- .../nullableReceiverWithExclExcl.fir.kt | 4 +- .../safecalls/nullableReceiverWithExclExcl.kt | 4 +- .../forEachRemainingNullability.kt | 2 +- .../testsWithStdLib/assert/cast.fir.kt | 2 +- .../testsWithStdLib/assert/cast.kt | 2 +- .../testsWithStdLib/assert/safeCall.fir.kt | 4 +- .../testsWithStdLib/assert/safeCall.kt | 4 +- .../tests/org/jetbrains/kotlin/TestsError.kt | 2 +- .../operator-call/p-1/pos/2.3.fir.kt | 12 ++--- .../operator-call/p-1/pos/2.3.kt | 12 ++--- .../analysis/smartcasts/pos/2.fir.kt | 22 ++++---- .../contracts/analysis/smartcasts/pos/2.kt | 22 ++++---- .../analysis/smartcasts/pos/3.fir.kt | 10 ++-- .../contracts/analysis/smartcasts/pos/3.kt | 10 ++-- .../diagnostics/notLinked/dfa/neg/2.fir.kt | 4 +- .../diagnostics/notLinked/dfa/pos/30.fir.kt | 6 +-- .../diagnostics/notLinked/dfa/pos/30.kt | 6 +-- .../kotlin/js/backend/ast/jsScopes.kt | 2 +- .../targets/js/nodejs/NodeJsRootExtension.kt | 8 +-- 122 files changed, 323 insertions(+), 283 deletions(-) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt index 9e34d5d39e4..697d9fe6d1f 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt @@ -53,6 +53,7 @@ import org.jetbrains.kotlin.psi.KtPrimaryConstructor import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPropertyAccessor import org.jetbrains.kotlin.psi.KtReturnExpression +import org.jetbrains.kotlin.psi.KtSafeQualifiedExpression import org.jetbrains.kotlin.psi.KtSimpleNameExpression import org.jetbrains.kotlin.psi.KtSuperExpression import org.jetbrains.kotlin.psi.KtTypeAlias @@ -3041,6 +3042,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } + add(FirErrors.SAFE_CALL_WILL_CHANGE_NULLABILITY) { firDiagnostic -> + SafeCallWillChangeNullabilityImpl( + firDiagnostic as FirPsiDiagnostic, + token, + ) + } add(FirErrors.UNEXPECTED_SAFE_CALL) { firDiagnostic -> UnexpectedSafeCallImpl( firDiagnostic as FirPsiDiagnostic, diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt index 95c3763d48a..8628c69c507 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnostics.kt @@ -64,6 +64,7 @@ import org.jetbrains.kotlin.psi.KtPrimaryConstructor import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPropertyAccessor import org.jetbrains.kotlin.psi.KtReturnExpression +import org.jetbrains.kotlin.psi.KtSafeQualifiedExpression import org.jetbrains.kotlin.psi.KtSimpleNameExpression import org.jetbrains.kotlin.psi.KtSuperExpression import org.jetbrains.kotlin.psi.KtTypeAlias @@ -2128,6 +2129,10 @@ sealed class KtFirDiagnostic : KtDiagnosticWithPsi { abstract val receiverType: KtType } + abstract class SafeCallWillChangeNullability : KtFirDiagnostic() { + override val diagnosticClass get() = SafeCallWillChangeNullability::class + } + abstract class UnexpectedSafeCall : KtFirDiagnostic() { override val diagnosticClass get() = UnexpectedSafeCall::class } diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt index 703645cd755..14256f5a4da 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDiagnosticsImpl.kt @@ -65,6 +65,7 @@ import org.jetbrains.kotlin.psi.KtPrimaryConstructor import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPropertyAccessor import org.jetbrains.kotlin.psi.KtReturnExpression +import org.jetbrains.kotlin.psi.KtSafeQualifiedExpression import org.jetbrains.kotlin.psi.KtSimpleNameExpression import org.jetbrains.kotlin.psi.KtSuperExpression import org.jetbrains.kotlin.psi.KtTypeAlias @@ -2562,6 +2563,11 @@ internal class UnnecessarySafeCallImpl( override val token: ValidityToken, ) : KtFirDiagnostic.UnnecessarySafeCall(), KtAbstractFirDiagnostic +internal class SafeCallWillChangeNullabilityImpl( + override val firDiagnostic: FirPsiDiagnostic, + override val token: ValidityToken, +) : KtFirDiagnostic.SafeCallWillChangeNullability(), KtAbstractFirDiagnostic + internal class UnexpectedSafeCallImpl( override val firDiagnostic: FirPsiDiagnostic, override val token: ValidityToken, diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda.kt index 234bcba4c74..a9bf5611d0e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda.kt @@ -16,7 +16,7 @@ fun test(ordinal: Int) { buildString { insert(KDocTemplate()) { definition { - ordinal?.let {} + ordinal?.let {} } } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt index 148f8af2c9b..620472c2308 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt @@ -69,8 +69,8 @@ fun test_6(d1: D) { } fun test_7(d1: D, d2: D) { - val a = d1?.any - val b = d2?.any + val a = d1?.any + val b = d2?.any a as A a.foo() // should be OK b as B diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index 95f06d573ed..1035ef1096a 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -1084,6 +1084,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { val UNNECESSARY_SAFE_CALL by warning(PositioningStrategy.SAFE_ACCESS) { parameter("receiverType") } + val SAFE_CALL_WILL_CHANGE_NULLABILITY by warning() val UNEXPECTED_SAFE_CALL by error(PositioningStrategy.SAFE_ACCESS) val UNNECESSARY_NOT_NULL_ASSERTION by warning(PositioningStrategy.OPERATOR) { parameter("receiverType") diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 450f419e2b2..4a60f5871cd 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -77,6 +77,7 @@ import org.jetbrains.kotlin.psi.KtPrimaryConstructor import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPropertyAccessor import org.jetbrains.kotlin.psi.KtReturnExpression +import org.jetbrains.kotlin.psi.KtSafeQualifiedExpression import org.jetbrains.kotlin.psi.KtSimpleNameExpression import org.jetbrains.kotlin.psi.KtSuperExpression import org.jetbrains.kotlin.psi.KtTypeAlias @@ -577,6 +578,7 @@ object FirErrors { val UNSAFE_OPERATOR_CALL by error3(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED) val ITERATOR_ON_NULLABLE by error0() val UNNECESSARY_SAFE_CALL by warning1(SourceElementPositioningStrategies.SAFE_ACCESS) + val SAFE_CALL_WILL_CHANGE_NULLABILITY by warning0() val UNEXPECTED_SAFE_CALL by error0(SourceElementPositioningStrategies.SAFE_ACCESS) val UNNECESSARY_NOT_NULL_ASSERTION by warning1(SourceElementPositioningStrategies.OPERATOR) val NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION by warning0(SourceElementPositioningStrategies.OPERATOR) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUnnecessarySafeCallChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUnnecessarySafeCallChecker.kt index 501fbececeb..6dc8acbdc12 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUnnecessarySafeCallChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUnnecessarySafeCallChecker.kt @@ -6,11 +6,13 @@ package org.jetbrains.kotlin.fir.analysis.checkers.expression import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression +import org.jetbrains.kotlin.fir.languageVersionSettings import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.types.canBeNull import org.jetbrains.kotlin.fir.types.coneType @@ -25,6 +27,9 @@ object FirUnnecessarySafeCallChecker : FirSafeCallExpressionChecker() { } if (!receiverType.canBeNull) { reporter.reportOn(expression.source, FirErrors.UNNECESSARY_SAFE_CALL, receiverType, context) + if (!context.session.languageVersionSettings.supportsFeature(LanguageFeature.SafeCallsAreAlwaysNullable)) { + reporter.reportOn(expression.source, FirErrors.SAFE_CALL_WILL_CHANGE_NULLABILITY, context) + } } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 7d028877d75..a51ba67d973 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -1007,6 +1007,7 @@ public interface Errors { DiagnosticFactory3 UNSAFE_INFIX_CALL = DiagnosticFactory3.create(ERROR); DiagnosticFactory3 UNSAFE_OPERATOR_CALL = DiagnosticFactory3.create(ERROR); DiagnosticFactory1 UNNECESSARY_SAFE_CALL = DiagnosticFactory1.create(WARNING); + DiagnosticFactory0 SAFE_CALL_WILL_CHANGE_NULLABILITY = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 UNEXPECTED_SAFE_CALL = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 UNNECESSARY_NOT_NULL_ASSERTION = DiagnosticFactory1.create(WARNING); DiagnosticFactory0 NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION = DiagnosticFactory0.create(WARNING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 1eba7217dbf..12fbc60b212 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -718,6 +718,7 @@ public class DefaultErrorMessages { MAP.put(EXCEPTION_FROM_ANALYZER, "Internal Error occurred while analyzing this expression:\n{0}", THROWABLE); MAP.put(MISSING_STDLIB, "{0}. Ensure you have the standard Kotlin library in dependencies", STRING); MAP.put(UNNECESSARY_SAFE_CALL, "Unnecessary safe call on a non-null receiver of type {0}. This expression will have nullable type in future releases", RENDER_TYPE); + MAP.put(SAFE_CALL_WILL_CHANGE_NULLABILITY, "Safe call on a non-null receiver will have nullable type in future releases"); MAP.put(UNEXPECTED_SAFE_CALL, "Safe-call is not allowed here"); MAP.put(UNNECESSARY_NOT_NULL_ASSERTION, "Unnecessary non-null assertion (!!) on a non-null receiver of type {0}", RENDER_TYPE); MAP.put(NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION, "Non-null assertion (!!) is called on a lambda expression"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.kt index 9582c1bf869..cbac4d5c8c9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionResolver.kt @@ -366,7 +366,14 @@ class CallExpressionResolver( ) } if (!receiverCanBeNull) { - reportUnnecessarySafeCall(context.trace, receiver.type, callOperationNode, receiver) + reportUnnecessarySafeCall( + context.trace, + receiver.type, + element.qualified, + callOperationNode, + receiver, + context.languageVersionSettings + ) } } @@ -530,13 +537,18 @@ class CallExpressionResolver( fun reportUnnecessarySafeCall( trace: BindingTrace, type: KotlinType, + callElement: KtQualifiedExpression, callOperationNode: ASTNode, - explicitReceiver: Receiver? + explicitReceiver: Receiver?, + languageVersionSettings: LanguageVersionSettings ) { if (explicitReceiver is ExpressionReceiver && explicitReceiver.expression is KtSuperExpression) { trace.report(UNEXPECTED_SAFE_CALL.on(callOperationNode.psi)) } else if (!type.isError) { trace.report(UNNECESSARY_SAFE_CALL.on(callOperationNode.psi, type)) + if (!languageVersionSettings.supportsFeature(LanguageFeature.SafeCallsAreAlwaysNullable)) { + trace.report(SAFE_CALL_WILL_CHANGE_NULLABILITY.on(callElement)) + } } } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt index 979dfdc53fa..e6d2c8ba13d 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToType.kt @@ -58,7 +58,7 @@ public class A { // FILE: main.kt fun main(a: A) { a.foo("").length - a.foo(null)?.length + a.foo(null)?.length a.bar("").length a.bar(null)?.length @@ -73,5 +73,5 @@ fun main(a: A) { a.baz3().get(0).length a.baz3()!!.get(0).length - a.baz3()!!.get(0)?.length + a.baz3()!!.get(0)?.length } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt index 34ef4c49f09..83bdadb359b 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/defaultAnnotationAppliedToTypeForCompiledJava.kt @@ -56,7 +56,7 @@ public class A { // FILE: main.kt fun main(a: A) { a.foo("").length - a.foo(null)?.length + a.foo(null)?.length a.bar("").length a.bar(null)?.length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt index 79296525360..e5ae312e28a 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/springNullableWithTypeUse.kt @@ -63,17 +63,17 @@ public class A { // FILE: main.kt fun main(a: A) { - a.foo("", null)?.length + a.foo("", null)?.length a.foo("", null).length a.foo(null, "").length a.bar().length a.bar()!!.length - a.field?.length + a.field?.length a.field.length a.baz().get(0) a.baz()!!.get(0).get(0) - a.baz()!!.get(0)?.get(0) + a.baz()!!.get(0)?.get(0) } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt index c1f2bfbd0d2..e7e1d501079 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.fir.kt @@ -58,10 +58,10 @@ public class A { // FILE: main.kt fun main(a: A) { a.foo("").length - a.foo(null)?.length + a.foo(null)?.length a.bar("").length - a.bar(null)?.length + a.bar(null)?.length a.baz1().get(0).length a.baz1()!!.get(0).length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt index a18cdcbf352..b6b3a116bf9 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jsr305/typeUseVsMethodConflict.kt @@ -58,7 +58,7 @@ public class A { // FILE: main.kt fun main(a: A) { a.foo("").length - a.foo(null)?.length + a.foo(null)?.length a.bar("").length a.bar(null)?.length @@ -73,5 +73,5 @@ fun main(a: A) { a.baz3().get(0).length a.baz3()!!.get(0).length - a.baz3()!!.get(0)?.length + a.baz3()!!.get(0)?.length } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.fir.kt index 26fe5ebf78e..ebfdb842a1c 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.fir.kt @@ -64,7 +64,7 @@ fun safeCalls() { val a = jsr.string?.length val b = jsrNullable?.string?.length - val c = jb.string?.length + val c = jb.string?.length val d = jbNullable?.string?.length val e = platform.string?.length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt index 39c0347a208..529148164be 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/safeCalls.kt @@ -64,7 +64,7 @@ fun safeCalls() { val a = jsr.string?.length val b = jsrNullable?.string?.length - val c = jb.string?.length + val c = jb.string?.length val d = jbNullable?.string?.length val e = platform.string?.length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt index 8333fdb8429..a0cddf033db 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.fir.kt @@ -51,7 +51,7 @@ fun main(a: A) { a.field.length a.field = null - a.nonNullField?.length + a.nonNullField?.length a.nonNullField.length a.nonNullField = null } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt index 07d898d2dde..96c0b1b8c23 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/nullabilityWarnings/typeQualifierDefault/fieldsAreNullable.kt @@ -51,7 +51,7 @@ fun main(a: A) { a.field.length a.field = null - a.nonNullField?.length + a.nonNullField?.length a.nonNullField.length a.nonNullField = null } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt index 6d0ac159677..3e86cb6bd3a 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/fieldsAreNullable.kt @@ -52,7 +52,7 @@ fun main(a: A) { a.field.length a.field = null - a.nonNullField?.length + a.nonNullField?.length a.nonNullField.length a.nonNullField = null } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt index 7b204e879a0..c86d7811220 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/forceFlexibility.kt @@ -97,7 +97,7 @@ public class A { // FILE: main.kt fun main(a: A) { - a.foo("", null)?.length + a.foo("", null)?.length a.foo("", null).length a.foo(null, "").length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt index ccfbbf3eacc..161417b87a5 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/nullabilityFromOverridden.kt @@ -147,7 +147,7 @@ fun main(a: A, b: B, c: C) { c.foo2(null).length c.foo3(null).length c.bar1(null).length - c.bar1(null)?.length + c.bar1(null)?.length c.bar2(null).length c.baz(null).length } diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt index 998104a3ef7..a463c62d578 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/overridingDefaultQualifier.kt @@ -127,7 +127,7 @@ public class A { // FILE: main.kt fun main(a: A, b: A.B, c: A.C) { - a.foo("", null)?.length + a.foo("", null)?.length a.foo("", null).length a.foo(null, "").length @@ -137,7 +137,7 @@ fun main(a: A, b: A.B, c: A.C) { a.bar().length a.bar()!!.length - a.field?.length + a.field?.length a.field.length a.baz().get(0) @@ -150,7 +150,7 @@ fun main(a: A, b: A.B, c: A.C) { b.foo(null, "").length b.foobar(null, "").length - b.foobar("", null)?.length + b.foobar("", null)?.length b.bar().length b.bar()!!.length @@ -163,7 +163,7 @@ fun main(a: A, b: A.B, c: A.C) { b.baz()!!.get(0)?.get(0) // c - c.foo("", null)?.length + c.foo("", null)?.length c.foo("", null).length c.foo(null, "").length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt index e9929448649..240a53aa0e9 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullable.kt @@ -64,7 +64,7 @@ public class A { // FILE: main.kt fun main(a: A) { - a.foo("", null)?.length + a.foo("", null)?.length a.foo("", null).length a.foo(null, "").length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt index 03d43aad519..b105523e154 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/jsr305/typeQualifierDefault/springNullablePackage.kt @@ -70,7 +70,7 @@ public class A { // FILE: main.kt fun main(a: test.A) { - a.foo("", null)?.length + a.foo("", null)?.length a.foo("", null).length a.foo(null, "").length diff --git a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt index 43be1c1b000..283f73f83f2 100644 --- a/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt +++ b/compiler/testData/diagnostics/foreignAnnotationsTests/tests/lombokSimple.kt @@ -15,6 +15,6 @@ public class A { // FILE: main.kt fun main(a: A) { a.foo("").length - a.foo("")?.length - a.foo(null)?.length + a.foo("")?.length + a.foo(null)?.length } diff --git a/compiler/testData/diagnostics/tests/ExtensionCallInvoke.fir.kt b/compiler/testData/diagnostics/tests/ExtensionCallInvoke.fir.kt index 01e89d765f6..45362d60550 100644 --- a/compiler/testData/diagnostics/tests/ExtensionCallInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/ExtensionCallInvoke.fir.kt @@ -1,6 +1,6 @@ fun bar(doIt: Int.() -> Int) { 1.doIt() - 1?.doIt() + 1?.doIt() val i: Int? = 1 i.doIt() i?.doIt() diff --git a/compiler/testData/diagnostics/tests/ExtensionCallInvoke.kt b/compiler/testData/diagnostics/tests/ExtensionCallInvoke.kt index 857cc14579d..319c944ec43 100644 --- a/compiler/testData/diagnostics/tests/ExtensionCallInvoke.kt +++ b/compiler/testData/diagnostics/tests/ExtensionCallInvoke.kt @@ -1,6 +1,6 @@ fun bar(doIt: Int.() -> Int) { 1.doIt() - 1?.doIt() + 1?.doIt() val i: Int? = 1 i.doIt() i?.doIt() diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt index 353483534e4..f4770d6dbd7 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt @@ -82,6 +82,6 @@ fun test() { val i : Int? = null i.(fun Int.() = 1)(); {}() - 1?.(fun Int.() = 1)() + 1?.(fun Int.() = 1)() 1.{}() } diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt index 03c630f7405..e7b41586489 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt @@ -82,6 +82,6 @@ fun test() { val i : Int? = null i.(fun Int.() = 1)(); {}() - 1?.(fun Int.() = 1)() + 1?.(fun Int.() = 1)() 1.{}() } diff --git a/compiler/testData/diagnostics/tests/SafeCallInvoke.fir.kt b/compiler/testData/diagnostics/tests/SafeCallInvoke.fir.kt index 6c2e3c5ee59..9f56be3b417 100644 --- a/compiler/testData/diagnostics/tests/SafeCallInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/SafeCallInvoke.fir.kt @@ -18,6 +18,6 @@ fun foo() { // these both also ok (with smart cast / unnecessary safe call) if (rule != null) { rule.apply() - rule?.apply() + rule?.apply() } } diff --git a/compiler/testData/diagnostics/tests/SafeCallInvoke.kt b/compiler/testData/diagnostics/tests/SafeCallInvoke.kt index e374ecbdf72..ecdbe7290ff 100644 --- a/compiler/testData/diagnostics/tests/SafeCallInvoke.kt +++ b/compiler/testData/diagnostics/tests/SafeCallInvoke.kt @@ -18,6 +18,6 @@ fun foo() { // these both also ok (with smart cast / unnecessary safe call) if (rule != null) { rule.apply() - rule?.apply() + rule?.apply() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt index 90846bf25e2..fa7ef57037a 100644 --- a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt +++ b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver.kt @@ -4,5 +4,5 @@ fun ff() { val i: Int = 1 - val a: Int = i?.plus(2) + val a: Int = i?.plus(2) } diff --git a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver2.kt b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver2.kt index 175c3f3fb71..d012fb45b56 100644 --- a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver2.kt +++ b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiver2.kt @@ -3,5 +3,5 @@ fun ff() { val i: Int = 1 - val a: Int? = i?.plus(2) + val a: Int? = i?.plus(2) } diff --git a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.fir.kt b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.fir.kt index 095029e7c7b..117a93ca8fc 100644 --- a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.fir.kt +++ b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.fir.kt @@ -2,5 +2,5 @@ fun Int.gg() = null fun ff() { val a: Int = 1 - val b: Int = a?.gg() + val b: Int = a?.gg() } diff --git a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt index fe6d5efeeed..41fbbbc7d68 100644 --- a/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt +++ b/compiler/testData/diagnostics/tests/SafeCallNonNullReceiverReturnNull.kt @@ -2,5 +2,5 @@ fun Int.gg() = null fun ff() { val a: Int = 1 - val b: Int = a?.gg() + val b: Int = a?.gg() } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.fir.kt index a2290e8bfea..9c57d7dffa8 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.fir.kt @@ -5,7 +5,7 @@ fun test11() { fun test12() { fun Any.bar(i: Int) {} - todo()?.bar(1) + todo()?.bar(1) } fun todo(): Nothing = throw Exception() diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.kt index cf63b3e8dc3..a46be5c0f7a 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCallInReceiver.kt @@ -5,7 +5,7 @@ fun test11() { fun test12() { fun Any.bar(i: Int) {} - todo()?.bar(1) + todo()?.bar(1) } -fun todo(): Nothing = throw Exception() \ No newline at end of file +fun todo(): Nothing = throw Exception() diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.fir.kt index 6586a5d0d3e..3407594a327 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.fir.kt @@ -8,6 +8,6 @@ fun foo(): String { } fun bar(): String { val x = fn() ?: return "" - val y = x?.let { throw Exception() } ?: "unreachable" + val y = x?.let { throw Exception() } ?: "unreachable" return y } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.kt index 448f175f9b4..c3c30cd26f8 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/throwInLambda.kt @@ -8,6 +8,6 @@ fun foo(): String { } fun bar(): String { val x = fn() ?: return "" - val y = x?.let { throw Exception() } ?: "unreachable" + val y = x?.let { throw Exception() } ?: "unreachable" return y -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt index a9b5aef4c75..80b6904629f 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt @@ -9,7 +9,7 @@ fun T.foo(x : E, y : A) : T { y plus 1 y + 1.0 - this?.minus(this) + this?.minus(this) return this } @@ -69,7 +69,7 @@ import outer.* command?.equals1(null) val c = Command() - c?.equals2(null) + c?.equals2(null) if (command == null) 1 } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index 507b6089e85..f77c4e784fa 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -9,7 +9,7 @@ fun T.foo(x : E, y : A) : T { y plus 1 y + 1.0 - this?.minus(this) + this?.minus(this) return this } @@ -69,7 +69,7 @@ import outer.* command?.equals1(null) val c = Command() - c?.equals2(null) + c?.equals2(null) if (command == null) 1 } diff --git a/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt b/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt index fbf95708cd5..eb05f9fbb21 100644 --- a/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/kt9985.fir.kt @@ -27,15 +27,15 @@ fun foo(l: A?) { foo(l?.bar()) checkType { _() } foo(l?.gav()) checkType { _() } if (l != null) { - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } + foo(l?.bar()) checkType { _() } + foo(l?.gav()) checkType { _() } } } fun fooNotNull(l: A) { // No errors should be here - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } + foo(l?.bar()) checkType { _() } + foo(l?.gav()) checkType { _() } } fun bar() { diff --git a/compiler/testData/diagnostics/tests/generics/kt9985.kt b/compiler/testData/diagnostics/tests/generics/kt9985.kt index 73f71d9693d..340c611e5cc 100644 --- a/compiler/testData/diagnostics/tests/generics/kt9985.kt +++ b/compiler/testData/diagnostics/tests/generics/kt9985.kt @@ -27,15 +27,15 @@ fun foo(l: A?) { foo(l?.bar()) checkType { _() } foo(l?.gav()) checkType { _() } if (l != null) { - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } + foo(l?.bar()) checkType { _() } + foo(l?.gav()) checkType { _() } } } fun fooNotNull(l: A) { // No errors should be here - foo(l?.bar()) checkType { _() } - foo(l?.gav()) checkType { _() } + foo(l?.bar()) checkType { _() } + foo(l?.gav()) checkType { _() } } fun bar() { diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt index 8416ac4ba83..6fb0d498dc2 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt @@ -12,7 +12,7 @@ fun foo(x: T) { if (x != null) {} x.length - x?.length + x?.length x.bar1() x.bar2() @@ -20,14 +20,14 @@ fun foo(x: T) { x.bar4() - x?.bar1() + x?.bar1() } x.length if (x is String) { x.length - x?.length + x?.length x.bar1() x.bar2() @@ -36,7 +36,7 @@ fun foo(x: T) { if (x is CharSequence) { x.length - x?.length + x?.length x.bar1() x.bar2() diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt index 341ff82d766..8acb23906f1 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.kt @@ -12,7 +12,7 @@ fun foo(x: T) { if (x != null) {} x.length - x?.length + x?.length x.bar1() x.bar2() @@ -20,14 +20,14 @@ fun foo(x: T) { x.bar4() - x?.bar1() + x?.bar1() } x.length if (x is String) { x.length - x?.length + x?.length x.bar1() x.bar2() @@ -36,7 +36,7 @@ fun foo(x: T) { if (x is CharSequence) { x.length - x?.length + x?.length x.bar1() x.bar2() diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt index 991c8abe51c..e41ab6b3863 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt @@ -11,7 +11,7 @@ fun T.foo() { if (this != null) {} length - this?.length + this?.length bar1() bar2() @@ -19,14 +19,14 @@ fun T.foo() { bar4() - this?.bar1() + this?.bar1() } length if (this is String) { length - this?.length + this?.length bar1() bar2() diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt index 7c1ee10f311..6e26a2a2d3e 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.kt @@ -11,7 +11,7 @@ fun T.foo() { if (this != null) {} length - this?.length + this?.length bar1() bar2() @@ -19,14 +19,14 @@ fun T.foo() { bar4() - this?.bar1() + this?.bar1() } length if (this is String) { length - this?.length + this?.length bar1() bar2() diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt index 70b35774059..1ae3ce93f7b 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt @@ -57,13 +57,13 @@ fun test() { if (get() === null) {} if (x != null) { - x?.hashCode() - x?.equals(1) + x?.hashCode() + x?.equals(1) x.equals("") x.hashCode() x.toString() x.test() - x?.test2() + x?.test2() x.test2() } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt index 08bca01a0e2..b5320bbdfc9 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt @@ -25,36 +25,36 @@ fun build4(x: R2, @BuilderInference block: TestInterface.() -> fun test(a: String?) { val ret1 = build { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret2 = build2 { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret3 = build3 { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret4 = build4(1) { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt index 1dfac448361..6b7aa44bb41 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt @@ -34,27 +34,27 @@ fun test(a: String?) { } val ret2 = build2 { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret3 = build3 { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret4 = build4(1) { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" diff --git a/compiler/testData/diagnostics/tests/inference/findViewById.fir.kt b/compiler/testData/diagnostics/tests/inference/findViewById.fir.kt index 79e20e83328..719357b9e42 100644 --- a/compiler/testData/diagnostics/tests/inference/findViewById.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/findViewById.fir.kt @@ -54,5 +54,5 @@ fun test2(t: Test?) { val xSafeCallSafeCastExplicitType = t?.findViewById(0) as? X val xSafeCallCast = t?.findViewById(0) as X - val xSafeCallCastExplicitType = t?.findViewById(0) as X + val xSafeCallCastExplicitType = t?.findViewById(0) as X } diff --git a/compiler/testData/diagnostics/tests/inference/findViewById.kt b/compiler/testData/diagnostics/tests/inference/findViewById.kt index 3ab2d546c51..10029825be3 100644 --- a/compiler/testData/diagnostics/tests/inference/findViewById.kt +++ b/compiler/testData/diagnostics/tests/inference/findViewById.kt @@ -54,5 +54,5 @@ fun test2(t: Test?) { val xSafeCallSafeCastExplicitType = t?.findViewById(0) as? X val xSafeCallCast = t?.findViewById(0) as X - val xSafeCallCastExplicitType = t?.findViewById(0) as X + val xSafeCallCastExplicitType = t?.findViewById(0) as X } diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/makeNullableIfSafeCall.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/makeNullableIfSafeCall.kt index 7a1dbc363b6..a6fbc013fc0 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/makeNullableIfSafeCall.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/makeNullableIfSafeCall.kt @@ -12,7 +12,7 @@ interface B { fun test(u: A?, x: A?, y: A?, z: A?, w: A, v: A?) { u?.b?.foo()!! // was UNNECESSARY_SAFE_CALL everywhere, because result type (of 'foo()') wasn't made nullable - u!!.b?.foo()!! + u!!.b?.foo()!! x?.b!!.foo()!! // x?.b is not null x!!.b!!.foo()!! @@ -23,7 +23,7 @@ fun test(u: A?, x: A?, y: A?, z: A?, w: A, v: A?) { // z?.nb is not null z!!.nb!!.foo()!! - w.b?.foo()!! + w.b?.foo()!! w.b!!.foo()!! w.nb?.foo()!! w.nb!!.foo()!! @@ -39,4 +39,4 @@ fun doInt(i: Int) = i fun test(a: A?) { doInt(a?.b.bar()!!) doInt(a?.b.baz()!!) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt index 46e590ac2eb..ce2fac3f379 100644 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt +++ b/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt @@ -18,5 +18,5 @@ fun smartCastAfterIntersection(a: One, b: Two) = run { } fun test(one: One, two: Two) { - smartCastAfterIntersection(one, two)?.base() + smartCastAfterIntersection(one, two)?.base() } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt index f6fc14ee964..da2543b7ff9 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt @@ -10,7 +10,7 @@ public class Throwables() { public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?) : Unit { if (((throwable != null) && declaredType?.isInstance(throwable)!!)) { - throw declaredType?.cast(throwable)!! + throw declaredType?.cast(throwable)!! } } public fun propagateIfPossible(throwable : Throwable?) : Unit { diff --git a/compiler/testData/diagnostics/tests/inline/functions.kt b/compiler/testData/diagnostics/tests/inline/functions.kt index 4e43b56c209..5d0794d701d 100644 --- a/compiler/testData/diagnostics/tests/inline/functions.kt +++ b/compiler/testData/diagnostics/tests/inline/functions.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNNECESSARY_NOT_NULL_ASSERTION -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNNECESSARY_NOT_NULL_ASSERTION -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY fun getFun(s: (p: Int) -> Unit): Function1 = {11} diff --git a/compiler/testData/diagnostics/tests/inline/nullabilityOperations.kt b/compiler/testData/diagnostics/tests/inline/nullabilityOperations.kt index 8bccc8aafcb..3cbe0792d88 100644 --- a/compiler/testData/diagnostics/tests/inline/nullabilityOperations.kt +++ b/compiler/testData/diagnostics/tests/inline/nullabilityOperations.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNNECESSARY_SAFE_CALL -UNNECESSARY_NOT_NULL_ASSERTION -CONFLICTING_JVM_DECLARATIONS +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNNECESSARY_SAFE_CALL -UNNECESSARY_NOT_NULL_ASSERTION -CONFLICTING_JVM_DECLARATIONS -SAFE_CALL_WILL_CHANGE_NULLABILITY inline fun String.submit(action: Function1) { } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParams.kt index b835d033472..cdf6b907694 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParams.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsBoundMismatch.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsBoundMismatch.kt index f6b4f38f101..aa7234a85ba 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsBoundMismatch.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsBoundMismatch.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsIndexMismatch.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsIndexMismatch.kt index b8d15210917..592252b04c7 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsIndexMismatch.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsIndexMismatch.kt @@ -30,6 +30,6 @@ import p.* fun test(b: B?) { if (b is C) { - b?.foo(null) + b?.foo(null) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsNameMismatch.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsNameMismatch.kt index ec29bbe746a..0e348cbdd1a 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsNameMismatch.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInParamsNameMismatch.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInReturnType.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInReturnType.kt index dc6aeb13967..323be2e32a5 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInReturnType.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classGenericsInReturnType.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.fir.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.fir.kt index 702ed9cbb7f..fa2c74ea755 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.fir.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.fir.kt @@ -31,6 +31,6 @@ fun test(b: B?, c: C) { b?.foo(1, 1) c.foo(1, 1) if (b is C) { - b?.foo(1, 1) + b?.foo(1, 1) } } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.kt index 14586906ce5..dd69dfa6814 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/classVsFunctionGenericsInParamsMismatch.kt @@ -31,6 +31,6 @@ fun test(b: B?, c: C) { b?.foo(1, 1) c.foo(1, 1) if (b is C) { - b?.foo(1, 1) + b?.foo(1, 1) } } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.fir.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.fir.kt index c3df30c4c78..4c0449c2d4d 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.fir.kt @@ -31,6 +31,6 @@ import p.* fun test(b: B?) { if (b is C) { - b?.getParent() + b?.getParent() } } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.kt index f51728c8124..6c905366840 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/covariantReturnTypes.kt @@ -31,6 +31,6 @@ import p.* fun test(b: B?) { if (b is C) { - b?.getParent() + b?.getParent() } } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differenceInParamNames.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differenceInParamNames.kt index 7b31875b1cb..a8345288082 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differenceInParamNames.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differenceInParamNames.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentGenericsInParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentGenericsInParams.kt index 3dcea53736a..ad6a9c31d5c 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentGenericsInParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentGenericsInParams.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m0 // FILE: a.kt @@ -41,4 +41,4 @@ fun test(b: B?) { if (b is C) { b?.foo(null, null) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.fir.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.fir.kt index 3c5cd34f0cf..45d56d782ef 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.fir.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.fir.kt @@ -29,6 +29,6 @@ import p.* fun test(b: B?) { if (b is C) { - b?.foo(1, "") + b?.foo(1, "") } } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.kt index 630250fd3bb..ae67c6eaf74 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentNumberOfParams.kt @@ -29,6 +29,6 @@ import p.* fun test(b: B?) { if (b is C) { - b?.foo(1, "") + b?.foo(1, "") } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.fir.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.fir.kt index d332b7a100f..115ee594597 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.fir.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt @@ -33,4 +33,4 @@ fun test(b: B?) { if (b is C) { b?.getParent() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.kt index c5a2ae6e589..68ec2838649 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/differentReturnTypes.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt @@ -33,4 +33,4 @@ fun test(b: B?) { if (b is C) { b?.getParent() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParams.kt index a26d6dd86e2..ea761cd7086 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParams.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsBoundsMismatch.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsBoundsMismatch.kt index 269b4a88787..ad2c2879984 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsBoundsMismatch.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsBoundsMismatch.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt @@ -38,4 +38,4 @@ fun test(b: B?) { // as opposed to diagnostics for a single unmatched candidate b?.foo() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsEqNull.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsEqNull.kt index e6487a26828..b1196b70a41 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsEqNull.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsEqNull.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt @@ -50,4 +50,4 @@ fun test3(b: B?) { if (b != null) { b?.foo("") } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsNotIs.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsNotIs.kt index 18496bd3b2a..539c774349e 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsNotIs.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsNotIs.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnFooT.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnFooT.kt index c98e0671399..e51cc4c9140 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnFooT.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnFooT.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt @@ -42,4 +42,4 @@ fun test(b: B?) { fun test1(b: B?) { if (b !is C) return b?.foo("") -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnT.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnT.kt index 89c796919a7..12337522b91 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnT.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsReturnT.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noGenericsInParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noGenericsInParams.kt index 649dd5cd34c..9461bf7939a 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noGenericsInParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noGenericsInParams.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt package p diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noParams.kt index a73d7c92528..16030797293 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/noParams.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m1 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/sameGenericsInParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/sameGenericsInParams.kt index a442c791360..f67b5b4b4b8 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/sameGenericsInParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/sameGenericsInParams.kt @@ -1,5 +1,5 @@ // FIR_IDENTICAL -// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL +// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL -SAFE_CALL_WILL_CHANGE_NULLABILITY // MODULE: m0 // FILE: a.kt diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/simpleWithInheritance.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/simpleWithInheritance.kt index 6cd0d5b6079..c083e937b05 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/simpleWithInheritance.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/simpleWithInheritance.kt @@ -34,6 +34,6 @@ import p.* fun test(b: B?) { if (b is C && b is D) { - b?.getParent() + b?.getParent() } } diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/substitutedGenericInParams.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/substitutedGenericInParams.kt index d022450957c..6c0892cf9ec 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/substitutedGenericInParams.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/substitutedGenericInParams.kt @@ -30,6 +30,6 @@ import p.* fun test(b: B?) { if (b is C) { - b?.foo("") + b?.foo("") } } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.kt index a28dba0f939..83e3b89f2e4 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.kt @@ -25,9 +25,9 @@ fun A.test2() { this.bar() this.buzz() - this?.foo() // warning - this?.bar() // warning - this?.buzz() // warning + this?.foo() // warning + this?.bar() // warning + this?.buzz() // warning } fun A?.test3() { diff --git a/compiler/testData/diagnostics/tests/nullableTypes/definitelyNotNullWithNullableBound.kt b/compiler/testData/diagnostics/tests/nullableTypes/definitelyNotNullWithNullableBound.kt index 4509c2417cd..1ebe64dac54 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/definitelyNotNullWithNullableBound.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/definitelyNotNullWithNullableBound.kt @@ -9,10 +9,10 @@ fun test(arg: N) { makeDefinitelyNotNull(arg)!! - makeDefinitelyNotNull(arg)?.toInt() + makeDefinitelyNotNull(arg)?.toInt() val nullImposible = when (val dnn = makeDefinitelyNotNull(arg)) { null -> false else -> true } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.fir.kt b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.fir.kt index 848be3e88cc..c00cca26b54 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.fir.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.fir.kt @@ -1,13 +1,13 @@ fun test(t: T): String? { if (t != null) { - return t?.toString() + return t?.toString() } return t?.toString() } fun T.testThis(): String? { if (this != null) { - return this?.toString() + return this?.toString() } return this?.toString() } diff --git a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.kt b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.kt index 98814c13ba0..5f0e3ae7661 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOnTypeWithNullableUpperBound.kt @@ -1,13 +1,13 @@ fun test(t: T): String? { if (t != null) { - return t?.toString() + return t?.toString() } return t?.toString() } fun T.testThis(): String? { if (this != null) { - return this?.toString() + return this?.toString() } return this?.toString() } diff --git a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.fir.kt b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.fir.kt index edc29b3f97b..083caedbf96 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.fir.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.fir.kt @@ -52,40 +52,40 @@ fun foo(a: A?) { a?.w.inc() if (a != null) { - a?.l += 1 - a?.l[0] - a?.l[0]++ - a?.l[0] = 1 + a?.l += 1 + a?.l[0] + a?.l[0]++ + a?.l[0] = 1 - a?.ll[0][0] - a?.ll[0][0]++ - a?.ll[0][0] = 1 + a?.ll[0][0] + a?.ll[0][0]++ + a?.ll[0][0] = 1 // No warning is reported because // 1. All kinds of green code with safe+call + invoke we identified fails with CCE if `a != null`, anyway // 2. In case of null value, the behavior is intended (no call performed) - a?.q() - a?.w++ + a?.q() + a?.w++ - (a?.l) += 1 - (a?.l)[0] - (a?.l)[0]++ - (a?.l)[0] = 1 + (a?.l) += 1 + (a?.l)[0] + (a?.l)[0]++ + (a?.l)[0] = 1 - (a?.ll)[0][0] - (a?.ll)[0][0]++ - (a?.ll)[0][0] = 1 - (a?.q)() - (a?.w)++ + (a?.ll)[0][0] + (a?.ll)[0][0]++ + (a?.ll)[0][0] = 1 + (a?.q)() + (a?.w)++ - a?.l.plusAssign(1) - a?.l.get(0) - a?.l.get(0).inc() - a?.l.set(0, 1) + a?.l.plusAssign(1) + a?.l.get(0) + a?.l.get(0).inc() + a?.l.set(0, 1) - a?.ll.get(0).get(0) - a?.ll.get(0).get(0).inc() - a?.ll.get(0).set(0, 1) - a?.q.invoke() - a?.w.inc() + a?.ll.get(0).get(0) + a?.ll.get(0).get(0).inc() + a?.ll.get(0).set(0, 1) + a?.q.invoke() + a?.w.inc() } } diff --git a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.kt b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.kt index 2de57b312cc..15d32a9e2c5 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/safeCallOperators.kt @@ -52,40 +52,40 @@ fun foo(a: A?) { a?.w.inc() if (a != null) { - a?.l += 1 - a?.l[0] - a?.l[0]++ - a?.l[0] = 1 + a?.l += 1 + a?.l[0] + a?.l[0]++ + a?.l[0] = 1 - a?.ll[0][0] - a?.ll[0][0]++ - a?.ll[0][0] = 1 + a?.ll[0][0] + a?.ll[0][0]++ + a?.ll[0][0] = 1 // No warning is reported because // 1. All kinds of green code with safe+call + invoke we identified fails with CCE if `a != null`, anyway // 2. In case of null value, the behavior is intended (no call performed) - a?.q() - a?.w++ + a?.q() + a?.w++ - (a?.l) += 1 - (a?.l)[0] - (a?.l)[0]++ - (a?.l)[0] = 1 + (a?.l) += 1 + (a?.l)[0] + (a?.l)[0]++ + (a?.l)[0] = 1 - (a?.ll)[0][0] - (a?.ll)[0][0]++ - (a?.ll)[0][0] = 1 - (a?.q)() - (a?.w)++ + (a?.ll)[0][0] + (a?.ll)[0][0]++ + (a?.ll)[0][0] = 1 + (a?.q)() + (a?.w)++ - a?.l.plusAssign(1) - a?.l.get(0) - a?.l.get(0).inc() - a?.l.set(0, 1) + a?.l.plusAssign(1) + a?.l.get(0) + a?.l.get(0).inc() + a?.l.set(0, 1) - a?.ll.get(0).get(0) - a?.ll.get(0).get(0).inc() - a?.ll.get(0).set(0, 1) - a?.q.invoke() - a?.w.inc() + a?.ll.get(0).get(0) + a?.ll.get(0).get(0).inc() + a?.ll.get(0).set(0, 1) + a?.q.invoke() + a?.w.inc() } } diff --git a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/noInheritanceReturnType.kt b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/noInheritanceReturnType.kt index c0654a53dee..4f7c52442b6 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/noInheritanceReturnType.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/noInheritanceReturnType.kt @@ -19,6 +19,6 @@ public class A { // FILE: k.kt fun test() { - A.create().bar()?.length - A().bar()?.length + A.create().bar()?.length + A().bar()?.length } diff --git a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/onTypeProjection.kt b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/onTypeProjection.kt index 88acff1c928..56c9e327429 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/onTypeProjection.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/onTypeProjection.kt @@ -15,6 +15,6 @@ public class A { // FILE: k.kt fun test(a: A) { - a.bar()?.length - a.bar()?.length + a.bar()?.length + a.bar()?.length } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/notNullTypeMarkedWithNullableAnnotation.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/notNullTypeMarkedWithNullableAnnotation.kt index 1151d252d14..85f4af1785b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/notNullTypeMarkedWithNullableAnnotation.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/notNullTypeMarkedWithNullableAnnotation.kt @@ -14,7 +14,7 @@ public class J { fun list(j: J): Any { val a = j.n()!! - a?.get(0) + a?.get(0) if (a == null) {} a!! diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/safeCall.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/safeCall.kt index 33936d30be9..75c39873754 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/safeCall.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/safeCall.kt @@ -25,20 +25,20 @@ fun test() { // platform type with no annotation val platformJ = J.staticJ - platformNN?.foo() + platformNN?.foo() platformN?.foo() platformJ?.foo() if (platformNN != null) { - platformNN?.foo() + platformNN?.foo() } if (platformN != null) { - platformN?.foo() + platformN?.foo() } if (platformJ != null) { - platformJ?.foo() + platformJ?.foo() } } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet72.fir.kt b/compiler/testData/diagnostics/tests/regressions/Jet72.fir.kt index aec263fca6c..bc1521356d2 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet72.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet72.fir.kt @@ -12,7 +12,7 @@ fun test(room : Object) { for(item: Item? in items) { if (item?.room === room) { // item?.room is not null - System.out.println("You see " + item?.name) + System.out.println("You see " + item?.name) } } } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet72.kt b/compiler/testData/diagnostics/tests/regressions/Jet72.kt index 86a39f57ba0..2b84212aa4a 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet72.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet72.kt @@ -12,7 +12,7 @@ fun test(room : Object) { for(item: Item? in items) { if (item?.room === room) { // item?.room is not null - System.out.println("You see " + item?.name) + System.out.println("You see " + item?.name) } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.fir.kt b/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.fir.kt index 4c822ec5d50..5f567c77779 100644 --- a/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.fir.kt @@ -4,6 +4,6 @@ fun main() { val command : Any = 1 - command?.equals(null) + command?.equals(null) command.equals(null) } diff --git a/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt b/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt index d92a28606b5..1a3d9877951 100644 --- a/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt +++ b/compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt @@ -4,6 +4,6 @@ fun main() { val command : Any = 1 - command?.equals(null) + command?.equals(null) command.equals(null) } diff --git a/compiler/testData/diagnostics/tests/regressions/kt701.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt701.fir.kt index 2d0742ccce8..cf0ee60d879 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt701.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt701.fir.kt @@ -6,7 +6,7 @@ public class Throwables() { public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?) { if (((throwable != null) && declaredType?.isInstance(throwable)!!)) { - throw declaredType?.cast(throwable)!! + throw declaredType?.cast(throwable)!! } } public fun propagateIfPossible(throwable : Throwable?) { diff --git a/compiler/testData/diagnostics/tests/regressions/kt701.kt b/compiler/testData/diagnostics/tests/regressions/kt701.kt index 544a64a28b6..7eff04251d7 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt701.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt701.kt @@ -6,7 +6,7 @@ public class Throwables() { public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?) { if (((throwable != null) && declaredType?.isInstance(throwable)!!)) { - throw declaredType?.cast(throwable)!! + throw declaredType?.cast(throwable)!! } } public fun propagateIfPossible(throwable : Throwable?) { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt index 9b4e568670f..8e779cbf925 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt @@ -31,7 +31,7 @@ fun testNullableReceiver(nullable: Cls?) { fun testNotNullableReceiver(notNullable: Cls) { notNullable.nullableExtensionProperty() - notNullable?.extensionProperty() + notNullable?.extensionProperty() } fun testFlexibleReceiver() { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.kt index 5480498728d..22668159eae 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.kt @@ -31,7 +31,7 @@ fun testNullableReceiver(nullable: Cls?) { fun testNotNullableReceiver(notNullable: Cls) { notNullable.nullableExtensionProperty() - notNullable?.extensionProperty() + notNullable?.extensionProperty() } fun testFlexibleReceiver() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.fir.kt index 483d02dedc5..e4b6af8564b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.fir.kt @@ -5,7 +5,7 @@ fun test(foo: Foo?) { // Correct foo.bar?.length // Unnecessary - foo?.bar?.length + foo?.bar?.length } - foo.bar?.length + foo.bar?.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.kt index fda9aa6d476..8a81e2d2076 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithExclExcl.kt @@ -5,7 +5,7 @@ fun test(foo: Foo?) { // Correct foo.bar?.length // Unnecessary - foo?.bar?.length + foo?.bar?.length } foo.bar?.length -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.kt index 1c06c87e3de..5aa5e1180a2 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.kt @@ -36,7 +36,7 @@ fun foo(x: Iterator, y: Iterator) { x.forEachRemaining(null) x.forEachRemaining { it -> it.length } - x.forEachRemaining { it -> it?.length } + x.forEachRemaining { it -> it?.length } y.forEachRemaining { it -> it.length } y.forEachRemaining { it -> it?.length } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/assert/cast.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/assert/cast.fir.kt index bb6ff23f751..c32a0b881a5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/assert/cast.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/assert/cast.fir.kt @@ -16,5 +16,5 @@ fun test1(a: A) { fun test2() { val a: A? = null; assert((a as B).bool()) - a?.bool() + a?.bool() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/assert/cast.kt b/compiler/testData/diagnostics/testsWithStdLib/assert/cast.kt index 6b304dfd080..0bc62f3a3ad 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/assert/cast.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/assert/cast.kt @@ -16,5 +16,5 @@ fun test1(a: A) { fun test2() { val a: A? = null; assert((a as B).bool()) - a?.bool() + a?.bool() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.fir.kt index 909e8e8154d..3f2d6fa53eb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.fir.kt @@ -4,7 +4,7 @@ fun test1(s: String?) { assert(s!!.isEmpty()) - s?.length + s?.length } fun test2(s: String?) { @@ -20,7 +20,7 @@ fun test3(s: String?) { fun test4() { val s: String? = null; assert(s!!.isEmpty()) - s?.length + s?.length } fun test5() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.kt b/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.kt index 11d0efaa78e..69ce0107765 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/assert/safeCall.kt @@ -4,7 +4,7 @@ fun test1(s: String?) { assert(s!!.isEmpty()) - s?.length + s?.length } fun test2(s: String?) { @@ -20,7 +20,7 @@ fun test3(s: String?) { fun test4() { val s: String? = null; assert(s!!.isEmpty()) - s?.length + s?.length } fun test5() { diff --git a/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/TestsError.kt b/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/TestsError.kt index aab3e369c4f..b4041a6f085 100644 --- a/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/TestsError.kt +++ b/compiler/tests-compiler-utils/tests/org/jetbrains/kotlin/TestsError.kt @@ -28,7 +28,7 @@ sealed class TestsError(val original: Throwable, val type: TestsExceptionType) : override val cause: Throwable? get() = original.cause // This function is called in the constructor of Throwable, where original is not yet initialized - override fun fillInStackTrace(): Throwable? = @Suppress("UNNECESSARY_SAFE_CALL") original?.fillInStackTrace() + override fun fillInStackTrace(): Throwable? = @Suppress("UNNECESSARY_SAFE_CALL", "SAFE_CALL_WILL_CHANGE_NULLABILITY") original?.fillInStackTrace() override fun setStackTrace(stackTrace: Array?) { original.stackTrace = stackTrace diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt index 55a95cd8b2b..3eef32d554e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.fir.kt @@ -9,17 +9,17 @@ package testPackCase1 fun case1(a: A, c: C) { - a?.b += c - a?.b .plusAssign(c) + a?.b += c + a?.b .plusAssign(c) val x = { - a?.b += c - a?.b.plusAssign(c) + a?.b += c + a?.b.plusAssign(c) }() - a?.b += { c }() + a?.b += { c }() - a?.b.plusAssign({ c }()) + a?.b.plusAssign({ c }()) } class A(val b: B) diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt index 7219627e8db..714fcd24d08 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.3.kt @@ -20,17 +20,17 @@ package testPackCase1 fun case1(a: A, c: C) { - a?.b += c - a?.b .plusAssign(c) + a?.b += c + a?.b .plusAssign(c) val x = { - a?.b += c - a?.b.plusAssign(c) + a?.b += c + a?.b.plusAssign(c) }() - a?.b += { c }() + a?.b += { c }() - a?.b.plusAssign({ c }()) + a?.b.plusAssign({ c }()) } class A(val b: B) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt index 44103d11882..e59d6aef54c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.fir.kt @@ -27,7 +27,7 @@ fun case_3(value_1: Any?, value_2: Any?) { fun case_4(value_1: Any?, value_2: Number?) { funWithReturns(value_1 is Float? && value_1 != null && value_2 != null) println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } // TESTCASE NUMBER: 5 @@ -38,7 +38,7 @@ class case_5_class { val o = case_5_class() funWithReturns(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null) println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } @@ -107,19 +107,19 @@ fun case_8(value_1: Any?, value_2: Any?) { fun case_9(value_1: Any?, value_2: Number?) { if (funWithReturnsTrue(value_1 is Float? && value_1 != null && value_2 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } if (!funWithReturnsFalse(value_1 is Float? && value_1 != null && value_2 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } if (funWithReturnsNotNull(value_1 is Float? && value_1 != null && value_2 != null) != null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null) == null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } } @@ -131,22 +131,22 @@ class case_10_class { val o = case_10_class() if (funWithReturnsTrue(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (!funWithReturnsFalse(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNotNull(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null) != null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null) == null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } @@ -160,5 +160,5 @@ class case_10_class { fun case_11(value_1: Any?, value_2: Any?, value_3: Any?) { funWithReturnsAndInvertCondition(value_1 !is String || value_2 !is Number || value_3 !is Any?) println(value_1!!.length) - println(value_2?.toByte()) + println(value_2?.toByte()) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt index 3aad83937ca..45a57863aa1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt @@ -36,7 +36,7 @@ fun case_3(value_1: Any?, value_2: Any?) { fun case_4(value_1: Any?, value_2: Number?) { funWithReturns(value_1 is Float? && value_1 != null && value_2 != null) println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } // TESTCASE NUMBER: 5 @@ -47,7 +47,7 @@ class case_5_class { val o = case_5_class() funWithReturns(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null) println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } @@ -116,19 +116,19 @@ fun case_8(value_1: Any?, value_2: Any?) { fun case_9(value_1: Any?, value_2: Number?) { if (funWithReturnsTrue(value_1 is Float? && value_1 != null && value_2 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } if (!funWithReturnsFalse(value_1 is Float? && value_1 != null && value_2 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } if (funWithReturnsNotNull(value_1 is Float? && value_1 != null && value_2 != null) != null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null) == null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) } } @@ -140,22 +140,22 @@ class case_10_class { val o = case_10_class() if (funWithReturnsTrue(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (!funWithReturnsFalse(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNotNull(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null) != null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (funWithReturnsNull(value_1 is Float? && value_1 != null && value_2 != null && o.prop_1 != null && this.prop_1 != null) == null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } @@ -169,5 +169,5 @@ class case_10_class { fun case_11(value_1: Any?, value_2: Any?, value_3: Any?) { funWithReturnsAndInvertCondition(value_1 !is String || value_2 !is Number || value_3 !is Any?) println(value_1!!.length) - println(value_2?.toByte()) + println(value_2?.toByte()) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt index 5a59d937565..f9215372bb8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.fir.kt @@ -103,7 +103,7 @@ class case_3_class { val o = case_3_class() contracts.case_3(value_1, value_2, o.prop_1, this.prop_1) println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } @@ -155,22 +155,22 @@ class case_6_class { val o = case_6_class() if (contracts.case_6_1(value_1, value_2, o.prop_1, this.prop_1)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (!contracts.case_6_2(value_1, value_2, o.prop_1, this.prop_1)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (contracts.case_6_3(value_1, value_2, o.prop_1, this.prop_1) != null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (contracts.case_6_4(value_1, value_2, o.prop_1, this.prop_1) == null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt index 2aee5edaf6f..3088b848d9e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt @@ -111,7 +111,7 @@ class case_3_class { val o = case_3_class() contracts.case_3(value_1, value_2, o.prop_1, this.prop_1) println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } @@ -163,22 +163,22 @@ class case_6_class { val o = case_6_class() if (contracts.case_6_1(value_1, value_2, o.prop_1, this.prop_1)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (!contracts.case_6_2(value_1, value_2, o.prop_1, this.prop_1)) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (contracts.case_6_3(value_1, value_2, o.prop_1, this.prop_1) != null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } if (contracts.case_6_4(value_1, value_2, o.prop_1, this.prop_1) == null) { println(value_1.dec()) - println(value_2?.toByte()) + println(value_2?.toByte()) println(o.prop_1.plus(3)) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt index f0581369fc6..798b7274fd8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt @@ -38,7 +38,7 @@ fun case_4(x: Any) { fun case_5(x: Any?) { if (!(x !is Nothing?)) { x - x?.inv() + x?.inv() } } @@ -70,7 +70,7 @@ fun case_8(x: Any?) { fun case_9(x: Any?) { if (!!(x !is Nothing?)) else { x - x?.inv() + x?.inv() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt index 2af4f1c76a9..959da5ea32b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt @@ -53,7 +53,7 @@ fun case_3(x: Class?) { * ISSUES: KT-30376 */ fun case_4(x: Class?) { - if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { + if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { x x.prop_8 x.prop_8.prop_8 @@ -68,7 +68,7 @@ fun case_4(x: Class?) { * ISSUES: KT-30376 */ fun case_5(x: Class?) { - if (x?.prop_8!!?.prop_8?.prop_8?.prop_8 == null == true) else { + if (x?.prop_8!!?.prop_8?.prop_8?.prop_8 == null == true) else { x x.prop_8 x.prop_8.prop_8 @@ -83,7 +83,7 @@ fun case_5(x: Class?) { * ISSUES: KT-30376 */ fun case_6(x: Class?) { - if (x?.prop_8?.prop_8?.prop_8!!?.prop_8 == null == true) else { + if (x?.prop_8?.prop_8?.prop_8!!?.prop_8 == null == true) else { x x.prop_8 x.prop_8.prop_8 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt index 0d75ed3143f..7edcc52a7a2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt @@ -62,7 +62,7 @@ fun case_3(x: Class?) { * ISSUES: KT-30376 */ fun case_4(x: Class?) { - if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { + if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { x x.prop_8 x.prop_8.prop_8 @@ -77,7 +77,7 @@ fun case_4(x: Class?) { * ISSUES: KT-30376 */ fun case_5(x: Class?) { - if (x?.prop_8!!?.prop_8?.prop_8?.prop_8 == null == true) else { + if (x?.prop_8!!?.prop_8?.prop_8?.prop_8 == null == true) else { x x.prop_8 x.prop_8.prop_8 @@ -92,7 +92,7 @@ fun case_5(x: Class?) { * ISSUES: KT-30376 */ fun case_6(x: Class?) { - if (x?.prop_8?.prop_8?.prop_8!!?.prop_8 == null == true) else { + if (x?.prop_8?.prop_8?.prop_8!!?.prop_8 == null == true) else { x x.prop_8 x.prop_8.prop_8 diff --git a/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/jsScopes.kt b/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/jsScopes.kt index 00bc36ec367..6c0738631cb 100644 --- a/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/jsScopes.kt +++ b/js/js.ast/src/org/jetbrains/kotlin/js/backend/ast/jsScopes.kt @@ -61,7 +61,7 @@ open class JsDeclarationScope(parent: JsScope, description: String, useParentSco * Safe call is necessary, because hasOwnName can be called * in constructor before labelName is initialized (see KT-4394) */ - @Suppress("UNNECESSARY_SAFE_CALL") + @Suppress("UNNECESSARY_SAFE_CALL", "SAFE_CALL_WILL_CHANGE_NULLABILITY") override fun hasOwnName(name: String): Boolean = name in RESERVED_WORDS || name == ident diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt index f9b63b140e3..19fed89a9a2 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt @@ -58,18 +58,18 @@ open class NodeJsRootExtension(@Transient val rootProject: Project) : Configurat val nodeJsSetupTaskProvider: TaskProvider get() = rootProject.tasks.withType(NodeJsSetupTask::class.java).named(NodeJsSetupTask.NAME) - @Suppress("UNNECESSARY_SAFE_CALL") // TODO: investigate this warning; fixing it breaks integration tests. + @Suppress("UNNECESSARY_SAFE_CALL", "SAFE_CALL_WILL_CHANGE_NULLABILITY") // TODO: investigate this warning; fixing it breaks integration tests. val npmInstallTaskProvider: TaskProvider? get() = rootProject?.tasks?.withType(KotlinNpmInstallTask::class.java)?.named(KotlinNpmInstallTask.NAME) val packageJsonUmbrellaTaskProvider: TaskProvider get() = rootProject.tasks.named(PACKAGE_JSON_UMBRELLA_TASK_NAME) - @Suppress("UNNECESSARY_SAFE_CALL") // TODO: investigate this warning; fixing it breaks integration tests. + @Suppress("UNNECESSARY_SAFE_CALL", "SAFE_CALL_WILL_CHANGE_NULLABILITY") // TODO: investigate this warning; fixing it breaks integration tests. val rootPackageJsonTaskProvider: TaskProvider? get() = rootProject?.tasks?.withType(RootPackageJsonTask::class.java)?.named(RootPackageJsonTask.NAME) - @Suppress("UNNECESSARY_SAFE_CALL") // TODO: investigate this warning; fixing it breaks integration tests. + @Suppress("UNNECESSARY_SAFE_CALL", "SAFE_CALL_WILL_CHANGE_NULLABILITY") // TODO: investigate this warning; fixing it breaks integration tests. val npmCachesSetupTaskProvider: TaskProvider? get() = rootProject?.tasks?.withType(KotlinNpmCachesSetup::class.java)?.named(KotlinNpmCachesSetup.NAME) @@ -131,4 +131,4 @@ open class NodeJsRootExtension(@Transient val rootProject: Project) : Configurat companion object { const val EXTENSION_NAME: String = "kotlinNodeJs" } -} \ No newline at end of file +}