diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.kt index a5dc4b78cb6..47f1261ef41 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.kt @@ -15,7 +15,7 @@ fun test_2(x: Int?) { } else { x } - y.inc() + y.inc() } fun test_3(x: Int?) { diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.kt index f91f7422ce1..53d7578055b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.kt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.kt @@ -34,7 +34,7 @@ fun test3(x: AnotherClass?) { fun test4(x: SomeClass?) { val bar = x?.bar if (bar != null) { - x.bar.length + x.bar.length } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt index b861d37433d..191e6c3c1fc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt @@ -26,7 +26,7 @@ fun test_3(a: A?, b: Boolean) { if (b && a!!.foo()) { a.foo() // OK } - a.foo() // Bad + a.foo() // Bad } fun test_4(a: A?, b: Boolean) { @@ -38,9 +38,9 @@ fun test_4(a: A?, b: Boolean) { fun test_5(a: A?, b: Boolean) { if (b || a!!.foo()) { - a.foo() + a.foo() } - a.foo() + a.foo() } fun test_6(x: X) { diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt index 97732d845cd..0633a92d865 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt @@ -8,13 +8,13 @@ fun test_1(b: Boolean?) { if ((b == true) == true) { b.not() // OK } else { - b.not() // Bad + b.not() // Bad } } fun test_2(b: Boolean?) { if ((b == true) != true) { - b.not() // Bad + b.not() // Bad } else { b.not() // OK } @@ -22,7 +22,7 @@ fun test_2(b: Boolean?) { fun test_3(b: Boolean?) { if ((b == true) == false) { - b.not() // Bad + b.not() // Bad } else { b.not() // OK } @@ -32,13 +32,13 @@ fun test_4(b: Boolean?) { if ((b == true) != false) { b.not() // OK } else { - b.not() // Bad + b.not() // Bad } } fun test_5(b: Boolean?) { if ((b != true) == true) { - b.not() // Bad + b.not() // Bad } else { b.not() // OK } @@ -48,7 +48,7 @@ fun test_6(b: Boolean?) { if ((b != true) != true) { b.not() // OK } else { - b.not() // Bad + b.not() // Bad } } @@ -56,13 +56,13 @@ fun test_7(b: Boolean?) { if ((b != true) == false) { b.not() // OK } else { - b.not() // Bad + b.not() // Bad } } fun test_8(b: Boolean?) { if ((b != true) != false) { - b.not() // Bad + b.not() // Bad } else { b.not() // OK } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt index be91a791bed..1a3e930d382 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt @@ -34,24 +34,24 @@ fun test_4(a: A?) { fun test_5(a: A?) { a == null || throw Exception() - a.foo() + a.foo() } fun teat_6(a: A?) { a != null && throw Exception() - a.foo() + a.foo() } fun test_7(a: A?) { if (a == null || throw Exception()) { - a.foo() + a.foo() } - a.foo() + a.foo() } fun test_8(a: A?) { if (a != null && throw Exception()) { - a.foo() + a.foo() } - a.foo() + a.foo() } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt index 88992851c5c..799697c6597 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt @@ -104,18 +104,18 @@ fun test_7() { if (x != null) { x.length // OK - y.length // Bad + y.length // Bad z.length // OK } if (y != null) { - x.length // Bad + x.length // Bad y.length // OK - z.length // Bad + z.length // Bad } if (z != null) { x.length // OK - y.length // Bad + y.length // Bad z.length // OK } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt index e54a97ef7fd..7f20364c055 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt @@ -16,12 +16,12 @@ fun test_1(x: A, y: A?) { fun test_2(x: A?, y: A?) { if (x == y) { - x.foo() - y.foo() + x.foo() + y.foo() } if (x === y) { - x.foo() - y.foo() + x.foo() + y.foo() } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt index a0f9eb98439..135353bff85 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt @@ -39,18 +39,18 @@ fun test_1(x: A?) { if (x != null) { x.foo() } else { - x.foo() + x.foo() } - x.foo() + x.foo() } fun test_2(x: A?) { if (x == null) { - x.foo() + x.foo() } else { x.foo() } - x.foo() + x.foo() } fun test_3(x: A?) { @@ -67,8 +67,8 @@ fun test_5(q: Q?) { // `q.data` is a property that has an open getter, so we can NOT smartcast it to non-nullable MyData. if (q?.data?.s?.inc() != null) { q.data // good - q.data.s // should be bad - q.data.s.inc() // should be bad + q.data.s // should be bad + q.data.s.inc() // should be bad } } @@ -76,15 +76,15 @@ fun test_6(q: Q?) { // `q.data` is a property that has an open getter, so we can NOT smartcast it to non-nullable MyData. q?.data?.s?.inc() ?: return q.data // good - q.data.s // should be bad - q.data.s.inc() // should be bad + q.data.s // should be bad + q.data.s.inc() // should be bad } fun test_7(q: Q?) { if (q?.fdata()?.fs()?.inc() != null) { q.fdata() // good - q.fdata().fs() // bad - q.fdata().fs().inc() // bad + q.fdata().fs() // bad + q.fdata().fs().inc() // bad } } @@ -98,44 +98,44 @@ fun test_9(a: Int, b: Int?) { if (a == b) { b.inc() } - b.inc() + b.inc() if (a === b) { b.inc() } - b.inc() + b.inc() if (b == a) { b.inc() } - b.inc() + b.inc() if (b === a) { b.inc() } - b.inc() + b.inc() } fun test_10(a: Int?, b: Int?) { if (a == b) { - b.inc() + b.inc() } - b.inc() + b.inc() if (a === b) { - b.inc() + b.inc() } - b.inc() + b.inc() if (b == a) { - b.inc() + b.inc() } - b.inc() + b.inc() if (b === a) { - b.inc() + b.inc() } - b.inc() + b.inc() } fun test_11(q: QImpl?, q2: QImpl) { @@ -148,8 +148,8 @@ fun test_11(q: QImpl?, q2: QImpl) { // Smartcasting of `q.data` should have no effect on `q2.data`. // Issue: Smartcasting of QImpl.data affects all instances q2.data - q2.data.s // should be bad - q2.data.s.inc() // should be bad + q2.data.s // should be bad + q2.data.s.inc() // should be bad if (q2.data != null) { q2.data.s @@ -162,8 +162,8 @@ fun test_12(q: QImplWithCustomGetter?) { // `q.data` is a property that has an open getter, so we can NOT smartcast it to non-nullable MyData. if (q?.data?.s?.inc() != null) { q.data // good - q.data.s // should be bad - q.data.s.inc() // should be bad + q.data.s // should be bad + q.data.s.inc() // should be bad } } @@ -171,7 +171,7 @@ fun test_13(q: QImplMutable?) { // `q.data` is a property that is mutable, so we can NOT smartcast it to non-nullable MyData. if (q?.data?.s?.inc() != null) { q.data // good - q.data.s // should be bad - q.data.s.inc() // should be bad + q.data.s // should be bad + q.data.s.inc() // should be bad } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt index 9b2ad3bab6f..f8fa330fba3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt @@ -22,6 +22,6 @@ fun test_3(a: Any?, b: Boolean) { fun test_4(a: Any?, b: Boolean) { if (a is String || b) { - a.foo() // Should be Bad + a.foo() // Should be Bad } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt index 293db6f24d0..0669629735d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt @@ -5,7 +5,7 @@ fun test_1(s: String?) { if (s?.check() == true) { s.length // Should be OK } else { - s.length // Should be bad + s.length // Should be bad } } @@ -13,13 +13,13 @@ fun test_2(s: String?) { if (s?.check() == false) { s.length // Should be OK } else { - s.length // Should be bad + s.length // Should be bad } } fun test_3(s: String?) { if (s?.check() != true) { - s.length // Should be bad + s.length // Should be bad } else { s.length // Should be OK } @@ -27,7 +27,7 @@ fun test_3(s: String?) { fun test_4(s: String?) { if (s?.check() != false) { - s.length // Should be bad + s.length // Should be bad } else { s.length // Should be OK } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt index 455c59ab709..4378b7ecc59 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt @@ -5,7 +5,7 @@ fun String.let(block: () -> Unit) {} fun test(x: String?) { x?.foo(x.length == 1) - x.length + x.length } interface A { @@ -27,12 +27,12 @@ fun test_3(x: Any) { fun test_4(x: A?) { x?.id()?.bool() - x.id() + x.id() } fun Any?.boo(b: Boolean) {} fun test_5(x: A?) { x?.let { return }?.boo(x.bool()) - x.id() + x.id() } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt index c911291afd8..7c160fba45c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt @@ -11,5 +11,5 @@ fun test(b: Boolean) { } else { a = null } - a.foo() + a.foo() } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt index 056a5620c9c..f684cc63a20 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.kt @@ -18,5 +18,5 @@ fun test_3() { x = "" x.length x = null - x.length + x.length } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.kt index 4a615ff5aa3..e6abe4d7c53 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.kt @@ -7,7 +7,7 @@ fun test_1(s: String?) { fun test_2(s: String?) { // contracts related if (s.isNullOrEmpty()) { - s.length // Should be bad + s.length // Should be bad } else { s.length // Should be OK } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.kt index af95ad9668c..2012d4f0aec 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.kt @@ -21,7 +21,7 @@ fun test_1(x: String?) { if (checkNotNull(x)) { x.length // OK } else { - x.length // Error + x.length // Error } } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.kt index 0e12db35591..e6cf24145ab 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.kt @@ -27,7 +27,7 @@ fun test_3(x: A?) { with(x) { myRequireNotNull() } - x.foo() + x.foo() } fun test_4(x: A?) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt index a16123ea4cd..179cd7a2ff4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.extended.report import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirProperty +import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.declarations.FirVariable import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic @@ -20,8 +21,12 @@ import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError +import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol +import org.jetbrains.kotlin.fir.types.ConeKotlinType +import org.jetbrains.kotlin.fir.types.coneTypeSafe +import org.jetbrains.kotlin.fir.types.isNullable object FirDestructuringDeclarationChecker : FirPropertyChecker() { override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) { @@ -65,8 +70,8 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() { val originalDestructuringDeclarationOrInitializerSource = originalDestructuringDeclarationOrInitializer.source ?: return val originalDestructuringDeclarationType = when (originalDestructuringDeclarationOrInitializer) { - is FirVariable<*> -> originalDestructuringDeclarationOrInitializer.returnTypeRef - is FirExpression -> originalDestructuringDeclarationOrInitializer.typeRef + is FirVariable<*> -> originalDestructuringDeclarationOrInitializer.returnTypeRef.coneTypeSafe() + is FirExpression -> originalDestructuringDeclarationOrInitializer.typeRef.coneTypeSafe() else -> null } ?: return @@ -89,7 +94,16 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() { ) ) } - // TODO: COMPONENT_FUNCTION_ON_NULLABLE + is ConeInapplicableCandidateError -> { + if (originalDestructuringDeclarationType.isNullable) { + reporter.report( + FirErrors.COMPONENT_FUNCTION_ON_NULLABLE.on( + originalDestructuringDeclarationOrInitializerSource, + (diagnostic.candidateSymbol.fir as FirSimpleFunction).name + ) + ) + } + } // TODO: COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt index 33a800bf918..939a841d41f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt @@ -10,9 +10,7 @@ import org.jetbrains.kotlin.fir.FirFakeSourceElementKind import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.collectors.AbstractDiagnosticCollector -import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory0 -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.analysis.diagnostics.* import org.jetbrains.kotlin.fir.declarations.FirErrorFunction import org.jetbrains.kotlin.fir.diagnostics.* import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind.* @@ -20,8 +18,9 @@ import org.jetbrains.kotlin.fir.expressions.FirErrorExpression import org.jetbrains.kotlin.fir.expressions.FirErrorLoop import org.jetbrains.kotlin.fir.expressions.FirErrorResolvedQualifier import org.jetbrains.kotlin.fir.references.FirErrorNamedReference +import org.jetbrains.kotlin.fir.resolve.calls.InapplicableWrongReceiver import org.jetbrains.kotlin.fir.resolve.diagnostics.* -import org.jetbrains.kotlin.fir.types.FirErrorTypeRef +import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.resolve.calls.tower.isSuccess import org.jetbrains.kotlin.utils.addToStdlib.safeAs @@ -62,7 +61,10 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect // Will be handled by [FirDestructuringDeclarationChecker] if (source.elementType == KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY) { // TODO: if all diagnostics are supported, we don't need the following check, and will bail out based on element type. - if (diagnostic is ConeUnresolvedNameError || diagnostic is ConeAmbiguityError) { + if (diagnostic is ConeUnresolvedNameError || + diagnostic is ConeAmbiguityError || + diagnostic is ConeInapplicableCandidateError + ) { return } } @@ -72,7 +74,7 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect is ConeUnresolvedSymbolError -> FirErrors.UNRESOLVED_REFERENCE.on(source, diagnostic.classId.asString()) is ConeUnresolvedNameError -> FirErrors.UNRESOLVED_REFERENCE.on(source, diagnostic.name.asString()) is ConeHiddenCandidateError -> FirErrors.HIDDEN.on(source, diagnostic.candidateSymbol) - is ConeInapplicableCandidateError -> FirErrors.INAPPLICABLE_CANDIDATE.on(source, diagnostic.candidateSymbol) + is ConeInapplicableCandidateError -> mapInapplicableCandidateError(diagnostic, source) is ConeAmbiguityError -> if (!diagnostic.applicability.isSuccess) { FirErrors.NONE_APPLICABLE.on(source, diagnostic.candidates) } else { @@ -98,6 +100,25 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect reporter.report(coneDiagnostic) } + private fun mapInapplicableCandidateError( + diagnostic: ConeInapplicableCandidateError, + source: FirSourceElement, + ): FirDiagnostic<*> { + // TODO: Need to distinguish SMARTCAST_IMPOSSIBLE + // TODO: handle other UNSAFE_* variants: invoke, infix, operator + val rootCause = diagnostic.diagnostics.find { it.applicability == diagnostic.applicability } + return if (rootCause != null && + rootCause is InapplicableWrongReceiver && + rootCause.actualType?.isNullable == true && + (rootCause.expectedType == null || !rootCause.expectedType!!.isMarkedNullable) + ) { + // TODO: report on call operation node, e.g., x.length instead of x.length + FirErrors.UNSAFE_CALL.on(source, rootCause.actualType!!) + } else { + FirErrors.INAPPLICABLE_CANDIDATE.on(source, diagnostic.candidateSymbol) + } + } + private fun ConeSimpleDiagnostic.getFactory(): FirDiagnosticFactory0 { @Suppress("UNCHECKED_CAST") return when (kind) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt index 80afdfd30a4..4da06ddfe13 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt @@ -37,6 +37,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.CAN_BE_VAL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.CLASS_IN_SUPERTYPE_FOR_ENUM import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.COMPONENT_FUNCTION_AMBIGUITY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.COMPONENT_FUNCTION_MISSING +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.COMPONENT_FUNCTION_ON_NULLABLE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.CONFLICTING_OVERLOADS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.CONFLICTING_PROJECTION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.CONSTRUCTOR_IN_INTERFACE @@ -137,6 +138,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_AS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNINITIALIZED_VARIABLE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_LABEL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_REFERENCE +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNSAFE_CALL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNUSED_VARIABLE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UPPER_BOUND_VIOLATED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.USELESS_VARARG_ON_PARAMETER @@ -418,6 +420,11 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { TO_STRING, AMBIGUOUS_CALLS ) + map.put( + COMPONENT_FUNCTION_ON_NULLABLE, + "Not nullable value required to call ''{0}()'' function of destructuring declaration initializer", + TO_STRING + ) // Control flow diagnostics map.put(UNINITIALIZED_VARIABLE, "{0} must be initialized before access", PROPERTY_NAME) @@ -431,6 +438,18 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { map.put(LEAKED_IN_PLACE_LAMBDA, "Leaked in-place lambda: {2}", SYMBOL) map.put(FirErrors.WRONG_IMPLIES_CONDITION, "Wrong implies condition") + // Nullability + map.put( + UNSAFE_CALL, + "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type {0}", + RENDER_TYPE + ) + //map.put( + // UNSAFE_IMPLICIT_INVOKE_CALL, + // "Reference has a nullable type ''{0}'', use explicit \"?.invoke\" to make a function-like call instead.", + // RENDER_TYPE + //) + // Extended checkers group map.put(REDUNDANT_VISIBILITY_MODIFIER, "Redundant visibility modifier") map.put(REDUNDANT_MODALITY_MODIFIER, "Redundant modality modifier") diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderers.kt index a06c569f83b..483a5c42c7e 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDiagnosticRenderers.kt @@ -13,7 +13,8 @@ import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol -import org.jetbrains.kotlin.fir.types.FirTypeRef +import org.jetbrains.kotlin.fir.types.ConeKotlinType +import org.jetbrains.kotlin.fir.types.render object FirDiagnosticRenderers { val NULLABLE_STRING = Renderer { it ?: "null" } @@ -58,9 +59,9 @@ object FirDiagnosticRenderers { name.asString() } - val RENDER_TYPE = Renderer { typeRef: FirTypeRef -> + val RENDER_TYPE = Renderer { t: ConeKotlinType -> // TODO: need a way to tune granuality, e.g., without parameter names in functional types. - typeRef.render() + t.render() } val AMBIGUOUS_CALLS = Renderer { candidates: Collection> -> diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 47bfb8a2fe3..011026d1fb7 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -197,9 +197,9 @@ object FirErrors { // Destructuring declaration val INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION by error0() - val COMPONENT_FUNCTION_MISSING by error2() - val COMPONENT_FUNCTION_AMBIGUITY by error2>>() - // TODO: val COMPONENT_FUNCTION_ON_NULLABLE by ... + val COMPONENT_FUNCTION_MISSING by error2() + val COMPONENT_FUNCTION_AMBIGUITY by error2>>() + val COMPONENT_FUNCTION_ON_NULLABLE by error1() // TODO: val COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH by ... // Control flow diagnostics @@ -208,6 +208,13 @@ object FirErrors { val LEAKED_IN_PLACE_LAMBDA by error1>() val WRONG_IMPLIES_CONDITION by warning0() + // Nullability + val UNSAFE_CALL by error1() + // TODO: val UNSAFE_IMPLICIT_INVOKE_CALL by error1() + // TODO: val UNSAFE_INFIX_CALL by ... + // TODO: val UNSAFE_OPERATOR_CALL by ... + // TODO: val UNEXPECTED_SAFE_CALL by ... + // Extended checkers group val REDUNDANT_VISIBILITY_MODIFIER by warning0(SourceElementPositioningStrategies.VISIBILITY_MODIFIER) val REDUNDANT_MODALITY_MODIFIER by warning0(SourceElementPositioningStrategies.MODALITY_MODIFIER) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index 511470096ca..172cbb4cae8 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -310,7 +310,7 @@ private fun checkApplicabilityForArgumentType( if (expectedType == null) return if (isReceiver && isDispatch) { if (!expectedType.isNullable && argumentType.isMarkedNullable) { - sink.reportDiagnostic(InapplicableWrongReceiver) + sink.reportDiagnostic(InapplicableWrongReceiver(expectedType, argumentType)) } return } @@ -323,10 +323,10 @@ private fun checkApplicabilityForArgumentType( val nullableExpectedType = expectedType.withNullability(ConeNullability.NULLABLE, context.session.typeContext) if (csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) { - sink.reportDiagnostic(InapplicableWrongReceiver) // TODO + sink.reportDiagnostic(InapplicableWrongReceiver(expectedType, argumentType)) // TODO } else { csBuilder.addSubtypeConstraint(argumentType, expectedType, position) - sink.reportDiagnostic(InapplicableWrongReceiver) + sink.reportDiagnostic(InapplicableWrongReceiver(expectedType, argumentType)) } } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt index b3ee019a4c8..fa1ac80d2fd 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.resolve.calls import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability abstract class ResolutionDiagnostic(val applicability: CandidateApplicability) @@ -57,7 +58,10 @@ object HiddenCandidate : ResolutionDiagnostic(CandidateApplicability.HIDDEN) object ResolvedWithLowPriority : ResolutionDiagnostic(CandidateApplicability.RESOLVED_LOW_PRIORITY) -object InapplicableWrongReceiver : ResolutionDiagnostic(CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER) +class InapplicableWrongReceiver( + val expectedType: ConeKotlinType? = null, + val actualType: ConeKotlinType? = null, +) : ResolutionDiagnostic(CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER) object LowerPriorityToPreserveCompatibilityDiagnostic : ResolutionDiagnostic(CandidateApplicability.RESOLVED_NEED_PRESERVE_COMPATIBILITY) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index 50bfa79c876..bb3b6eb744b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -39,17 +39,17 @@ internal object CheckExplicitReceiverConsistency : ResolutionStage() { when (receiverKind) { NO_EXPLICIT_RECEIVER -> { if (explicitReceiver != null && explicitReceiver !is FirResolvedQualifier && !explicitReceiver.isSuperReferenceExpression()) { - return sink.yieldDiagnostic(InapplicableWrongReceiver) + return sink.yieldDiagnostic(InapplicableWrongReceiver(actualType = explicitReceiver.typeRef.coneTypeSafe())) } } EXTENSION_RECEIVER, DISPATCH_RECEIVER -> { if (explicitReceiver == null) { - return sink.yieldDiagnostic(InapplicableWrongReceiver) + return sink.yieldDiagnostic(InapplicableWrongReceiver()) } } BOTH_RECEIVERS -> { if (explicitReceiver == null) { - return sink.yieldDiagnostic(InapplicableWrongReceiver) + return sink.yieldDiagnostic(InapplicableWrongReceiver()) } // Here we should also check additional invoke receiver } @@ -105,7 +105,7 @@ object CheckDispatchReceiver : ResolutionStage() { val dispatchReceiverValueType = candidate.dispatchReceiverValue?.type ?: return if (!AbstractNullabilityChecker.isSubtypeOfAny(context.session.typeContext, dispatchReceiverValueType)) { - sink.yieldDiagnostic(InapplicableWrongReceiver) + sink.yieldDiagnostic(InapplicableWrongReceiver(actualType = dispatchReceiverValueType)) } } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt index e50a0be8f76..8555107a894 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.calls.Candidate +import org.jetbrains.kotlin.fir.resolve.calls.ResolutionDiagnostic import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol @@ -37,14 +38,16 @@ class ConeHiddenCandidateError( override val reason: String get() = "HIDDEN: ${describeSymbol(candidateSymbol)} is invisible" } -class ConeInapplicableCandidateError( +class ConeInapplicableCandidateError private constructor( val applicability: CandidateApplicability, val candidateSymbol: AbstractFirBasedSymbol<*>, + val diagnostics: List, val errors: List ) : ConeDiagnostic() { constructor(applicability: CandidateApplicability, candidate: Candidate) : this( applicability, candidate.symbol, + candidate.diagnostics, candidate.system.errors ) diff --git a/compiler/testData/diagnostics/tests/BreakContinue.fir.kt b/compiler/testData/diagnostics/tests/BreakContinue.fir.kt index 456a6b1b623..3dd08bac65a 100644 --- a/compiler/testData/diagnostics/tests/BreakContinue.fir.kt +++ b/compiler/testData/diagnostics/tests/BreakContinue.fir.kt @@ -29,7 +29,7 @@ class C { while (a == null) { break; } - a.compareTo("2") + a.compareTo("2") } fun notContainsBreak(a: String?, b: String?) { @@ -70,7 +70,7 @@ class C { break@l } } - a.compareTo("2") + a.compareTo("2") } fun unresolvedBreak(a: String?, array: Array) { @@ -80,7 +80,7 @@ class C { } if (true) break else break@l } - a.compareTo("2") + a.compareTo("2") } fun twoLabelsOnLoop() { diff --git a/compiler/testData/diagnostics/tests/Nullability.fir.kt b/compiler/testData/diagnostics/tests/Nullability.fir.kt index 546e69d05d6..e8503b1ae07 100644 --- a/compiler/testData/diagnostics/tests/Nullability.fir.kt +++ b/compiler/testData/diagnostics/tests/Nullability.fir.kt @@ -158,7 +158,7 @@ fun test() { fun f(out : String?) { out?.get(0) - out.get(0) + out.get(0) if (out != null) else return; out.get(0) } diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt index b6236178bb0..5f99076728e 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.fir.kt @@ -14,11 +14,11 @@ fun test() { } fun check() { - [1, 2] checkType { _>() } - [""] checkType { _>() } + [1, 2] checkType { _>() } + [""] checkType { _>() } val f: IntArray = [1] - [f] checkType { _>() } + [f] checkType { _>() } - [1, ""] checkType { _>() } + [1, ""] checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt index 8c7dc98fa97..a61a47ce9eb 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt @@ -7,9 +7,9 @@ operator fun Container.iterator(): Iterator = null!! fun test() { val container: Container? = null // Error - container.iterator() + container.iterator() // for extension iterator, this code compiles, but should not - for (s in container) {} + for (s in container) {} } class OtherContainer(val k: K) { operator fun iterator(): Iterator = null!! @@ -18,5 +18,5 @@ class OtherContainer(val k: K) { fun test2() { val other: OtherContainer? = null // Error - for (s in other) {} + for (s in other) {} } diff --git a/compiler/testData/diagnostics/tests/controlStructures/forLoopWithNullableRange.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/forLoopWithNullableRange.fir.kt index 5f4acc078ec..8940c91415f 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/forLoopWithNullableRange.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/forLoopWithNullableRange.fir.kt @@ -8,7 +8,7 @@ class It { } fun test(c: Coll?) { - for (x in c) {} + for (x in c) {} if (c != null) { for(x in c) {} diff --git a/compiler/testData/diagnostics/tests/controlStructures/forWithNullableIterator.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/forWithNullableIterator.fir.kt index 3fa6d25c9b2..2daa6c2e4fd 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/forWithNullableIterator.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/forWithNullableIterator.fir.kt @@ -8,5 +8,5 @@ class It { } fun test() { - for (x in Coll()) {} + for (x in Coll()) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.fir.kt b/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.fir.kt index 35a91f872ec..ea2b32291a8 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.fir.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/extensionComponentsOnNullable.fir.kt @@ -8,7 +8,7 @@ operator fun Data.component2() = y fun foo(): Int { val d: Data? = null // An error must be here - val (x, y) = d + val (x, y) = d return x + y } @@ -17,6 +17,6 @@ data class NormalData(val x: T, val y: T) fun bar(): Int { val d: NormalData? = null // An error must be here - val (x, y) = d + val (x, y) = d return x + y } diff --git a/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValNullability.fir.kt b/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValNullability.fir.kt index 4123fd8c1e4..cee27e5b00a 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValNullability.fir.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValNullability.fir.kt @@ -10,6 +10,6 @@ fun test(a: Any?, flag: Boolean, x: Any?) { } else { b = x - b.hashCode() + b.hashCode() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/UnaryExpression.fir.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/UnaryExpression.fir.kt index 168fea3ca59..8803f8d30bf 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/UnaryExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/UnaryExpression.fir.kt @@ -4,11 +4,11 @@ fun baz(b: Boolean): Boolean = !b fun foo() { val x: Int? = null - bar(-x) + bar(-x) if (x != null) bar(-x) - bar(-x) + bar(-x) val b: Boolean? = null - baz(!b) + baz(!b) if (b != null) baz(!b) } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.fir.kt index 93b54cc4397..79f6bfec9b2 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/MultiDeclarationErrors.fir.kt @@ -11,7 +11,7 @@ class MyClass2 {} fun MyClass2.component1() = 1.3 fun test(mc1: MyClass, mc2: MyClass2) { - val (a, b) = mc1 + val (a, b) = mc1 val (c) = mc2 //a,b,c are error types diff --git a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt index 991fc0fe076..8287a52b1ea 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt @@ -5,7 +5,7 @@ fun foo(block: () -> (() -> Int)) {} fun test() { val x = fun named1(x: Int): Int { return 1 } - x checkType { _>() } + x checkType { _>() } foo { fun named2(): Int {return 1} } foo({ fun named3() = 1 }) diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt index 44614eb1728..d97a9489f92 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt @@ -64,7 +64,7 @@ import outer.* command.foo - command.equals(null) + command.equals(null) command?.equals(null) command.equals1(null) command?.equals1(null) diff --git a/compiler/testData/diagnostics/tests/extensions/kt1875.fir.kt b/compiler/testData/diagnostics/tests/extensions/kt1875.fir.kt index 3736d3d3ee2..97b7009ccad 100644 --- a/compiler/testData/diagnostics/tests/extensions/kt1875.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/kt1875.fir.kt @@ -9,13 +9,13 @@ interface T { } fun test(t: T) { - t.f(1) //unsafe call error + t.f(1) //unsafe call error t.f?.invoke(1) } fun test1(t: T?) { t.f(1) // todo resolve f as value and report UNSAFE_CALL - t?.f(1) - t.f?.invoke(1) + t?.f(1) + t.f?.invoke(1) t?.f?.invoke(1) } diff --git a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt index fa574807616..22fe4826bd5 100644 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt @@ -8,7 +8,7 @@ fun List.a() {} fun test1(i: Int?) { 1.a() - i.a() + i.a() } fun test2(c: Collection) { @@ -19,7 +19,7 @@ fun Int.foo() {} fun test3(s: String?) { "".foo() - s.foo() + s.foo() "".foo(1) s.foo("a") } @@ -52,5 +52,5 @@ fun test7(l: List) { } fun test8(l: List?) { - l.b() + l.b() } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt index e9d09e341af..31c70005549 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt @@ -24,24 +24,24 @@ fun bar(aInstance: A, bInstance: B) { foo(bInstance) { (a, b): A, (c, d) -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } c checkType { _() } d checkType { _() } } foo(bInstance) { (a, b), (c, d) -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } c checkType { _() } d checkType { _() } } foo(bInstance) { (a, b), (c, d) -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } c checkType { _() } d checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt index 9b4ea9d4756..0fb7b9f92bc 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/redeclaration.fir.kt @@ -23,7 +23,7 @@ fun bar() { } foo { (a, b), (c, b) -> - a checkType { _() } + a checkType { _() } b checkType { _() } c checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt index 1115485d97c..b2af00d8479 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/simple.fir.kt @@ -36,8 +36,8 @@ fun bar() { } foobar { (a, b), (c, d) -> - a checkType { _() } - b checkType { _() } + a checkType { _() } + b checkType { _() } c checkType { _() } d checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.fir.kt index db23c7d5f31..04fadf414b7 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unusedParameters.fir.kt @@ -32,12 +32,12 @@ fun bar() { } foobar { (a, b), (c, d) -> - a checkType { _() } + a checkType { _() } d checkType { _() } } foobar { (a, b), (c, d) -> - b checkType { _() } + b checkType { _() } c checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt index 15dfefa3581..7074f6d1802 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt @@ -20,7 +20,7 @@ class A : Outer() { fun foo() { Derived().foo() checkType { _.Inner>() } - Derived().baz() checkType { _>() } + Derived().baz() checkType { _>() } A.B().bar() checkType { _.Inner>() } - A.B().x() checkType { _>() } + A.B().x() checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt index 603d640167d..06867cf008e 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt @@ -43,7 +43,7 @@ fun test() { x = foobar() x().foo().a() checkType { _>() } - x().bar() checkType { _>() } + x().bar() checkType { _>() } x = foobar() @@ -51,5 +51,5 @@ fun test() { y = noParameters() y().foo().a() checkType { _>() } - y().bar() checkType { _>() } + y().bar() checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt index 9f0071189a5..2cef2166c0a 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt @@ -44,7 +44,7 @@ class Outer { x = foobar() x().foo().a() checkType { _>() } - x().bar() checkType { _>() } + x().bar() checkType { _>() } x = foobar() x = z.foobar() @@ -53,7 +53,7 @@ class Outer { y = noParameters() y().foo().a() checkType { _>() } - y().bar() checkType { _>() } + y().bar() checkType { _>() } } } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt index ccefd06ca5b..bfbf34ff775 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt @@ -15,5 +15,5 @@ class Derived : BaseDerived2() { fun foo() { Derived().foo() checkType { _.Inner>() } - Derived().baz() checkType { _>() } + Derived().baz() checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/inference/completion/lambdaWithVariableAndNothing.fir.kt b/compiler/testData/diagnostics/tests/inference/completion/lambdaWithVariableAndNothing.fir.kt index e8c34135f42..bea156ac175 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/lambdaWithVariableAndNothing.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/lambdaWithVariableAndNothing.fir.kt @@ -23,7 +23,7 @@ fun testNoSmartCast1(s: String?) { if (s != null) "" else noSmartCast1(null) { "" } ) - s.length + s.length } fun testNoSmartCast2(s: String?) { @@ -31,7 +31,7 @@ fun testNoSmartCast2(s: String?) { if (s != null) ( {""} ) else noSmartCast2(null) { "" } ) - s.length + s.length } fun testNoSmartCast3(s: String?) { @@ -39,7 +39,7 @@ fun testNoSmartCast3(s: String?) { if (s != null) "" else noSmartCast3(null) { "" } ) - s.length + s.length } // KT-36069 @@ -48,5 +48,5 @@ fun testNoSmartCast4(s: String?) { if (s != null) ( {""} ) else noSmartCast4(null) { "" } ) - s.length + s.length } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2842.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2842.fir.kt index 958e980bed9..f058a9a90a1 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2842.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2842.fir.kt @@ -3,14 +3,14 @@ package c interface A fun test(a: A?) { - a.foo() //no error + a.foo() //no error } fun A.foo() {} //------------ fun test(nullabilityInfoMap: Map?) { - nullabilityInfoMap.iterator() //no error + nullabilityInfoMap.iterator() //no error } //resolves to @@ -20,7 +20,7 @@ public fun Map.iterator(): Iterator> {} //------------- fun foo() : Boolean { val nullableList = getNullableList() - return nullableList.contains("") + return nullableList.contains("") } diff --git a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloads.fir.kt b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloads.fir.kt index 80760d8daf3..ac9da0f0ba2 100644 --- a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloads.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloads.fir.kt @@ -19,9 +19,9 @@ public abstract class CollectionWithSize implements java.util.Collection // FILE: main.kt fun main(c: CollectionWithSize) { - CompressionType.ZIP.name checkType { _() } - c.size checkType { _() } + CompressionType.ZIP.name checkType { _() } + c.size checkType { _() } - CompressionType.ZIP::name checkType { _>() } - c::size checkType { _>() } + CompressionType.ZIP::name checkType { _>() } + c::size checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt index aa113f16ee1..8121e3c48d0 100644 --- a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt @@ -20,9 +20,9 @@ public abstract class CollectionWithSize implements java.util.Collection // FILE: main.kt fun main(c: CollectionWithSize) { - CompressionType.ZIP.name checkType { _() } - c.size checkType { _() } + CompressionType.ZIP.name checkType { _() } + c.size checkType { _() } - CompressionType.ZIP::name checkType { _>() } - c::size checkType { _>() } + CompressionType.ZIP::name checkType { _>() } + c::size checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsNI.fir.kt b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsNI.fir.kt index df77b661fc5..4ed8ecfdbde 100644 --- a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsNI.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsNI.fir.kt @@ -19,9 +19,9 @@ public abstract class CollectionWithSize implements java.util.Collection // FILE: main.kt fun main(c: CollectionWithSize) { - CompressionType.ZIP.name checkType { _() } - c.size checkType { _() } + CompressionType.ZIP.name checkType { _() } + c.size checkType { _() } - CompressionType.ZIP::name checkType { _>() } - c::size checkType { _>() } + CompressionType.ZIP::name checkType { _>() } + c::size checkType { _>() } } diff --git a/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.fir.kt b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.fir.kt index 8b236b356e7..5a6c239f2a3 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.fir.kt @@ -17,12 +17,12 @@ public interface J2 extends J { // FILE: main.kt fun main() { J { s: String -> s} // should be prohibited, because SAM value parameter has nullable type - J { "" + it.length } + J { "" + it.length } J { null } J { it?.length?.toString() } J2 { s: String -> s} - J2 { "" + it.length } + J2 { "" + it.length } J2 { null } J2 { it?.length?.toString() } } diff --git a/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt b/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt index c64eab51fd2..4db841309f3 100644 --- a/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt @@ -11,6 +11,6 @@ public class A { // FILE: main.kt fun foo(a: A) { - a.foo() checkType { _() } - A.bar() checkType { _() } + a.foo() checkType { _() } + A.bar() checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt index 839925da1b5..72cd24bbdde 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt @@ -12,21 +12,21 @@ fun test(x : Int?, a : A?) { x.plus(1) x?.plus(1) x + 1 - -x - x.unaryMinus() + -x + x.unaryMinus() x?.unaryMinus() - a.plus(1) + a.plus(1) a?.plus(1) - a plus 1 - a + 1 - -a - a.unaryMinus() + a plus 1 + a + 1 + -a + a.unaryMinus() a?.unaryMinus() - a.div(1) - a / 1 - a div 1 + a.div(1) + a / 1 + a div 1 a?.div(1) a.times(1) @@ -34,8 +34,8 @@ fun test(x : Int?, a : A?) { a times 1 a?.times(1) - 1 in a - a contains 1 - a.contains(1) + 1 in a + a contains 1 + a.contains(1) a?.contains(1) } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/QualifiedExpressionNullability.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/QualifiedExpressionNullability.fir.kt index dd37e99af1e..2f5c6a7e097 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/QualifiedExpressionNullability.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/QualifiedExpressionNullability.fir.kt @@ -7,7 +7,7 @@ fun main() { val x: Foo? = null val y: Foo? = null - x.foo(y) + x.foo(y) x!!.foo(y) x.foo(y!!) x!!.foo(y!!) @@ -16,8 +16,8 @@ fun main() { val b: Foo? = null val c: Foo? = null - a.foo(b.foo(c)) - a!!.foo(b.foo(c)) + a.foo(b.foo(c)) + a!!.foo(b.foo(c)) a.foo(b!!.foo(c)) a!!.foo(b!!.foo(c)) a.foo(b.foo(c!!)) diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.fir.kt index f4c80d04a33..9e276aeb021 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.fir.kt @@ -6,8 +6,8 @@ fun A.bar() {} fun A?.buzz() {} fun test(a : A?) { - a.foo() // error - a.bar() // error + a.foo() // error + a.bar() // error a.buzz() a?.foo() @@ -30,12 +30,12 @@ fun A.test2() { } fun A?.test3() { - foo() // error - bar() // error + foo() // error + bar() // error buzz() - this.foo() // error - this.bar() // error + this.foo() // error + this.bar() // error this.buzz() this?.foo() diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.fir.kt index fc22dedc602..a874fdd3e2d 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.fir.kt @@ -5,7 +5,7 @@ package kt1270 fun foo() { val sc = java.util.HashMap()[""] - val value = sc.value + val value = sc.value } private class SomeClass() { diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt index b50cddfcd3e..de9fdea7140 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt @@ -5,7 +5,7 @@ package e fun main() { val compareTo = 1 val s: String? = null - s.compareTo("") + s.compareTo("") val bar = 2 s.bar() diff --git a/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.fir.kt index de64ac8a435..8bf5b4f0e03 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.fir.kt @@ -13,5 +13,5 @@ public class B { // FILE: main.kt fun test() { - B.bar() { it.hashCode() > 0 } + B.bar() { it.hashCode() > 0 } } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.fir.kt index b6401dfa2a7..a2cf8835ddb 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.fir.kt @@ -22,11 +22,11 @@ fun test() { var platformJ = J.staticJ +platformNN - +platformN + +platformN +platformJ ++platformNN - ++platformN + ++platformN ++platformJ platformNN++ diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/array.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/array.fir.kt index 59c87e88853..c05704fda35 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/array.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/array.fir.kt @@ -21,11 +21,11 @@ fun test() { val platformJ = J.staticJ platformNN[0] - platformN[0] + platformN[0] platformJ[0] platformNN[0] = 1 - platformN[0] = 1 + platformN[0] = 1 platformJ[0] = 1 } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.fir.kt index b81312ebbed..352b3c96041 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/conditions.fir.kt @@ -43,6 +43,6 @@ fun test() { platformJ || false !platformNN - !platformN + !platformN !platformJ } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.fir.kt index 57a25830916..6b6b626d5a5 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.fir.kt @@ -19,5 +19,5 @@ public class J { // FILE: k.kt var A by J.staticNN -var B by J.staticN +var B by J.staticN var C by J.staticJ \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt index 413bcb99789..b283f99169b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt @@ -23,14 +23,14 @@ fun test() { val platformJ = J.staticJ platformNN.foo() - platformN.foo() + platformN.foo() platformJ.foo() with(platformNN) { foo() } with(platformN) { - foo() + foo() } with(platformJ) { foo() diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt index e63bffd9e8d..4422bd3d76e 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt @@ -25,14 +25,14 @@ fun test() { val platformJ = J.staticJ platformNN.foo() - platformN.foo() + platformN.foo() platformJ.foo() with(platformNN) { foo() } with(platformN) { - foo() + foo() } with(platformJ) { foo() diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/for.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/for.fir.kt index 39bda6289ca..cddddf5f0d9 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/for.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/for.fir.kt @@ -22,7 +22,7 @@ fun test() { val platformJ = J.staticJ for (x in platformNN) {} - for (x in platformN) {} + for (x in platformN) {} for (x in platformJ) {} } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/invoke.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/invoke.fir.kt index 5556634de6d..f858bc8d56f 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/invoke.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/invoke.fir.kt @@ -18,6 +18,6 @@ public class J { fun test() { J.staticNN() - J.staticN() + J.staticN() J.staticJ() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.fir.kt index 356e46c7d01..6bc3106d2f2 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.fir.kt @@ -16,7 +16,7 @@ public class J { fun foo(collection: Collection) { val mapped = collection.map { it.method() } - mapped[0].length + mapped[0].length } public fun Iterable.map(transform: (T) -> R): List { diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.fir.kt deleted file mode 100644 index c997080cc1a..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.fir.kt +++ /dev/null @@ -1,32 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: J.java - -import org.jetbrains.annotations.*; - -public class J { - public interface Multi { - String component1(); - String component2(); - } - - @NotNull - public static Multi staticNN; - @Nullable - public static Multi staticN; - public static Multi staticJ; -} - -// FILE: k.kt - -fun test() { - // @NotNull platform type - val platformNN = J.staticNN - // @Nullable platform type - val platformN = J.staticN - // platform type with no annotation - val platformJ = J.staticJ - - val (a1, b1) = platformNN - val (a2, b2) = platformN - val (a3, b3) = platformJ -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.kt index 7d4acfccd85..aa29474b014 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/multiDeclaration.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/primitiveArray.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/primitiveArray.fir.kt index 2b30ddadf5d..ae8754ed694 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/primitiveArray.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/primitiveArray.fir.kt @@ -21,11 +21,11 @@ fun test() { val platformJ = J.staticJ platformNN[0] - platformN[0] + platformN[0] platformJ[0] platformNN[0] = 1 - platformN[0] = 1 + platformN[0] = 1 platformJ[0] = 1 } diff --git a/compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.fir.kt index b341e6fcf69..1efd7128a34 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.fir.kt @@ -8,8 +8,8 @@ class E : B1() { fun baz() { val x: String? = "" - x.foo(x) - x.foo("") + x.foo(x) + x.foo("") x.bar(x) x.bar("") } diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/primaryConstructorParameter.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/primaryConstructorParameter.fir.kt index 45c62b274d7..834814d7fdb 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/primaryConstructorParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/primaryConstructorParameter.fir.kt @@ -19,5 +19,5 @@ class C(p: Any, val v: Any) { var test5 get() { return p } - set(nv) { p.let {} } + set(nv) { p.let {} } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt12898.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt12898.fir.kt index 5272cd34b89..24aa3ce70c9 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt12898.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt12898.fir.kt @@ -10,7 +10,7 @@ class C(override val t: Any?) : B fun f(b: B<*, Any>) { val y = b.t if (y is String?) { - y.length + y.length } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt282.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt282.fir.kt index f119809683d..69fae482fa7 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt282.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt282.fir.kt @@ -14,6 +14,6 @@ fun f(): Unit { val i : Int? = null i + 1 set + 1 - 1 in set + 1 in set 1 in 2 } diff --git a/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt index c24e96f737d..c48032772db 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt @@ -8,5 +8,5 @@ fun Array.length() : Int { } fun test(array : Array?) { - array?.sure>().length() + array?.sure>().length() } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/unsafeCallWithInvoke.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/unsafeCallWithInvoke.fir.kt index 9ec457efedc..dddbda1ff30 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/unsafeCallWithInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/unsafeCallWithInvoke.fir.kt @@ -4,7 +4,7 @@ operator fun String.invoke(i: Int) {} fun foo(s: String?) { - s(1) + s(1) - (s ?: null)(1) + (s ?: null)(1) } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt index 91c6e8b763d..21bb974a2bc 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt @@ -12,7 +12,7 @@ class Another1 { fun Another1.main(x: Bar1?) { x?.value {} - x?.value.invoke({}) + x?.value.invoke({}) } // Test case 2: additional receiver, non-generic invoke @@ -26,7 +26,7 @@ class Another2 { fun Another2.main(x: Bar2?) { x?.value(1) - x?.value.invoke(1) + x?.value.invoke(1) } // Test case 3: additional generic receiver, generic invoke @@ -40,7 +40,7 @@ class Another3 { fun Another3.main(x: Bar3?) { x?.value(1) - x?.value.invoke(1) + x?.value.invoke(1) } // Test case 4: additional receiver, generic invoke with nullable receiver @@ -68,7 +68,7 @@ class Another5 { fun Another5.main(x: Bar5?) { x?.value {} - x?.value.invoke({}) + x?.value.invoke({}) } // Test case 6: top-level generic invoke @@ -96,7 +96,7 @@ operator fun Foo7.invoke(x: Int) {} fun Another7.main(x: Bar7?) { x?.value(1) - x?.value.invoke(1) + x?.value.invoke(1) } // Test case 8: top-level non-generic invoke @@ -136,5 +136,5 @@ class Another10 { fun Another10.main(x: Bar10?) { x?.value {} - x?.value.invoke({}) + x?.value.invoke({}) } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt index 8b51b8f9b4b..adcc02931d2 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt @@ -7,8 +7,8 @@ fun test(a: A) { (a.x)("") } "".(a.x)() - a.x("") - (a.x)("") + a.x("") + (a.x)("") with("") { a.x() 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 cb712bf11bf..1f172f753b1 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt @@ -14,7 +14,7 @@ class MemberInvokeOwner { class Cls { fun testImplicitReceiver() { - nullableExtensionProperty() + nullableExtensionProperty() } } @@ -30,7 +30,7 @@ fun testNullableReceiver(nullable: Cls?) { } fun testNotNullableReceiver(notNullable: Cls) { - notNullable.nullableExtensionProperty() + notNullable.nullableExtensionProperty() notNullable?.extensionProperty() } @@ -38,6 +38,6 @@ fun testFlexibleReceiver() { val flexible = JavaClass.createFlexible() flexible.extensionProperty() flexible?.extensionProperty() - flexible.nullableExtensionProperty() - flexible?.nullableExtensionProperty() + flexible.nullableExtensionProperty() + flexible?.nullableExtensionProperty() } diff --git a/compiler/testData/diagnostics/tests/safeCall.fir.kt b/compiler/testData/diagnostics/tests/safeCall.fir.kt index e63b91d60df..0fab2d0aaf5 100644 --- a/compiler/testData/diagnostics/tests/safeCall.fir.kt +++ b/compiler/testData/diagnostics/tests/safeCall.fir.kt @@ -1,7 +1,7 @@ // !WITH_NEW_INFERENCE fun f(s: String, action: (String.() -> Unit)?) { - s.foo().bar().action() + s.foo().bar().action() } fun String.foo() = "" @@ -12,4 +12,4 @@ fun String.bar() = "" val functions: Map Any> = TODO() -fun run(name: String) = functions[name]() \ No newline at end of file +fun run(name: String) = functions[name]() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt b/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt index 8e4fd966f51..f818a216e91 100644 --- a/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt +++ b/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.fir.kt @@ -22,9 +22,9 @@ public interface J { // FILE: 1.kt fun test(j: J) { - j.foo({ it checkType { _() }; "" }, "") checkType { _() } + j.foo({ it checkType { _() }; "" }, "") checkType { _() } - j.bas({ it checkType { _() }; "" }, "") checkType { _() } + j.bas({ it checkType { _() }; "" }, "") checkType { _() } // NI: TODO j.bar { it checkType { _() }; "" } checkType { _() } diff --git a/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt b/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt index b2d9a1b570a..98167dcdf5f 100644 --- a/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt +++ b/compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.fir.kt @@ -21,9 +21,9 @@ interface K { } fun test(k: K) { - k.foo { it checkType { _() }; "" } checkType { _() } + k.foo { it checkType { _() }; "" } checkType { _() } - k.bas { it checkType { _() }; "" } checkType { _() } + k.bas { it checkType { _() }; "" } checkType { _() } // NI: TODO k.bar { it checkType { _() }; "" } checkType { _() } diff --git a/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt index 29fc541bfce..eacb222a921 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt @@ -3,7 +3,7 @@ fun foo(): String { var s: String? s = null s?.length - s.length + s.length if (s == null) return s!! var t: String? = "y" if (t == null) t = "x" diff --git a/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOff.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOff.fir.kt index 59df9520ef5..6cc76dce8d8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOff.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOff.fir.kt @@ -13,7 +13,7 @@ fun g(a: SomeClass?) { // 'a' can be cast to SomeSubClass a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo (a as SomeSubClass).foo } val b = (a as? SomeSubClass)?.foo @@ -21,7 +21,7 @@ fun g(a: SomeClass?) { // 'a' can be cast to SomeSubClass a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo (a as SomeSubClass).foo } val c = a as? SomeSubClass @@ -29,7 +29,7 @@ fun g(a: SomeClass?) { // 'a' and 'c' can be cast to SomeSubClass a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo c.hashCode() c.foo } diff --git a/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOn.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOn.fir.kt index dba21c5cad0..0a93220068b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOn.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/castchecks/basicOn.fir.kt @@ -13,7 +13,7 @@ fun g(a: SomeClass?) { // 'a' can be cast to SomeSubClass a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo (a as SomeSubClass).foo } val b = (a as? SomeSubClass)?.foo @@ -21,7 +21,7 @@ fun g(a: SomeClass?) { // 'a' can be cast to SomeSubClass a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo (a as SomeSubClass).foo } val c = a as? SomeSubClass @@ -29,7 +29,7 @@ fun g(a: SomeClass?) { // 'a' and 'c' can be cast to SomeSubClass a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo c.hashCode() c.foo } diff --git a/compiler/testData/diagnostics/tests/smartCasts/castchecks/variables.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/castchecks/variables.fir.kt index 63997330a6c..e4f801c3529 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/castchecks/variables.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/castchecks/variables.fir.kt @@ -18,18 +18,18 @@ fun g(a: SomeClass?) { b = "Hello" if (b != null) { // 'a' cannot be cast to SomeSubClass! - a.hashCode() + a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo (a as SomeSubClass).foo } var c = a as? SomeSubClass c = Impl if (c != null) { // 'a' cannot be cast to SomeSubClass - a.hashCode() + a.hashCode() a.foo - (a as? SomeSubClass).foo + (a as? SomeSubClass).foo c.hashCode() c.foo } @@ -41,18 +41,18 @@ fun f(a: SomeClass?) { if (aa as? SomeSubClass != null) { aa = null // 'aa' cannot be cast to SomeSubClass - aa.hashCode() + aa.hashCode() aa.foo - (aa as? SomeSubClass).foo + (aa as? SomeSubClass).foo (aa as SomeSubClass).foo } val b = (aa as? SomeSubClass)?.foo aa = null if (b != null) { // 'aa' cannot be cast to SomeSubClass - aa.hashCode() + aa.hashCode() aa.foo - (aa as? SomeSubClass).foo + (aa as? SomeSubClass).foo (aa as SomeSubClass).foo } aa = a @@ -61,7 +61,7 @@ fun f(a: SomeClass?) { // 'c' can be cast to SomeSubClass aa.hashCode() aa.foo - (aa as? SomeSubClass).foo + (aa as? SomeSubClass).foo c.hashCode() c.foo } diff --git a/compiler/testData/diagnostics/tests/smartCasts/comparisonUnderAnd.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/comparisonUnderAnd.fir.kt index 62ba2cb3653..0942e634d82 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/comparisonUnderAnd.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/comparisonUnderAnd.fir.kt @@ -6,30 +6,30 @@ fun foo(x : String?, y : String?) { y.length } else { - x.length - y.length + x.length + y.length } if (y != null || x == y) { - x.length - y.length + x.length + y.length } else { // y == null but x != y - x.length - y.length + x.length + y.length } if (y == null && x != y) { // y == null but x != y - x.length - y.length + x.length + y.length } else { - x.length - y.length + x.length + y.length } if (y == null || x != y) { - x.length - y.length + x.length + y.length } else { // Both not null diff --git a/compiler/testData/diagnostics/tests/smartCasts/complexComparison.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/complexComparison.fir.kt index 5ba47dc28b8..a0b569474bb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/complexComparison.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/complexComparison.fir.kt @@ -3,21 +3,21 @@ fun foo(x: String?, y: String?, z: String?, w: String?) { if (x != null && y != null && (x == z || y == z)) z.length else - z.length + z.length if (x != null || y != null || (x != z && y != z)) - z.length + z.length else - z.length + z.length if (x == null || y == null || (x != z && y != z)) - z.length + z.length else z.length if (x != null && y == x && z == y && w == z) w.length else - w.length + w.length if ((x != null && y == x) || (z != null && y == z)) y.length else - y.length + y.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/complexConditionsWithExcl.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/complexConditionsWithExcl.fir.kt index 9ae92c920f7..195b7264fcc 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/complexConditionsWithExcl.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/complexConditionsWithExcl.fir.kt @@ -1,26 +1,26 @@ fun foo(x: String?, y: String?, z: String?) { if ((x!!.hashCode() == 0 || y!!.hashCode() == 1) && z!!.hashCode() == 2) { x.length - y.length + y.length // condition is true => z!! after and is called z.length } else { x.length - y.length - z.length + y.length + z.length } // First element is always analyzed x.length var xx = y ?: z if ((xx!!.hashCode() == 0 && y!!.hashCode() == 1) || z!!.hashCode() == 2) { xx.length - y.length - z.length + y.length + z.length } else { xx.length - y.length + y.length // condition is false => z!! after or is called z.length } @@ -35,16 +35,16 @@ fun foo(x: String?, y: String?, z: String?) { } else { xx.length - y.length - z.length + y.length + z.length } // First element is always analyzed x.length xx = y ?: z if (xx!!.hashCode() == 0 || y!!.hashCode() == 1 || z!!.hashCode() == 2) { xx.length - y.length - z.length + y.length + z.length } else { // all three are called diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.fir.kt index e8d3d7a6e55..a97995bf7b1 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.fir.kt @@ -11,13 +11,13 @@ interface Order { fun foo(o: Any) { val order = o as? Order if (order?.expired ?: false) { - order.doSomething() + order.doSomething() } else { } if (order?.notExpired() ?: false) { - order.doSomething() + order.doSomething() } } @@ -39,12 +39,12 @@ fun bar(o: Any) { fun baz(o: Boolean?) { if (o ?: false) { - o.hashCode() + o.hashCode() } if (o ?: true) { } else { - o.hashCode() + o.hashCode() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOn.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOn.fir.kt index b1b04eac84d..414fb5033f0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOn.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOn.fir.kt @@ -11,13 +11,13 @@ interface Order { fun foo(o: Any) { val order = o as? Order if (order?.expired ?: false) { - order.doSomething() + order.doSomething() } else { } if (order?.notExpired() ?: false) { - order.doSomething() + order.doSomething() } } @@ -39,12 +39,12 @@ fun bar(o: Any) { fun baz(o: Boolean?) { if (o ?: false) { - o.hashCode() + o.hashCode() } if (o ?: true) { } else { - o.hashCode() + o.hashCode() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.fir.kt index 1b9e8c144a2..9f7cab3fbbe 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.fir.kt @@ -1,7 +1,7 @@ // Based on KT-9100 fun test(x: Any?, y: Any?): Any { val z = x ?: y!! - y.hashCode() + y.hashCode() // !! / ?. is necessary here, because y!! above may not be executed y?.hashCode() y!!.hashCode() diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.fir.kt index 646d4e00d2a..6f98ac66762 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.fir.kt @@ -4,7 +4,7 @@ class C { fun test(a: C?, nn: () -> Nothing?) { a ?: nn() - a.foo() + a.foo() a ?: return a.foo() diff --git a/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_after.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_after.fir.kt index 87ce27f6c51..89fe005a236 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_after.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_after.fir.kt @@ -12,7 +12,7 @@ fun printMessages() { Message.HELLO.text!! Message.HELLO.text.length - Message.NOTHING.text.length + Message.NOTHING.text.length Message.NOTHING.text!! Message.NOTHING.text.length diff --git a/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_before.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_before.fir.kt index 89598ff6aff..3279bad6e1c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_before.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/enumEntryMembers_before.fir.kt @@ -12,7 +12,7 @@ fun printMessages() { Message.HELLO.text!! Message.HELLO.text.length - Message.NOTHING.text.length + Message.NOTHING.text.length Message.NOTHING.text!! Message.NOTHING.text.length diff --git a/compiler/testData/diagnostics/tests/smartCasts/exclUnderAnd.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/exclUnderAnd.fir.kt index 8b32be493ca..92375c17b25 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/exclUnderAnd.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/exclUnderAnd.fir.kt @@ -2,12 +2,12 @@ class D(val a: String, val b: Boolean) fun foo(p: Boolean, v: D?): String { if (p && v!!.b) v.a - else v.a + else v.a if (p && v!! == D("?", false)) v.a - else v.a - if (p || v!!.b) v.a + else v.a + if (p || v!!.b) v.a else v.a - if (p || v!! == D("?", false)) v.a + if (p || v!! == D("?", false)) v.a else v.a return "" } diff --git a/compiler/testData/diagnostics/tests/smartCasts/extensionSafeCall.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/extensionSafeCall.fir.kt index 36e4758349e..fe696141e76 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/extensionSafeCall.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/extensionSafeCall.fir.kt @@ -9,5 +9,5 @@ fun T?.let(f: (T) -> Unit) { fun test(your: Your?) { (your?.foo() as? Any)?.let {} // strange smart cast to 'Your' at this point - your.hashCode() + your.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.fir.kt index afb7de85564..ba139fb72fc 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.fir.kt @@ -7,6 +7,6 @@ fun foo() { var y: My? = My(42) if (y!!.x != null) { y = My(null) - y!!.x.hashCode() + y!!.x.hashCode() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/fieldPlus.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/fieldPlus.fir.kt index 1546c9eb824..e0b0a52ecc2 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/fieldPlus.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/fieldPlus.fir.kt @@ -9,6 +9,6 @@ fun foo() { var y: My? = My(42) if (y!!.x != null) { y = My(null) - (y + My(0)).x.hashCode() + (y + My(0)).x.hashCode() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt39010.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt39010.fir.kt index 39ab0627006..e59ff0887e9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt39010.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt39010.fir.kt @@ -5,7 +5,7 @@ class A { class B(var a: A<*>?) { fun bar() { if (a != null) { - a.foo() + a.foo() } } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt index ae481e57005..8bb6ab6a4d0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt @@ -33,6 +33,6 @@ fun test() { x.baz(1).checkType { _() } x.baz(1, 2) - x.foobar().checkType { _() } + x.foobar().checkType { _() } } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt32358_2.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt32358_2.fir.kt index ed37dc9ad77..1ca5c52cac0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt32358_2.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt32358_2.fir.kt @@ -14,7 +14,7 @@ inline fun callItContracted(fn: () -> R): R { fun smartIt(p1: String?, p2: String?) { p1 ?: callIt { return } - p1.length + p1.length p2 ?: callItContracted { return } p2.length diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt32358_3.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt32358_3.fir.kt index 11e7a95bddf..f3e92e052df 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt32358_3.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt32358_3.fir.kt @@ -6,5 +6,5 @@ fun callIt(fn: () -> R): R = TODO() fun smartIt(p1: String?, p2: String?) { p1 ?: callIt { TODO() } - p1.length // smartcast + p1.length // smartcast } diff --git a/compiler/testData/diagnostics/tests/smartCasts/level_1_0.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/level_1_0.fir.kt index 346542ace59..7fd08a927d0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/level_1_0.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/level_1_0.fir.kt @@ -36,7 +36,7 @@ fun kt6840_2(s: String?) { fun kt1635(s: String?) { s?.hashCode()!! - s.hashCode() + s.hashCode() } fun kt2127() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/WhileTrueWithBreakInIfCondition.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/WhileTrueWithBreakInIfCondition.fir.kt index 6845ef8007c..168d317f4f4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/WhileTrueWithBreakInIfCondition.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/WhileTrueWithBreakInIfCondition.fir.kt @@ -9,5 +9,5 @@ fun checkJump(x: Int?, y: Int?) { y.hashCode() } // Smart cast here is erroneous: y is nullable - y.hashCode() + y.hashCode() } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.fir.kt index 9111346bc48..d33da59cc71 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/assignElvisIfBreakInsideWhileTrue.fir.kt @@ -4,8 +4,8 @@ public fun foo(x: String?, y: String?): Int { // z is not null in both branches z.length // y is nullable if x != null - y.length + y.length } // y is null because of the break - return y.length + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.fir.kt index 0b12ef102a4..9ae054e7a89 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/assignWhenInsideWhileTrue.fir.kt @@ -13,5 +13,5 @@ public fun foo(x: String?): Int { checkSubtype(y) } // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.fir.kt index a9e1d123967..5f6a3ef3f84 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakBetweenInsideDoWhile.fir.kt @@ -10,7 +10,7 @@ public fun foo(x: String?, z: String?, w: String?): Int { // w is not null because of w!! w.length // z is nullable despite of z!! - z.length + z.length // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.fir.kt index d1a1765e5c0..91cd9cd460a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakFirstInsideDoWhile.fir.kt @@ -7,7 +7,7 @@ public fun foo(x: String?, z: String?): Int { gav(if (x == null) break else x, z!!) } while (bar()) // z is nullable despite of z!! - z.length + z.length // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.fir.kt index a77c2dcad2a..1c48328167c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakInsideDoWhile.fir.kt @@ -10,5 +10,5 @@ public fun foo(x: String?): Int { } while (bar()) y.hashCode() // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.fir.kt index a7b8ba39bb1..0e7ba8e3c8d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakSecondInsideDoWhile.fir.kt @@ -9,5 +9,5 @@ public fun foo(x: String?, z: String?): Int { // z is not null because of z!! z.length // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.fir.kt index b45f2842eeb..b9bd9023c2f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/callBreakThirdInsideDoWhile.fir.kt @@ -12,5 +12,5 @@ public fun foo(x: String?, z: String?, w: String?): Int { // z is not null because of z!! z.length // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.fir.kt index dea1d2e8b1a..fc422b57203 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.fir.kt @@ -9,5 +9,5 @@ public fun foo(p: String?): Int { p!!.length } while (!x()) // Here we have do while loop but p is still nullable due to break before - return p.length + return p.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt index 5729e3b9e2f..67cac1f788a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt @@ -5,5 +5,5 @@ fun foo(s: String?): Int { if (bar()) break } while (s!!.length > 0) // This call is unsafe due to break - return s.length + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt index 8a5997a41d4..1b666f7e37e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt @@ -6,5 +6,5 @@ public fun foo(p: String?): Int { if (p != null) break } while (!x()) // p can be null despite of the break - return p.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt index 5692b83191a..5bda17d85b3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt @@ -5,5 +5,5 @@ fun foo(s: String?): Int { if (bar()) break } while (s==null) // This call is unsafe due to break - return s.length + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.fir.kt index fdc21aa554b..ee74f603b96 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.fir.kt @@ -6,5 +6,5 @@ public fun foo(x: String?): Int { x.length } while (true) // x is null because of the break - return x.length + return x.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.fir.kt index 0a74bf6f435..0f01873f47a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.fir.kt @@ -2,8 +2,8 @@ public fun foo(x: String?, y: String?): Int { while (true) { x ?: if (y == null) break // y is nullable if x != null - y.length + y.length } // y is null because of the break - return y.length + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt index 7aa1f53bdca..0b4a792714c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt @@ -2,8 +2,8 @@ public fun foo(x: String?, y: String?): Int { while (true) { (if (x != null) break else y) ?: y!! // y is not null in both branches but it's hard to determine - y.length + y.length } // y can be null because of the break - return y.length + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.fir.kt index 48e4c8a2b03..98b61acb518 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.fir.kt @@ -10,5 +10,5 @@ public fun foo(x: String?): Int { } while (bar()) y.hashCode() // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.fir.kt index 241ae124690..ec66a50a872 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideWhileTrue.fir.kt @@ -6,5 +6,5 @@ public fun foo(x: String?): Int { // In future we can infer this initialization y.hashCode() // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.fir.kt index a3220877033..8234f7efc5a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakExprInsideWhileTrue.fir.kt @@ -6,5 +6,5 @@ public fun foo(x: String?): Int { y.length } // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.fir.kt index 5015104c49a..9b7d6777452 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/leftElvisBreakInsideWhileTrue.fir.kt @@ -7,5 +7,5 @@ public fun foo(x: String?, y: String?): Int { y.length } // y is null because of the break - return y.length + return y.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.fir.kt index a2a469d11d5..de8e7ba820a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/nestedLoopsWithLongBreak.fir.kt @@ -13,7 +13,7 @@ public fun foo(p: String?, r: String?, q: String?): Int { if (!x(p)) break } // Long break allows r == null - r.length + r.length // Smart cast is possible q.length return p.length diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.fir.kt index c19bcee7f8c..47c7213a4ff 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/plusAssignWhenInsideDoWhile.fir.kt @@ -18,5 +18,5 @@ public fun foo(x: String?): Int { // y is always Int even here checkSubtype(y) // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.fir.kt index 28f75d8ae24..ce14ee4a22e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whenInsideWhileTrue.fir.kt @@ -8,5 +8,5 @@ public fun foo(x: String?): Int { } } // x is null because of the break - return x.length + return x.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.fir.kt index c52d962227f..6eaa9dce0c5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.fir.kt @@ -5,5 +5,5 @@ fun foo(s: String?): Int { if (bar()) break } // Call is unsafe due to break - return s.length + return s.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt index 641f5dbccf8..292c3289fc8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt @@ -6,5 +6,5 @@ public fun foo(p: String?): Int { if (x()) break } // p is nullable because it's possible loop body is not executed at all - return p.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt index 70958f55081..a8e4f6eaaa4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt @@ -7,5 +7,5 @@ public fun foo(p: String?): Int { if (x()) break } // Smart cast should not work in this case, see KT-6284 - return p.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.fir.kt index 26d79bd116d..f17eb58eed8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.fir.kt @@ -8,5 +8,5 @@ public fun foo(p: String?): Int { p.length } // p can be null because break is earlier than return - return p.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.fir.kt index 08daf2b657e..13bf41a0571 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.fir.kt @@ -7,5 +7,5 @@ public fun foo(p: String?): Int { p!!.length } // Here we have while (true) loop but p is nullable due to break before - return p.length + return p.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt index 6d6c717a1d9..bd00cf67aa3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt @@ -8,7 +8,7 @@ fun foo() { } // TODO: this testdata fixates undesired behavior (it should be an unsafe call) - x.length // 'x' is unsoundly smartcasted here + x.length // 'x' is unsoundly smartcasted here } fun bar() { @@ -19,5 +19,5 @@ fun bar() { } // TODO: this testdata fixates undesired behavior (it should be an unsafe call) - x.size // 'x' is unsoundly smartcasted here + x.size // 'x' is unsoundly smartcasted here } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt index 1af837174c9..bc203cb2564 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt @@ -7,7 +7,7 @@ fun foo() { break } - x.length // 'x' is unsoundly smartcasted here + x.length // 'x' is unsoundly smartcasted here } fun bar() { @@ -17,5 +17,5 @@ fun bar() { break } - x.size // 'x' is unsoundly smartcasted here + x.size // 'x' is unsoundly smartcasted here } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.fir.kt index 9db5e130a9c..a7c686d1143 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/objectLiterals/kt7110.fir.kt @@ -7,5 +7,5 @@ abstract class A(val s: String) { fun foo(o: String?): Int { val a = object : A(o!!){} a.bar() - return o.length + return o.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt index 5011c17372d..bdd8e40e512 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt @@ -2,7 +2,7 @@ sealed class My(open val x: Int?) { init { if (x != null) { // Should be error: property is open - x.hashCode() + x.hashCode() } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.fir.kt index 9059f8bb307..220b5a5acdb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/ownerDeclaresBothModifies.fir.kt @@ -9,5 +9,5 @@ fun foo(arg: Int?) { } if (x != null) x = 42 // Unsafe because of lambda - x.hashCode() + x.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.fir.kt index a6c9e093e31..3283419eeea 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/customGetter.fir.kt @@ -5,7 +5,7 @@ public class X { public fun fn(): Int { if (y != null) // With non-default getter smartcast is not possible - return y.length + return y.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.fir.kt index b0456ab94de..1cd64d4f5e7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.fir.kt @@ -7,5 +7,5 @@ infix fun Int.bar(i: Int) = i fun test() { val p = A() // For open value properties, smart casts should not work - if (p.foo is Int) p.foo bar 11 + if (p.foo is Int) p.foo bar 11 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.fir.kt index e413b118cbf..8b43b66f59c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.fir.kt @@ -4,10 +4,10 @@ public class X { public fun fn(): Int { if (x != null) // Smartcast is not possible for variable properties - return x.length + return x.length else if (y != null) // Even if they are private - return y.length + return y.length else return 0 } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/argument.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/argument.fir.kt index 381263e32e8..a09a86e9b36 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/argument.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/argument.fir.kt @@ -2,5 +2,5 @@ fun calc(x: List?): Int { // After KT-5840 fix !! assertion should become unnecessary here x?.get(x!!.size - 1) // x?. or x!! above should not provide smart cast here - return x.size + return x.size } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/chainMixedUnsafe.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/chainMixedUnsafe.fir.kt index 188d1a4eb5e..626a304de1b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/chainMixedUnsafe.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/chainMixedUnsafe.fir.kt @@ -1,5 +1,5 @@ fun calc(x: List?): Int { // x is not-null only inside subList - x?.subList(0, x.size - 1).get(x.size) + x?.subList(0, x.size - 1).get(x.size) return x!!.size } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.fir.kt index 5590814b6c2..6e579a9c4ed 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/doubleCall.fir.kt @@ -2,5 +2,5 @@ fun calc(x: List?): Int { // x should be non-null in arguments list, including inner call x?.get(x.get(x.size - 1).length) // but not also here! - return x.size + return x.size } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.fir.kt index b1016ada479..b8eb112e3b9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/innerReceiver.fir.kt @@ -4,5 +4,5 @@ fun calc(x: String?, y: String?): Int { // Smart cast because of y!! in receiver x?.subSequence(y!!.subSequence(0, 1).length, y.length) // No smart cast possible - return y.length + return y.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.fir.kt index 4593c469564..f48d7247887 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.fir.kt @@ -10,14 +10,14 @@ fun foo() { } else { s?.length } - ss.hashCode() // Smart-cast to Int, should be unsafe call + ss.hashCode() // Smart-cast to Int, should be unsafe call val sss = if (true) { s?.copy } else { s?.copy } - sss.length + sss.length } class My { @@ -31,13 +31,13 @@ class My { } else { s?.length } - ss.hashCode() + ss.hashCode() val sss = if (true) { s?.copy2 } else { s?.copy2 } - sss.length + sss.length } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt index f5f30b02038..89fa1a6820f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt @@ -4,9 +4,9 @@ class Foo(val bar: String) fun test(foo: Foo?) { foo?.bar.let { // Error, foo?.bar is nullable - it.length + it.length // Error, foo is nullable - foo.bar.length + foo.bar.length // Correct foo?.bar?.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverInLongChain.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverInLongChain.fir.kt index ecc2789719d..eac3fe6a690 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverInLongChain.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverInLongChain.fir.kt @@ -11,22 +11,22 @@ fun String.notNullLet(f: (String) -> Unit) = f(this) fun test(foo: Foo?) { foo?.bar?.gav.let { // Error, foo?.bar?.gav is nullable - it.length + it.length // Error, foo is nullable - foo.bar.gav.length + foo.bar.gav.length // Correct foo?.bar?.gav?.length } foo?.bar?.gav.call { it }?.notNullLet { - foo.hashCode() - foo.bar.hashCode() + foo.hashCode() + foo.bar.hashCode() } } fun testNotNull(foo: Foo) { val s: String? = "" foo.baz(s!!)?.gav.let { - it.length + it.length // Ok because of foo. s.length.hashCode() } @@ -35,7 +35,7 @@ fun testNotNull(foo: Foo) { fun testNullable(foo: Foo?) { val s: String? = "" foo?.baz(s!!)?.gav.let { - it.length + it.length // Ok because of foo?. s?.length?.hashCode() } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.fir.kt index 0743b51b49d..6c6b3d7b15e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.fir.kt @@ -16,7 +16,7 @@ fun test() { val foo = Foo.create(null) foo?.bar.let { // Error, foo?.bar is nullable - it.length + it.length // Foo is nullable but flexible, so call is considered safe here foo.bar.length // Correct diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.fir.kt index 3294fdd5dc8..0aba569f424 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.fir.kt @@ -18,7 +18,7 @@ fun kt6840_2(s: String?) { fun kt1635(s: String?) { s?.hashCode()!! - s.hashCode() + s.hashCode() } fun kt2127() { @@ -80,7 +80,7 @@ fun useA(a: A): Int = a.hashCode() fun kt7491_2() { val a = getA() - (a?.let { useA(a) } ?: a.y ).toString() + (a?.let { useA(a) } ?: a.y ).toString() } fun String.correct() = true @@ -88,7 +88,7 @@ fun String.correct() = true fun kt8492(s: String?) { if (s?.correct() ?: false) { // To be supported - s.length + s.length } } @@ -118,7 +118,7 @@ class Wrapper { fun falsePositive(w: Wrapper) { if (w.unwrap() != null) { // Here we should NOT have smart cast - w.unwrap().length + w.unwrap().length } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/simple.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/simple.fir.kt index 31d8b7c2458..f46376751e0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/simple.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/simple.fir.kt @@ -2,5 +2,5 @@ fun calc(x: List?): Int { // x should be non-null in arguments list x?.get(x.size - 1) // but not also here! - return x.size + return x.size } diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/twoArgs.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/twoArgs.fir.kt index 7017e9b2446..0a7578ac04c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/twoArgs.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/twoArgs.fir.kt @@ -2,5 +2,5 @@ fun calc(x: List?): Int { // x should be non-null in arguments list x?.subList(x.size - 1, x.size) // but not also here! - return x.size + return x.size } diff --git a/compiler/testData/diagnostics/tests/smartCasts/smartCastOnWhen.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/smartCastOnWhen.fir.kt index 21e5d618786..956fddab24d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/smartCastOnWhen.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/smartCastOnWhen.fir.kt @@ -15,6 +15,6 @@ fun bar(): Int { return when(ss) { "abc" -> ss else -> "xyz" - }.length + }.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.fir.kt index 464e07a5964..5d103f9d0d6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.fir.kt @@ -5,7 +5,7 @@ class A(val x: String?) { fun foo(other: A) { when { x == null && other.x == null -> "1" - x.length > 0 -> "2" + x.length > 0 -> "2" } } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.fir.kt index 98563e4ea6c..ac6ba703d48 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.fir.kt @@ -3,15 +3,15 @@ class Foo(var x: Int?) { if (x != null) { val y = x // Error: x is not stable, Type(y) = Int? - x.hashCode() - y.hashCode() + x.hashCode() + y.hashCode() if (y == x) { // Still error - y.hashCode() + y.hashCode() } if (x == null && y != x) { // Still error - y.hashCode() + y.hashCode() } } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.fir.kt index d7c52abd0f1..fe3bf6d9c91 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/variables/lambdaBetweenArguments.fir.kt @@ -6,5 +6,5 @@ fun foo(x: Int, f: () -> Unit, y: Int) {} fun bar() { var x: Int? x = 4 - foo(x, { x = null; x.hashCode() }, x) + foo(x, { x = null; x.hashCode() }, x) } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.fir.kt index 0dce64de076..8ec130dfe67 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/assignment.fir.kt @@ -1,11 +1,11 @@ // !WITH_NEW_INFERENCE fun foo() { var v: String? = null - v.length + v.length v = "abc" v.length v = null - v.length + v.length v = "abc" v.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/boundInitializerWrong.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/boundInitializerWrong.fir.kt index d424d141dd5..0c7204ecaa3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/boundInitializerWrong.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/boundInitializerWrong.fir.kt @@ -23,7 +23,7 @@ fun bar(s: String?) { val hashCode = ss?.hashCode() ss = null if (hashCode != null) { - ss.hashCode() + ss.hashCode() } } @@ -41,6 +41,6 @@ fun baz(arg: Some?) { val ss = arg?.s if (ss != null) { arg.hashCode() - arg.s.hashCode() + arg.s.hashCode() } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.fir.kt index 0735df90d8d..8d988515094 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initInTryReturnInCatch.fir.kt @@ -37,7 +37,7 @@ fun test3() { catch (e: B) { return } - a.hashCode() // a is nullable here + a.hashCode() // a is nullable here } fun test4() { var a: Int? = null @@ -50,7 +50,7 @@ fun test4() { catch (e: B) { return } - a.hashCode() // a is nullable here + a.hashCode() // a is nullable here } fun test5() { var a: Int?// = null @@ -76,5 +76,5 @@ fun test6() { finally { a = null } - a.hashCode() // a is null here + a.hashCode() // a is null here } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt index 430868a8b0c..e2f610bd2ea 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt @@ -2,7 +2,7 @@ fun foo() { var v: String? = "xyz" // It is possible in principle to provide smart cast here - v.length + v.length v = null - v.length + v.length } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedWhile.fir.kt index 828d2c611d1..2e72334ca0b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedWhile.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/nestedWhile.fir.kt @@ -12,7 +12,7 @@ fun foo(): Bar { var y: Bar? = Bar() while (x != null) { // Here call is unsafe because of initialization and also inner loop - y.next() + y.next() while (y != null) { if (x == y) // x is not null because of outer while diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt index 1cfb9d42787..6990adf9fa8 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/plusplusMinusminus.fir.kt @@ -12,7 +12,7 @@ operator fun Long?.inc() = this?.let { it + 1 } fun bar(arg: Long?): Long { var i = arg if (i++ == 5L) { - return i-- + i + return i-- + i } if (i++ == 7L) { return i++ + i diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.fir.kt index 6dbcb1dd091..596ca003a75 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.fir.kt @@ -3,6 +3,6 @@ operator fun Int?.inc(): Int? { return this } public fun box(arg: Int?) : Int? { var i : Int? = arg var j = i++ - j.toInt() + j.toInt() return i } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt index a01f7ac8164..1a85571d761 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt @@ -9,5 +9,5 @@ public fun box() { // type of j should be MyClass? var j = ++i // j is null so call should be unsafe - j.hashCode() + j.hashCode() } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt index 25f99500d48..9288f78fe11 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt @@ -3,6 +3,6 @@ operator fun Int?.inc(): Int? { return this } public fun box(arg: Int?) : Int? { var i = arg var j = ++i - j.toInt() + j.toInt() return ++j } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt index b80a9706116..55e0426d009 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt @@ -10,5 +10,5 @@ fun foo() { } catch (ex: Exception) {} bar(s) if (s != null) { } - s.hashCode() + s.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt index 3a1e43458db..07519649c8c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt @@ -6,5 +6,5 @@ fun foo() { try { s = null } catch (ex: Exception) {} - s.hashCode() + s.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt index ed810c42613..52ed2372cd6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt @@ -12,5 +12,5 @@ fun foo() { finally { bar() } - s.hashCode() + s.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryUnsound.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryUnsound.fir.kt index 95d50e9267d..faa6fb418dd 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryUnsound.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryUnsound.fir.kt @@ -6,5 +6,5 @@ fun foo() { try { s = null } catch (ex: Exception) {} - s.hashCode() + s.hashCode() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.fir.kt index cf186a5270e..e7d39fb3d7d 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/unnecessaryWithMap.fir.kt @@ -14,7 +14,7 @@ class MyClass { var res = 0 m = create() // See KT-7428 - for ((k, v) in m) + for ((k, v) in m) res += (k.length + v.length) return res } diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.fir.kt index e70c299a0d1..050f108d5fc 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.fir.kt @@ -2,5 +2,5 @@ fun foo(): Int { var s: String? = "abc" s = null - return s.length + return s.length } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.fir.kt index 65a01fde9de..d939f5286e1 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.fir.kt @@ -1,7 +1,7 @@ // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { - javaClass.getSomething().length - javaClass.something.length + javaClass.getSomething().length + javaClass.something.length } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt index bdf5d30e43e..62dbadb3447 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt @@ -1,7 +1,7 @@ // FILE: KotlinFile.kt fun foo(javaInterface: JavaInterface) { val value = javaInterface.compute { "" } - value.length + value.length } // FILE: JavaInterface.java diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.fir.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.fir.kt index de1fde585d4..225842d3c4c 100644 --- a/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.fir.kt +++ b/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.fir.kt @@ -36,6 +36,6 @@ fun foo(x: Iterator, y: Iterator) { x.forEachRemaining { it -> it.length } x.forEachRemaining { it -> it?.length } - y.forEachRemaining { it -> it.length } + y.forEachRemaining { it -> it.length } y.forEachRemaining { it -> it?.length } } diff --git a/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt b/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt index bba63299a6f..2e099e73d93 100644 --- a/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt +++ b/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt @@ -7,7 +7,7 @@ interface A : MutableCollection { } fun foo(x: MutableCollection, y: Collection, z: A) { - x.nonExistingMethod(1).checkType { _() } + x.nonExistingMethod(1).checkType { _() } y.nonExistingMethod("") z.nonExistingMethod("") } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt index 7b1e8c134a6..0a5a18e0526 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/inferenceForSignedAndUnsignedTypes.fir.kt @@ -14,7 +14,7 @@ fun foo() { takeUByte(id(1)) 1 + 1u - (1u + 1) checkType { _() } + (1u + 1) checkType { _() } id(1) } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt index 4b5009d5183..135d3bc7ec1 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/overloadResolutionForSignedAndUnsignedTypes.fir.kt @@ -21,7 +21,7 @@ fun test() { foo(1) checkType { _() } foo(1u) checkType { _() } - foo(2147483648) checkType { _() } + foo(2147483648) checkType { _() } foo(2147483647 + 1) checkType { _() } fooByte(1) checkType { _() } diff --git a/compiler/testData/diagnostics/tests/when/withSubjectVariable/capturingInInitializer.fir.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/capturingInInitializer.fir.kt index d8ed1e80497..ff3ca7cb0a5 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/capturingInInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/capturingInInitializer.fir.kt @@ -27,11 +27,11 @@ fun testUnsafeCaptureVarInInitializer() { val s = when (val y = run { x = null; 32 }) { 0 -> { - x.inc() // NB smart cast should be impossible + x.inc() // NB smart cast should be impossible "0" } else -> "!= 0" } - x.inc() // NB smart cast should be impossible + x.inc() // NB smart cast should be impossible } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/when/withSubjectVariable/jumpoutInInitializer.fir.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/jumpoutInInitializer.fir.kt index e6b6b7894f2..22d8bec9894 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/jumpoutInInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/jumpoutInInitializer.fir.kt @@ -12,7 +12,7 @@ fun testJumpOutInElvis(x: Int?) { x.inc() } - x.inc() + x.inc() } fun testJumpOutInElvisLikeIf(x: Int?) { @@ -24,7 +24,7 @@ fun testJumpOutInElvisLikeIf(x: Int?) { x.inc() } - x.inc() + x.inc() } @@ -36,7 +36,7 @@ fun testJumpOutInIf(x: Int?) { 0 -> "0" else -> "not 0" } - x.inc() + x.inc() } x.inc() // Actually, safe, but it's OK if it's error diff --git a/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.fir.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.fir.kt index c93e8c1f329..c68e4f16a15 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.fir.kt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartCastOnValueBoundToSubjectVariable.fir.kt @@ -18,8 +18,8 @@ fun test2(x: String?) { fun test3(x: String?, y: String?) { when (val z = x ?: y!!) { - "foo" -> x.length - "bar" -> y.length + "foo" -> x.length + "bar" -> y.length "baz" -> z.length } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.fir.kt index 443bdf08694..7d77791f6e6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.fir.kt @@ -3,7 +3,7 @@ fun testIsNullOrBlank(x: String?) { if (x.isNullOrBlank()) { - x.length + x.length } else { x.length @@ -15,6 +15,6 @@ fun testIsNotNullOrBlank(x: String?) { x.length } - x.length + x.length } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.fir.kt index c096243d0a9..5b942185d8c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.fir.kt @@ -3,7 +3,7 @@ fun testIsNullOrEmpty(x: String?) { if (x.isNullOrEmpty()) { - x.length + x.length } else { x.length @@ -15,6 +15,6 @@ fun testIsNotNullOrEmpty(x: String?) { x.length } - x.length + x.length } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver.fir.kt index c1f71e56f15..1a09ae91bb5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver.fir.kt @@ -17,7 +17,7 @@ fun CharSequence?.isNullOrEmpty(): Boolean { fun smartcastOnReceiver(s: String?) { with(s) { if (isNullOrEmpty()) { - length + length } else { length @@ -32,7 +32,7 @@ fun mixedReceiver(s: String?) { } } else { with(s) { - length + length } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver_after.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver_after.fir.kt index d82ea265323..3037bd6a083 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver_after.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/extensionReceiver_after.fir.kt @@ -17,7 +17,7 @@ fun CharSequence?.isNullOrEmpty(): Boolean { fun smartcastOnReceiver(s: String?) { with(s) { if (isNullOrEmpty()) { - length + length } else { length @@ -32,7 +32,7 @@ fun mixedReceiver(s: String?) { } } else { with(s) { - length + length } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.fir.kt index 1942a197c38..4afb690ba1c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.fir.kt @@ -14,7 +14,7 @@ fun nullWhenNull(x: Int?): Int? { fun testNullWhenNull(x: Int?) { if (nullWhenNull(x) == null) { - x.dec() + x.dec() } else { x.dec() @@ -24,10 +24,10 @@ fun testNullWhenNull(x: Int?) { x.dec() } else { - x.dec() + x.dec() } - x.dec() + x.dec() } // NB. it is the same function as `nullWhenNull`, but annotations specifies other facet of the function behaviour @@ -43,15 +43,15 @@ fun testNotNullWhenNotNull (x: Int?) { x == null } else { - x.dec() + x.dec() } if (notNullWhenNotNull(x) != null) { - x.dec() + x.dec() } else { x == null } - x.dec() + x.dec() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.fir.kt index 56fd68cd5e6..cd49f2c178e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.fir.kt @@ -20,28 +20,28 @@ fun myEqualsNotNull(x: Int?): Boolean { } fun testBasicEquals(x: Int?) { - x.inc() + x.inc() if (myEqualsNull(x)) { - x.inc() + x.inc() } else { x.inc() } - x.inc() + x.inc() } fun testBasicNotEquals(x: Int?) { - x.inc() + x.inc() if (myEqualsNotNull(x)) { x.inc() } else { - x.inc() + x.inc() } - x.inc() + x.inc() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.fir.kt index de76d236c58..31e6a20b5c8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.fir.kt @@ -14,7 +14,7 @@ fun Any?.isNull(): Boolean { fun smartcastOnReceiver(x: Int?) { if (x.isNull()) { - x.inc() + x.inc() } else { x.dec() @@ -26,10 +26,10 @@ class UnstableReceiver { fun smartcastOnUnstableReceiver() { if (x.isNull()) { - x.inc() + x.inc() } else { - x.dec() + x.dec() } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/valueOfContractedFunctionIngored.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/valueOfContractedFunctionIngored.fir.kt index 00937d84442..d4cd0aca299 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/valueOfContractedFunctionIngored.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/valueOfContractedFunctionIngored.fir.kt @@ -6,6 +6,6 @@ import kotlin.contracts.* fun f3(value: String?) { if (!value.isNullOrEmpty() is Boolean) { - value.length + value.length } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.fir.kt index 120c8563911..934c889f46f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.fir.kt @@ -1,6 +1,6 @@ val foo = iterator { yield(0) val nullable: String? = null - nullable.length - nullable.get(2) + nullable.length + nullable.get(2) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt index 31050be60fe..f03df720e81 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt @@ -87,7 +87,7 @@ fun test() { this@with.yield("") yield2("") - this@with.yield2("") + this@with.yield2("") } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt index 428d894df0c..b7aee9d5815 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samAgainstFunctionalType.fir.kt @@ -24,7 +24,7 @@ public class StaticOverrides { // FILE: test.kt fun test() { - StaticOverrides.A.foo {} checkType { _() } + StaticOverrides.A.foo {} checkType { _() } StaticOverrides.B.foo {} checkType { _() } - StaticOverrides.C.foo {} checkType { _() } + StaticOverrides.C.foo {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt index 05a5ed0f4c9..c1213130ee4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenerics.fir.kt @@ -20,6 +20,6 @@ class Foo { // FILE: 1.kt fun test() { - Foo().foo {} checkType { _() } - Foo().bar {} checkType { _() } + Foo().foo {} checkType { _() } + Foo().bar {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt index 2d46f94bee1..212fdae2be1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithGenericsWithoutRefinedSams.fir.kt @@ -21,6 +21,6 @@ class Foo { // FILE: 1.kt fun test() { - Foo().foo {} checkType { _() } - Foo().bar {} checkType { _() } + Foo().foo {} checkType { _() } + Foo().bar {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt index 377b771ff37..ea440852beb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunction.fir.kt @@ -16,5 +16,5 @@ public class Foo { // FILE: 1.kt fun bar() { - Foo().test {} checkType { _() } + Foo().test {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt index 9d5f49b6125..aa41c361a98 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/resolve/samOverloadsWithKtFunctionWithoutRefinedSams.fir.kt @@ -18,5 +18,5 @@ public class Foo { // FILE: 1.kt fun bar() { - Foo().test {} checkType { _() } + Foo().test {} checkType { _() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.fir.kt index 529c3172b29..ca9ee064daa 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.fir.kt @@ -3,5 +3,5 @@ fun foo(y: String?) { var x: String? = null y?.let { x = it } - x.length // Smart cast is not possible + x.length // Smart cast is not possible } diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.fir.kt index ddee7e5b9df..71076c521c4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.fir.kt @@ -5,7 +5,7 @@ fun bar(z: String?) = z fun foo(y: String?) { var x: String? = "" if (x != null) { - bar(y?.let { x = null; it }).length + bar(y?.let { x = null; it }).length x.length // Smart cast is not possible } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.fir.kt index 5c2c0ec8e0d..8e41c4cccbe 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/withChangesToNull.fir.kt @@ -2,7 +2,7 @@ fun foo(y: String?) { var x: String? = "" if (x != null) { with(y?.let { x = null; it }) { - this.length + this.length x.length } x.length diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.fir.kt index beee087680e..6198ffd2694 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/assignTry.fir.kt @@ -15,7 +15,7 @@ fun test2() { catch (e: ExcB) { 10 } - s.length + s.length } fun test3() { @@ -28,7 +28,7 @@ fun test3() { catch (e: ExcB) { return } - s.length + s.length } fun test4() { @@ -41,7 +41,7 @@ fun test4() { finally { "" } - s.length + s.length } fun test5() { @@ -54,7 +54,7 @@ fun test5() { finally { return } - s.length + s.length } fun test6() { @@ -67,7 +67,7 @@ fun test6() { catch (e: ExcB) { return } - s.length + s.length } fun test7() { @@ -80,7 +80,7 @@ fun test7() { catch (e: ExcB) { "" } - s.length + s.length } fun test8() { @@ -89,7 +89,7 @@ fun test8() { } catch (e: ExcA) { null } - s.length + s.length } fun test9() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/boundedSmartcasts.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/boundedSmartcasts.fir.kt index d7030617a16..1e3d0b9beea 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/boundedSmartcasts.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/boundedSmartcasts.fir.kt @@ -13,11 +13,11 @@ fun test0(x: Int?) { if (x != null) { x.inc() - y.inc() + y.inc() } if (y != null) { - x.inc() + x.inc() y.inc() } } @@ -32,11 +32,11 @@ fun test1(x: Int?) { if (x != null) { x.inc() - y.inc() + y.inc() } if (y != null) { - x.inc() + x.inc() y.inc() } } @@ -51,11 +51,11 @@ fun test2(x: Int?) { if (x != null) { x.inc() - y.inc() + y.inc() } if (y != null) { - x.inc() + x.inc() y.inc() } } @@ -69,11 +69,11 @@ fun test3(x: Int?) { if (x != null) { x.inc() - y.inc() + y.inc() } if (y != null) { - x.inc() + x.inc() y.inc() } } @@ -91,11 +91,11 @@ fun test5(x: Int?) { if (x != null) { x.inc() - y.inc() + y.inc() } if (y != null) { - x.inc() + x.inc() y.inc() } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts.fir.kt index b24665e36d8..e4d02ce214a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts.fir.kt @@ -15,8 +15,8 @@ fun test1(s: String?) { catch (e: Exception) { requireNotNull(s) } - t2.not() - s.length + t2.not() + s.length } } @@ -74,7 +74,7 @@ fun test5(s: String?) { catch (e: ExcB) { } - s.length + s.length } fun test6(s: String?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts_after.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts_after.fir.kt index 48729b80495..252ab90a563 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts_after.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/correctSmartcasts_after.fir.kt @@ -16,8 +16,8 @@ fun test1(s: String?) { catch (e: Exception) { requireNotNull(s) } - t2.not() - s.length + t2.not() + s.length } } @@ -75,7 +75,7 @@ fun test5(s: String?) { catch (e: ExcB) { } - s.length + s.length } fun test6(s: String?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts.fir.kt index 156ddc884e2..5d3b627ae11 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts.fir.kt @@ -13,15 +13,15 @@ fun test1() { try { x = null } catch (e: Exception) { - x.length // smartcast shouldn't be allowed (OOME could happen after `x = null`) + x.length // smartcast shouldn't be allowed (OOME could happen after `x = null`) throw e } finally { // smartcast shouldn't be allowed, `x = null` could've happened - x.length + x.length } // smartcast shouldn't be allowed, `x = null` could've happened - x.length + x.length } // With old DFA of try/catch info about unsound smartcasts after try @@ -33,12 +33,12 @@ fun test2() { try { x = null } catch (e: Exception) { - x.length + x.length } finally { - x.length + x.length } - x.length + x.length } fun test3() { @@ -49,7 +49,7 @@ fun test3() { } catch (e: Exception) { t2 = null } - t2.not() // wrong smartcast, NPE + t2.not() // wrong smartcast, NPE } } @@ -59,7 +59,7 @@ fun test4() { try { t2 = null } finally { } - t2.not() // wrong smartcast, NPE + t2.not() // wrong smartcast, NPE } } @@ -80,10 +80,10 @@ fun test5() { } finally { s1.length - s2.length + s2.length } s1.length - s2.length + s2.length } fun test6(s1: String?, s2: String?) { @@ -97,10 +97,10 @@ fun test6(s1: String?, s2: String?) { return } finally { - s.length + s.length requireNotNull(s2) } - s.length - s1.length + s.length + s1.length s2.length } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts_after.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts_after.fir.kt index 98aad3f98f6..3458df14c11 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts_after.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/tryCatch/falsePositiveSmartcasts_after.fir.kt @@ -14,15 +14,15 @@ fun test1() { try { x = null } catch (e: Exception) { - x.length // smartcast shouldn't be allowed (OOME could happen after `x = null`) + x.length // smartcast shouldn't be allowed (OOME could happen after `x = null`) throw e } finally { // smartcast shouldn't be allowed, `x = null` could've happened - x.length + x.length } // smartcast shouldn't be allowed, `x = null` could've happened - x.length + x.length } // With old DFA of try/catch info about unsound smartcasts after try @@ -35,12 +35,12 @@ fun test2() { x = null } catch (e: Exception) { // BAD - x.length + x.length } finally { - x.length + x.length } - x.length + x.length } fun test3() { @@ -51,7 +51,7 @@ fun test3() { } catch (e: Exception) { t2 = null } - t2.not() // wrong smartcast, NPE + t2.not() // wrong smartcast, NPE } } @@ -61,7 +61,7 @@ fun test4() { try { t2 = null } finally { } - t2.not() // wrong smartcast, NPE + t2.not() // wrong smartcast, NPE } } @@ -82,10 +82,10 @@ fun test5() { } finally { s1.length - s2.length + s2.length } s1.length - s2.length + s2.length } fun test6(s1: String?, s2: String?) { @@ -99,10 +99,10 @@ fun test6(s1: String?, s2: String?) { return } finally { - s.length + s.length requireNotNull(s2) } - s.length - s1.length + s.length + s1.length s2.length } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt index 0a202b59a59..a3625e548ac 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt @@ -105,8 +105,8 @@ fun case_6() { checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt index 393c857b1c3..b3aa065eae3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt @@ -3,23 +3,23 @@ // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(-9223372036854775808L) - -9223372036854775808L checkType { check() } + -9223372036854775808L checkType { check() } checkSubtype(9223372036854775808L) - 9223372036854775808L checkType { check() } + 9223372036854775808L checkType { check() } } // TESTCASE NUMBER: 2 fun case_2() { checkSubtype(100000000000000000000000000000000L) - 100000000000000000000000000000000L checkType { check() } + 100000000000000000000000000000000L checkType { check() } checkSubtype(100000000000000000000000000000000l) - 100000000000000000000000000000000l checkType { check() } + 100000000000000000000000000000000l checkType { check() } checkSubtype(-100000000000000000000000000000000L) - -100000000000000000000000000000000L checkType { check() } + -100000000000000000000000000000000L checkType { check() } checkSubtype(-100000000000000000000000000000000l) - -100000000000000000000000000000000l checkType { check() } + -100000000000000000000000000000000l checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt index 3babe3d0231..fff37ca63ee 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.fir.kt @@ -15,7 +15,7 @@ class A() { fun case1() { var b: Case1? = Case1() - --b?.a + --b?.a } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt index 3f904e182b0..1b263ccaed0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-increment-expression/p-4/neg/1.1.fir.kt @@ -15,7 +15,7 @@ class A() { fun case1() { var b: Case1? = Case1() - ++b?.a + ++b?.a } diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt index 73c59e02d34..476e7e2e0c2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-named-parameters/p-1/pos/2.1.fir.kt @@ -63,7 +63,7 @@ fun case3() { */ fun case4(marker : Marker?) { marker?.foo(y=1) - marker?.foo(x=1)> + marker?.foo(x=1)> } diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt index 56f53ebd7cb..5f9b80e065f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/call-with-trailing-lambda-expressions/p-1/pos/2.1.fir.kt @@ -63,7 +63,7 @@ fun case3() { */ fun case4(marker: Marker?) { marker?.foo(y = { 1 }) - marker?.foo(x = { 1 })> + marker?.foo(x = { 1 })> } diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt index 9767efa112e..7e1ff9cfa3d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt @@ -8,7 +8,7 @@ */ fun case1() { val x : Case1? = Case1() - x.x = "0" + x.x = "0" x?.x = "0" x::x = TODO() } @@ -24,7 +24,7 @@ class Case1{ */ fun case2() { val x : Case2? = Case2(null) - x.x = "0" + x.x = "0" x?.x = "0" x::x = TODO() } @@ -37,7 +37,7 @@ class Case2(val x: Any?) {} */ fun case3() { val x : Case3? = Case3() - x.x = "0" + x.x = "0" x?.x = "0" x::x = TODO() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt index ce3f5513e8d..c5adafadcdf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt @@ -46,7 +46,7 @@ fun case_1(value_1: Int?) { if (contracts.case_1(value_1) { value_2 = 10 }) { println(value_2) } else { - value_1.inv() + value_1.inv() println(value_2) } } @@ -58,8 +58,8 @@ fun case_2(value_1: Int?, value_2: Int?, value_3: Any?) { true -> { println(value_3?.xor(true)) println(value_4) - println(value_1.inv()) - println(value_2.inv()) + println(value_1.inv()) + println(value_2.inv()) } false -> { println(value_4) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt index a22b50b0e3f..15ee30d4812 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.fir.kt @@ -11,13 +11,13 @@ fun case_1(value_1: Any?) { // TESTCASE NUMBER: 2 fun case_2(value_1: Int?) { funWithReturnsAndInvertCondition(value_1 != null) - println(value_1.inc()) + println(value_1.inc()) } // TESTCASE NUMBER: 3 fun case_3(value_1: Int?) { funWithReturns(value_1 == null) - println(value_1.inc()) + println(value_1.inc()) } // TESTCASE NUMBER: 4 @@ -29,13 +29,13 @@ fun case_4(value_1: Any?) { // TESTCASE NUMBER: 5 fun case_5(value_1: String?) { funWithReturnsAndNullCheck(value_1) - println(value_1.length) + println(value_1.length) } // TESTCASE NUMBER: 6 fun case_6(value_1: String?) { funWithReturnsAndNullCheck(value_1) - println(value_1.length) + println(value_1.length) } // TESTCASE NUMBER: 7 @@ -44,7 +44,7 @@ object case_7_object { } fun case_7() { funWithReturns(case_7_object.prop_1 == null) - case_7_object.prop_1.inc() + case_7_object.prop_1.inc() } // TESTCASE NUMBER: 8 @@ -61,14 +61,14 @@ fun case_8(value_1: Any?) { // TESTCASE NUMBER: 9 fun case_9(value_1: String?) { - if (!funWithReturnsTrue(value_1 != null)) println(value_1.length) - if (!funWithReturnsTrueAndInvertCondition(value_1 == null)) println(value_1.length) - if (funWithReturnsFalse(value_1 != null)) println(value_1.length) - if (funWithReturnsFalseAndInvertCondition(value_1 == null)) println(value_1.length) - if (funWithReturnsNotNull(value_1 != null) == null) println(value_1.length) - if (funWithReturnsNotNullAndInvertCondition(value_1 == null) == null) println(value_1.length) - if (funWithReturnsNull(value_1 != null) != null) println(value_1.length) - if (funWithReturnsNullAndInvertCondition(value_1 == null) != null) println(value_1.length) + if (!funWithReturnsTrue(value_1 != null)) println(value_1.length) + if (!funWithReturnsTrueAndInvertCondition(value_1 == null)) println(value_1.length) + if (funWithReturnsFalse(value_1 != null)) println(value_1.length) + if (funWithReturnsFalseAndInvertCondition(value_1 == null)) println(value_1.length) + if (funWithReturnsNotNull(value_1 != null) == null) println(value_1.length) + if (funWithReturnsNotNullAndInvertCondition(value_1 == null) == null) println(value_1.length) + if (funWithReturnsNull(value_1 != null) != null) println(value_1.length) + if (funWithReturnsNullAndInvertCondition(value_1 == null) != null) println(value_1.length) } // TESTCASE NUMBER: 10 @@ -83,14 +83,14 @@ fun case_10(value_1: Any?) { // TESTCASE NUMBER: 11 fun case_11(value_1: Number?) { - if (!funWithReturnsTrueAndNotNullCheck(value_1)) println(value_1.toByte()) + if (!funWithReturnsTrueAndNotNullCheck(value_1)) println(value_1.toByte()) if (!funWithReturnsTrueAndNullCheck(value_1)) println(value_1) - if (funWithReturnsFalseAndNotNullCheck(value_1)) println(value_1.toByte()) + if (funWithReturnsFalseAndNotNullCheck(value_1)) println(value_1.toByte()) if (funWithReturnsFalseAndNullCheck(value_1)) println(value_1) - if ((funWithReturnsNotNullAndNotNullCheck(value_1) == null)) println(value_1.toByte()) - if (!!!(funWithReturnsNotNullAndNotNullCheck(value_1) != null)) println(value_1.toByte()) + if ((funWithReturnsNotNullAndNotNullCheck(value_1) == null)) println(value_1.toByte()) + if (!!!(funWithReturnsNotNullAndNotNullCheck(value_1) != null)) println(value_1.toByte()) if (!!(funWithReturnsNotNullAndNullCheck(value_1) == null)) println(value_1) - if (!(funWithReturnsNullAndNotNullCheck(value_1) == null)) println(value_1.toByte()) - if (!!(funWithReturnsNullAndNotNullCheck(value_1) != null)) println(value_1.toByte()) + if (!(funWithReturnsNullAndNotNullCheck(value_1) == null)) println(value_1.toByte()) + if (!!(funWithReturnsNullAndNotNullCheck(value_1) != null)) println(value_1.toByte()) if (!!!(funWithReturnsNullAndNullCheck(value_1) == null)) println(value_1) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt index 7a69a61bd98..f621ad1346d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.fir.kt @@ -213,7 +213,7 @@ fun case_2(value_1: Any?) { // TESTCASE NUMBER: 3 fun case_3(number: Int?) { - if (!funWithReturnsTrueAndNullCheck(number)) number.inc() + if (!funWithReturnsTrueAndNullCheck(number)) number.inc() } // TESTCASE NUMBER: 4 @@ -250,8 +250,8 @@ fun case_8(value_1: Any?) { // TESTCASE NUMBER: 9 fun case_9(value_1: Number?) { - if (!funWithReturnsTrueAndNullCheck(value_1)) println(value_1.toByte()) - if (funWithReturnsFalseAndNullCheck(value_1)) println(value_1.toByte()) + if (!funWithReturnsTrueAndNullCheck(value_1)) println(value_1.toByte()) + if (funWithReturnsFalseAndNullCheck(value_1)) println(value_1.toByte()) if (funWithReturnsFalseAndNotNullCheck(value_1)) println(value_1) if (!(funWithReturnsNotNullAndNullCheck(value_1) != null)) println(value_1) if (!(funWithReturnsNullAndNullCheck(value_1) == null)) println(value_1) @@ -458,9 +458,9 @@ fun case_19(value_1: Number) { // TESTCASE NUMBER: 20 fun case_20(value_1: String?, value_2: String?, value_3: String?, value_4: String?) { if (!value_1.case_20_1()) println(value_1) - if (!value_2.case_20_2()) println(value_2.length) + if (!value_2.case_20_2()) println(value_2.length) when (value_3.case_20_3()) { - true -> println(value_4.length) + true -> println(value_4.length) false -> println(value_3) } } @@ -468,13 +468,13 @@ fun case_20(value_1: String?, value_2: String?, value_3: String?, value_4: Strin // TESTCASE NUMBER: 21 fun case_21(value_1: String?) { when { !value_1.case_21_1() -> println(value_1) } - when { !value_1.case_21_2() -> println(value_1.length) } + when { !value_1.case_21_2() -> println(value_1.length) } when { - value_1.case_21_5() == null -> println(value_1.length) + value_1.case_21_5() == null -> println(value_1.length) value_1.case_21_5() != null -> println(value_1) } when { - value_1.case_21_7() != null -> println(value_1.length) + value_1.case_21_7() != null -> println(value_1.length) value_1.case_21_7() == null -> println(value_1) } } @@ -505,19 +505,19 @@ fun case_25(value_1: Any?, value_2: Int?, value_3: Any?, value_4: Int?) { when { value_1.case_25_1(value_2) -> { println(value_1.length) - println(value_2.inv()) + println(value_2.inv()) } } when { value_3.case_25_2(value_4) == null -> { println(value_3.length) - println(value_4.inv()) + println(value_4.inv()) } } when { value_3.case_25_3(value_4) != null -> { println(value_3.length) - println(value_4.inv()) + println(value_4.inv()) } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt index f9794f96f88..6241d48e330 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.fir.kt @@ -44,6 +44,6 @@ fun case_2(value: Any) { // TESTCASE NUMBER: 3 fun case_3(value: String?) { if (!value.isNullOrEmpty() is Boolean) { - value.length + value.length } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt index 736fd934e09..04eeb256a6f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.fir.kt @@ -152,7 +152,7 @@ fun case_2(value_1: Number) { // TESTCASE NUMBER: 3 fun case_3(value_1: String?, value_2: String?) { value_1.case_3_1() - println(value_1.length) + println(value_1.length) value_2.case_3_2() println(value_2) } @@ -160,7 +160,7 @@ fun case_3(value_1: String?, value_2: String?) { // TESTCASE NUMBER: 4 fun case_4(value_1: String?, value_2: String?) { value_1.case_4_1() - println(value_1.length) + println(value_1.length) value_2.case_4_2() println(value_2) } @@ -183,7 +183,7 @@ fun case_6(value_1: Number) { // TESTCASE NUMBER: 7 fun case_7(value_1: String?, value_2: String?) { - if (value_1.case_7_1()) println(value_1.length) + if (value_1.case_7_1()) println(value_1.length) if (value_2.case_7_2()) println(value_2) if (!(value_2.case_7_3() == null)) println(value_2) if (value_2.case_7_3() == null) println(value_2) @@ -191,7 +191,7 @@ fun case_7(value_1: String?, value_2: String?) { // TESTCASE NUMBER: 8 fun case_8(value_1: String?, value_2: String?) { - when { value_1.case_8_1() -> println(value_1.length) } + when { value_1.case_8_1() -> println(value_1.length) } when { value_2.case_8_2() -> println(value_2) } when { !(value_2.case_8_3() == null) -> println(value_2) } when { value_2.case_8_3() == null -> println(value_2) } @@ -199,13 +199,13 @@ fun case_8(value_1: String?, value_2: String?) { // TESTCASE NUMBER: 9 fun case_9(value_1: Number?) { - if (value_1?.case_9() == null) println(value_1.toByte()) + if (value_1?.case_9() == null) println(value_1.toByte()) } // TESTCASE NUMBER: 10 fun case_10(value_1: Number?) { if (value_1?.case_10() == null) { - println(value_1.toByte()) + println(value_1.toByte()) } else { println(value_1.toByte()) } @@ -217,13 +217,13 @@ fun case_10(value_1: Number?) { */ fun case_11(value_1: Number?, value_2: Number?) { if (value_1?.case_11_1() == null) { - println(value_1.toByte()) + println(value_1.toByte()) } else { println(value_1.toByte()) } if (value_2?.case_11_2() != null) { println(value_2.toByte()) } else { - println(value_2.toByte()) + println(value_2.toByte()) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt index 1812171498d..1e92240aca7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.fir.kt @@ -111,7 +111,7 @@ import contracts.* fun case_1(value_1: Any?, value_2: Int?) { value_1.case_1(value_2) println(value_1.length) - println(value_2.inv()) + println(value_2.inv()) } // TESTCASE NUMBER: 2 @@ -125,7 +125,7 @@ fun case_2(value_1: Number?, value_2: Any?) { fun case_3(value_1: Any?, value_2: String?) { value_1.case_3(value_2) println(value_1.inv()) - println(value_2.length) + println(value_2.length) } // TESTCASE NUMBER: 4 @@ -133,7 +133,7 @@ fun case_4(value_1: Any?, value_2: Number, value_3: Any?, value_4: String?) { value_1.case_4(value_2, value_3, value_4) println(value_2.inv()) println(value_3.toByte()) - println(value_4.length) + println(value_4.length) } // TESTCASE NUMBER: 5 @@ -141,19 +141,19 @@ fun case_5(value_1: Any?, value_2: Int?, value_3: Any?, value_4: Int?, value_5: when { value_1.case_5_1(value_2) -> { println(value_1.length) - println(value_2.inv()) + println(value_2.inv()) } } when { !value_3.case_5_2(value_4) -> { println(value_3.length) - println(value_4.inv()) + println(value_4.inv()) } } when { value_5.case_5_3(value_6) != null -> { println(value_5.length) - println(value_6.inv()) + println(value_6.inv()) } } } @@ -182,19 +182,19 @@ fun case_6(value_1: Number?, value_2: Any?, value_3: Number?, value_4: Any?, val fun case_7(value_1: Any?, value_2: String?, value_3: Any?, value_4: String?, value_5: Any?, value_6: String?) { if (value_1.case_7_1(value_2)) { println(value_1.inv()) - println(value_2.length) + println(value_2.length) } if (value_3.case_7_2(value_4)) { println(value_3.inv()) - println(value_4.length) + println(value_4.length) } if (value_5.case_7_3(value_6) != null) { println(value_5.inv()) - println(value_6.length) + println(value_6.length) } if (value_5.case_7_4(value_6) == null) { println(value_5.inv()) - println(value_6.length) + println(value_6.length) } } @@ -202,14 +202,14 @@ fun case_7(value_1: Any?, value_2: String?, value_3: Any?, value_4: String?, val fun case_8(value_1: Any?, value_2: Number, value_3: Any?, value_4: String?) { when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_2.inv()) } when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_3.toByte()) } - when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_4.length) } + when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_4.length) } when { !value_1.case_8_2(value_2, value_3, value_4) -> println(value_2.inv()) } when { !value_1.case_8_2(value_2, value_3, value_4) -> println(value_3.toByte()) } - when { !value_1.case_8_2(value_2, value_3, value_4) -> println(value_4.length) } + when { !value_1.case_8_2(value_2, value_3, value_4) -> println(value_4.length) } when { value_1.case_8_3(value_2, value_3, value_4) == null -> println(value_2.inv()) } when { value_1.case_8_3(value_2, value_3, value_4) == null -> println(value_3.toByte()) } - when { value_1.case_8_3(value_2, value_3, value_4) == null -> println(value_4.length) } + when { value_1.case_8_3(value_2, value_3, value_4) == null -> println(value_4.length) } when { value_1.case_8_4(value_2, value_3, value_4) != null -> println(value_2.inv()) } when { value_1.case_8_4(value_2, value_3, value_4) != null -> println(value_3.toByte()) } - when { value_1.case_8_4(value_2, value_3, value_4) != null -> println(value_4.length) } + when { value_1.case_8_4(value_2, value_3, value_4) != null -> println(value_4.length) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt index 79d069fc03e..b2153d58533 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.fir.kt @@ -210,7 +210,7 @@ import contracts.* // TESTCASE NUMBER: 1 fun case_1(value_1: Int?) { case_1_1(value_1) - value_1.inv() + value_1.inv() case_1_2(value_1) value_1.inv() case_1_1(value_1) @@ -220,7 +220,7 @@ fun case_1(value_1: Int?) { // TESTCASE NUMBER: 2 fun case_2(value_1: Number?) { case_2_1(value_1) - value_1.toByte() + value_1.toByte() case_2_2(value_1) value_1.inv() } @@ -246,7 +246,7 @@ fun case_4(value_1: Any?) { // TESTCASE NUMBER: 5 fun case_5(value_1: Int?) { if (case_5_1(value_1)) { - value_1.inv() + value_1.inv() if (case_5_2(value_1)) { value_1.inv() case_5_1(value_1) @@ -254,7 +254,7 @@ fun case_5(value_1: Int?) { } } if (!case_5_3(value_1)) { - value_1.inv() + value_1.inv() if (!case_5_4(value_1)) { value_1.inv() case_5_1(value_1) @@ -262,7 +262,7 @@ fun case_5(value_1: Int?) { } } if (case_5_5(value_1) != null) { - value_1.inv() + value_1.inv() if (case_5_6(value_1) != null) { value_1.inv() case_5_1(value_1) @@ -270,7 +270,7 @@ fun case_5(value_1: Int?) { } } if (case_5_7(value_1) == null) { - value_1.inv() + value_1.inv() if (case_5_8(value_1) == null) { value_1.inv() case_5_1(value_1) @@ -283,25 +283,25 @@ fun case_5(value_1: Int?) { fun case_6(value_1: Number?) { when { case_6_1(value_1) -> { - value_1.toByte() + value_1.toByte() when { case_6_2(value_1) -> value_1.inv() } } } when { !case_6_3(value_1) -> { - value_1.toByte() + value_1.toByte() when { !case_6_4(value_1) -> value_1.inv() } } } when { case_6_5(value_1) != null -> { - value_1.toByte() + value_1.toByte() when { case_6_6(value_1) != null -> value_1.inv() } } } when { case_6_7(value_1) == null -> { - value_1.toByte() + value_1.toByte() when { case_6_8(value_1) == null -> value_1.inv() } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt index 4d10799794e..86c1ce2fec9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.fir.kt @@ -103,11 +103,11 @@ fun case_4(value_1: Number, value_2: (() -> Unit)?) { fun case_5(value_1: Number?, value_2: String?) { when (value_2.case_5(value_1)) { true -> { - println(value_2.length) + println(value_2.length) println(value_1.toByte()) } false -> { - println(value_2.length) + println(value_2.length) println(value_1.inv()) } } @@ -118,11 +118,11 @@ fun case_6(value_1: Number, value_2: String?, value_3: Any?) { when (value_3.case_6(value_1, value_2)) { true -> { println(value_3.equals("")) - println(value_2.length) + println(value_2.length) } false -> { println(value_3.length) - println(value_2.length) + println(value_2.length) } null -> { println(value_1.inv()) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt index 046cfcad176..ff2c8a47167 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.fir.kt @@ -4,25 +4,25 @@ // TESTCASE NUMBER: 1 fun case_1(arg: Int?) { funWithAtMostOnceCallsInPlace { arg!! } - arg.inc() + arg.inc() } // TESTCASE NUMBER: 2 fun case_2(arg: Int?) { funWithUnknownCallsInPlace { arg!! } - arg.inc() + arg.inc() } // TESTCASE NUMBER: 3 fun case_3() { val value_1: Boolean? funWithAtMostOnceCallsInPlace { value_1 = false } - value_1.not() + value_1.not() } // TESTCASE NUMBER: 4 fun case_4() { val value_1: Boolean? funWithUnknownCallsInPlace { value_1 = true } - value_1.not() + value_1.not() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt index 2aea8c40632..214075f51f4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.fir.kt @@ -10,7 +10,7 @@ fun case_1(arg: Int?) { // TESTCASE NUMBER: 2 fun case_2(arg: Int?) { funWithAtLeastOnceCallsInPlace { arg!! } - arg.inc() + arg.inc() } // TESTCASE NUMBER: 3 @@ -24,5 +24,5 @@ fun case_3() { fun case_4() { val value_1: Boolean? funWithAtLeastOnceCallsInPlace { value_1 = true } - value_1.not() + value_1.not() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt index 5a5433d6c87..b6f2561540f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/14.fir.kt @@ -49,21 +49,21 @@ import contracts.* // TESTCASE NUMBER: 1 fun case_1(value_1: Int?) { if (contracts.case_1(value_1)!!) { - value_1.inv() + value_1.inv() } } // TESTCASE NUMBER: 2 fun case_2(value_1: Int?) { if (!contracts.case_2(value_1)!!) { - value_1.inv() + value_1.inv() } } // TESTCASE NUMBER: 3 fun case_3(value_1: Int?) { if (contracts.case_3(value_1)!!) { - value_1.inv() + value_1.inv() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt index 13d619d9e85..615f0914cd7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.fir.kt @@ -110,7 +110,7 @@ import contracts.* fun case_1(value_1: Any?, value_2: Int?) { value_1.case_1(value_2) println(value_1.length) - println(value_2.inv()) + println(value_2.inv()) } // TESTCASE NUMBER: 2 @@ -124,7 +124,7 @@ fun case_2(value_1: Number?, value_2: Any?) { fun case_3(value_1: Any?, value_2: String?) { value_1.case_3(value_2) println(value_1.inv()) - println(value_2.length) + println(value_2.length) } // TESTCASE NUMBER: 4 @@ -132,7 +132,7 @@ fun case_4(value_1: Any?, value_2: Number, value_3: Any?, value_4: String?) { value_1.case_4(value_2, value_3, value_4) println(value_2.inv()) println(value_3.toByte()) - println(value_4.length) + println(value_4.length) } // TESTCASE NUMBER: 5 @@ -140,25 +140,25 @@ fun case_5(value_1: Any?, value_2: Int?, value_3: Any?, value_4: Int?, value_5: when { value_1.case_5_1(value_2) -> { println(value_1.length) - println(value_2.inv()) + println(value_2.inv()) } } when { !value_3.case_5_2(value_4) -> { println(value_3.length) - println(value_4.inv()) + println(value_4.inv()) } } when { value_5.case_5_3(value_6) != null -> { println(value_5.length) - println(value_6.inv()) + println(value_6.inv()) } } when { value_5.case_5_4(value_6) == null -> { println(value_5.length) - println(value_6.inv()) + println(value_6.inv()) } } } @@ -187,19 +187,19 @@ fun case_6(value_1: Number?, value_2: Any?, value_3: Number?, value_4: Any?, val fun case_7(value_1: Any?, value_2: String?, value_3: Any?, value_4: String?, value_5: Any?, value_6: String?) { if (value_1.case_7_1(value_2)) { println(value_1.inv()) - println(value_2.length) + println(value_2.length) } if (value_3.case_7_2(value_4)) { println(value_3.inv()) - println(value_4.length) + println(value_4.length) } if (value_5.case_7_3(value_6) != null) { println(value_5.inv()) - println(value_6.length) + println(value_6.length) } if (value_5.case_7_4(value_6) == null) { println(value_5.inv()) - println(value_6.length) + println(value_6.length) } } @@ -207,14 +207,14 @@ fun case_7(value_1: Any?, value_2: String?, value_3: Any?, value_4: String?, val fun case_8(value_1: Any?, value_2: Number, value_3: Any?, value_4: String?, value_5: Any?, value_6: Number, value_7: Any?, value_8: String?) { when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_2.inv()) } when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_3.toByte()) } - when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_4.length) } + when { value_1.case_8_1(value_2, value_3, value_4) -> println(value_4.length) } when { !value_5.case_8_2(value_6, value_7, value_8) -> println(value_6.inv()) } when { !value_5.case_8_2(value_6, value_7, value_8) -> println(value_7.toByte()) } - when { !value_5.case_8_2(value_6, value_7, value_8) -> println(value_8.length) } + when { !value_5.case_8_2(value_6, value_7, value_8) -> println(value_8.length) } when { value_5.case_8_3(value_6, value_7, value_8) != null -> println(value_6.inv()) } when { value_5.case_8_3(value_6, value_7, value_8) != null -> println(value_7.toByte()) } - when { value_5.case_8_3(value_6, value_7, value_8) != null -> println(value_8.length) } + when { value_5.case_8_3(value_6, value_7, value_8) != null -> println(value_8.length) } when { value_5.case_8_4(value_6, value_7, value_8) == null -> println(value_6.inv()) } when { value_5.case_8_4(value_6, value_7, value_8) == null -> println(value_7.toByte()) } - when { value_5.case_8_4(value_6, value_7, value_8) == null -> println(value_8.length) } + when { value_5.case_8_4(value_6, value_7, value_8) == null -> println(value_8.length) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt index b0c617dee4e..f7efa9bf4b1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.fir.kt @@ -111,7 +111,7 @@ fun case_5(value_1: Number?, value_2: String?) { println(value_1.toByte()) } false -> { - println(value_2.length) + println(value_2.length) println(value_1.inv()) } } @@ -130,7 +130,7 @@ fun case_6(value_1: Number, value_2: String?, value_3: Any?) { } false -> { println(value_3.length) - println(value_2.length) + println(value_2.length) } null -> { println(value_1.inv()) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt index dd25f83a07c..0a18e90197d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt @@ -6,13 +6,13 @@ fun case_1(x: Any?) { if (x != null is Boolean) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -23,13 +23,13 @@ fun case_3() { if (Object.prop_1 == null !== null) else { Object.prop_1 - Object.prop_1.equals(null) + Object.prop_1.equals(null) Object.prop_1.propT - Object.prop_1.propAny + Object.prop_1.propAny Object.prop_1.propNullableT Object.prop_1.propNullableAny Object.prop_1.funT() - Object.prop_1.funAny() + Object.prop_1.funAny() Object.prop_1.funNullableT() Object.prop_1.funNullableAny() } @@ -39,13 +39,13 @@ fun case_3() { fun case_4(x: Char?) { if (x != null || false is Boolean) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -56,13 +56,13 @@ fun case_5() { val x: Unit? = null if (x !== null is Boolean?) x - if (x !== null == null) x.equals(null) + if (x !== null == null) x.equals(null) if (x !== null == null) x.propT - if (x !== null == null) x.propAny + if (x !== null == null) x.propAny if (x !== null == null) x.propNullableT if (x !== null == null) x.propNullableAny if (x !== null == null) x.funT() - if (x !== null == null) x.funAny() + if (x !== null == null) x.funAny() if (x !== null == null) x.funNullableT() if (x !== null == null) x.funNullableAny() } @@ -73,13 +73,13 @@ fun case_6(x: EmptyClass?) { if ((x != null && !y) is Boolean) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -89,13 +89,13 @@ fun case_6(x: EmptyClass?) { fun case_7() { if (nullableNumberProperty != null || nullableNumberProperty != null is Boolean) { nullableNumberProperty - nullableNumberProperty.equals(null) + nullableNumberProperty.equals(null) nullableNumberProperty.propT - nullableNumberProperty.propAny + nullableNumberProperty.propAny nullableNumberProperty.propNullableT nullableNumberProperty.propNullableAny nullableNumberProperty.funT() - nullableNumberProperty.funAny() + nullableNumberProperty.funAny() nullableNumberProperty.funNullableT() nullableNumberProperty.funNullableAny() } @@ -113,7 +113,7 @@ fun case_9(x: TypealiasNullableString?) { } else if (false is Boolean) { x - x.get(0) + x.get(0) } } @@ -124,13 +124,13 @@ fun case_10() { if (a.prop_4 === null || true is Boolean) { if (a.prop_4 != null !== null) { a.prop_4 - a.prop_4.equals(null) + a.prop_4.equals(null) a.prop_4.propT - a.prop_4.propAny + a.prop_4.propAny a.prop_4.propNullableT a.prop_4.propNullableAny a.prop_4.funT() - a.prop_4.funAny() + a.prop_4.funAny() a.prop_4.funNullableT() a.prop_4.funNullableAny() } @@ -150,11 +150,11 @@ fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndir x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -270,13 +270,13 @@ val case_17 = if (nullableIntProperty == null == true == false) 0 else { fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?) { if (a != null !== null) { a - a.equals(null) + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } @@ -302,17 +302,17 @@ fun case_19(b: Boolean) { } } else null - if (a != null !is Boolean && a.B19 != null is Boolean && a.B19.C19 != null is Boolean && a.B19.C19.D19 != null == null && a.B19.C19.D19.x != null !== null) { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(null) - a.B19.C19.D19.x.propT - a.B19.C19.D19.x.propAny - a.B19.C19.D19.x.propNullableT - a.B19.C19.D19.x.propNullableAny - a.B19.C19.D19.x.funT() - a.B19.C19.D19.x.funAny() - a.B19.C19.D19.x.funNullableT() - a.B19.C19.D19.x.funNullableAny() + if (a != null !is Boolean && a.B19 != null is Boolean && a.B19.C19 != null is Boolean && a.B19.C19.D19 != null == null && a.B19.C19.D19.x != null !== null) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() } } @@ -330,13 +330,13 @@ fun case_20(b: Boolean) { if (a.B19.C19.D19 !== null !is Boolean) { a.B19.C19.D19 - a.B19.C19.D19.equals(null) + a.B19.C19.D19.equals(null) a.B19.C19.D19.propT - a.B19.C19.D19.propAny + a.B19.C19.D19.propAny a.B19.C19.D19.propNullableT a.B19.C19.D19.propNullableAny a.B19.C19.D19.funT() - a.B19.C19.D19.funAny() + a.B19.C19.D19.funAny() a.B19.C19.D19.funNullableT() a.B19.C19.D19.funNullableAny() } @@ -346,13 +346,13 @@ fun case_20(b: Boolean) { fun case_21() { if (EnumClassWithNullableProperty.B.prop_1 !== null is Boolean == true !is Boolean != true) { EnumClassWithNullableProperty.B.prop_1 - EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.equals(null) EnumClassWithNullableProperty.B.prop_1.propT - EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propAny EnumClassWithNullableProperty.B.prop_1.propNullableT EnumClassWithNullableProperty.B.prop_1.propNullableAny EnumClassWithNullableProperty.B.prop_1.funT() - EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funAny() EnumClassWithNullableProperty.B.prop_1.funNullableT() EnumClassWithNullableProperty.B.prop_1.funNullableAny() } @@ -361,23 +361,23 @@ fun case_21() { // TESTCASE NUMBER: 22 fun case_22(a: (() -> Unit)?) { if (a != null !is Boolean) { - a() - a().equals(null) - a().propT - a().propAny - a().propNullableT - a().propNullableAny - a().funT() - a().funAny() - a().funNullableT() - a().funNullableAny() + a() + a().equals(null) + a().propT + a().propAny + a().propNullableT + a().propNullableAny + a().funT() + a().funAny() + a().funNullableT() + a().funNullableAny() } } // TESTCASE NUMBER: 23 fun case_23(a: ((Float) -> Int?)?, b: Float?) { if (a != null !is Boolean && b !== null is Boolean) { - val x = a(b) + val x = a(b) if (x != null) { x x.equals(null) @@ -396,15 +396,15 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?) { // TESTCASE NUMBER: 24 fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = if (a !== null is Boolean && b !== null !is Boolean) { - a(?")!>b) - a(b) - ?")!>b.equals(null) + a(?")!>b) + a(b) + ?")!>b.equals(null) ?")!>b.propT - ?")!>b.propAny + ?")!>b.propAny ?")!>b.propNullableT ?")!>b.propNullableAny ?")!>b.funT() - ?")!>b.funAny() + ?")!>b.funAny() ?")!>b.funNullableT() ?")!>b.funNullableAny() } else null @@ -440,16 +440,16 @@ fun case_25(b: Boolean) { // TESTCASE NUMBER: 26 fun case_26(a: ((Float) -> Int?)?, b: Float?) { if (a != null == true == false && b != null == true == false) { - val x = a(b) + val x = a(b) if (x != null == true === false) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -461,13 +461,13 @@ fun case_27() { if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true is Boolean) else { Object.prop_1 - Object.prop_1.equals(null) + Object.prop_1.equals(null) Object.prop_1.propT - Object.prop_1.propAny + Object.prop_1.propAny Object.prop_1.propNullableT Object.prop_1.propNullableAny Object.prop_1.funT() - Object.prop_1.funAny() + Object.prop_1.funAny() Object.prop_1.funNullableT() Object.prop_1.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt index 089c8e148a1..4ee80f19c8e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt @@ -26,7 +26,7 @@ fun case_3() { if (x is Boolean) { funWithAnyArg(try { x = null; true } catch (e: Exception) { false }) x - x.not() + x.not() } } @@ -36,7 +36,7 @@ fun case_4() { if (x != null) { false || when { else -> {x = null; true} } x - x.not() + x.not() } } @@ -58,7 +58,7 @@ fun case_6() { x as Boolean if (if (true) { x = null; true } else { false }) { x - x.not() + x.not() } } @@ -69,5 +69,5 @@ fun case_7() { if (if (true) { x = null; true } else { false }) {} x - x.not() + x.not() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt index ea31ce80a81..01ed2fc397b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt @@ -18,7 +18,7 @@ fun case_2() { } catch (e: Exception) { x = null } - x.not() + x.not() } } @@ -31,7 +31,7 @@ fun case_3() { } catch (e: Exception) { x = null } - x.not() + x.not() } } @@ -42,5 +42,5 @@ fun case_4() { try { x = null } finally { } - x.not() + x.not() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt index 6028efb50fe..6ef6de25fb7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt @@ -16,7 +16,7 @@ fun case_2() { x!! x(if (true) {x=null;0} else 0, x) x - x.fun_1() + x.fun_1() } // TESTCASE NUMBER: 3 @@ -25,5 +25,5 @@ fun case_3() { x!! val y = x[if (true) {x=null;0} else 0, x[0]] x - x.fun_1() + x.fun_1() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt index 9d0d22d7566..6d4234beba6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt @@ -6,7 +6,7 @@ fun case_1(x: Int?) { if ((x is Int) ?: (x is Int)) { x - x.inv() + x.inv() } } @@ -14,7 +14,7 @@ fun case_1(x: Int?) { fun case_2(x: Int?) { if (x?.equals(1) ?: x is Int) { x - x.inv() + x.inv() } } @@ -22,7 +22,7 @@ fun case_2(x: Int?) { fun case_3(x: Boolean?) { if (x ?: (x != null)) { x - x.not() + x.not() } } @@ -30,7 +30,7 @@ fun case_3(x: Boolean?) { fun case_4(x: Boolean?) { if (if (x != null) x else x != null) { x - x.not() + x.not() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt index c3035bcc689..b6b5c5a1f8e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt @@ -38,7 +38,7 @@ fun case_3() { if (x != null) { false || when { else -> { x = null; true} } x - x.not() + x.not() } } @@ -64,7 +64,7 @@ fun case_4() { fun case_5() { var x: Boolean? = true if (x != null) { - when { else -> { x = null; false} } || x.not() + when { else -> { x = null; false} } || x.not() } } @@ -88,7 +88,7 @@ fun case_6() { fun case_7() { var x: Boolean? = true if (x != null) { - (if (true) {x = null; null} else true) ?: x.not() + (if (true) {x = null; null} else true) ?: x.not() } } @@ -110,7 +110,7 @@ fun case_9() { if (x is Boolean) { funWithAnyArg(try { x = null; true } catch (e: Exception) { false }) x - x.not() + x.not() } } @@ -122,7 +122,7 @@ fun case_9() { fun case_10() { var x: Boolean? = true if (x is Boolean) { - select(if (true) {x = null;Class()} else Class()).prop_9 = x.not() + select(if (true) {x = null;Class()} else Class()).prop_9 = x.not() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt index 140fefe1e84..bfd8574ab45 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt @@ -15,7 +15,7 @@ fun case_1(x: Boolean?) { } x - x.not() + x.not() } /* @@ -31,7 +31,7 @@ fun case_2(x: Boolean?) { } x - x.not() + x.not() } /* @@ -47,7 +47,7 @@ fun case_3(x: Boolean?) { } while (true) x - x.not() + x.not() } /* @@ -99,7 +99,7 @@ fun case_7(x: Boolean?) { } x - x.not() + x.not() } /* @@ -115,7 +115,7 @@ fun case_8(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 9 @@ -144,7 +144,7 @@ fun case_10(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 11 @@ -156,7 +156,7 @@ fun case_11(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 12 @@ -166,7 +166,7 @@ fun case_12(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 13 @@ -176,7 +176,7 @@ fun case_13(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 14 @@ -186,7 +186,7 @@ fun case_14(x: Boolean?) { } while (true) x - x.not() + x.not() } // TESTCASE NUMBER: 15 @@ -196,7 +196,7 @@ fun case_15(x: Boolean?) { } while (true) x - x.not() + x.not() } // TESTCASE NUMBER: 16 @@ -225,7 +225,7 @@ fun case_17(x: Boolean?) { } x - x.not() + x.not() } /* @@ -243,7 +243,7 @@ fun case_18(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 19 @@ -257,7 +257,7 @@ fun case_19(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 20 @@ -272,7 +272,7 @@ fun case_20(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 21 @@ -282,7 +282,7 @@ fun case_21(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 22 @@ -292,7 +292,7 @@ fun case_22(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 23 @@ -304,7 +304,7 @@ fun case_23(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 24 @@ -317,7 +317,7 @@ fun case_24(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 25 @@ -329,7 +329,7 @@ fun case_25(x: Boolean?) { } x - x.not() + x.not() } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt index 1e748d84806..1fe7ee1eb71 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt @@ -15,7 +15,7 @@ fun case_1(x: Boolean?) { } x - x.not() + x.not() } /* @@ -31,7 +31,7 @@ fun case_2(x: Boolean?) { } x - x.not() + x.not() } /* @@ -47,7 +47,7 @@ fun case_3(x: Boolean?) { } while (true) x - x.not() + x.not() } /* @@ -99,7 +99,7 @@ fun case_7(x: Boolean?) { } x - x.not() + x.not() } /* @@ -115,7 +115,7 @@ fun case_8(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 9 @@ -144,7 +144,7 @@ fun case_10(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 11 @@ -156,7 +156,7 @@ fun case_11(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 12 @@ -166,7 +166,7 @@ fun case_12(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 13 @@ -176,7 +176,7 @@ fun case_13(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 14 @@ -186,7 +186,7 @@ fun case_14(x: Boolean?) { } while (true) x - x.not() + x.not() } // TESTCASE NUMBER: 15 @@ -196,7 +196,7 @@ fun case_15(x: Boolean?) { } while (true) x - x.not() + x.not() } // TESTCASE NUMBER: 16 @@ -225,7 +225,7 @@ fun case_17(x: Boolean?) { } x - x.not() + x.not() } /* @@ -243,7 +243,7 @@ fun case_18(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 19 @@ -257,7 +257,7 @@ fun case_19(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 20 @@ -272,7 +272,7 @@ fun case_20(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 21 @@ -282,7 +282,7 @@ fun case_21(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 22 @@ -292,7 +292,7 @@ fun case_22(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 23 @@ -304,7 +304,7 @@ fun case_23(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 24 @@ -317,7 +317,7 @@ fun case_24(x: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 25 @@ -329,7 +329,7 @@ fun case_25(x: Boolean?) { } x - x.not() + x.not() } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt index 359db004c86..15eda2907a9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt @@ -16,7 +16,7 @@ class Case1 { x this.x y.x - y.x.inv() + y.x.inv() } else { x = 10 } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt index 5c8e6af4085..5ebd0bf5fd1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt @@ -14,7 +14,7 @@ fun case_1(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } /* @@ -29,7 +29,7 @@ fun case_2(x: Boolean?, y: Boolean?) { } while (true) x - x.not() + x.not() } /* @@ -44,7 +44,7 @@ fun case_3(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } /* @@ -59,7 +59,7 @@ fun case_4(x: Boolean?, y: Boolean?) { } while (true) x - x.not() + x.not() } // TESTCASE NUMBER: 5 @@ -92,7 +92,7 @@ fun case_7(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } /* @@ -107,7 +107,7 @@ fun case_8(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt index 1f7569cc23c..28e4a41a952 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt @@ -61,7 +61,7 @@ inline fun case_6() { var x: T? = 10 as T if (x is K) { x = null - x.equals(10) + x.equals(10) x println(1) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt index 07df8fe67f9..81536473ecf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt @@ -16,7 +16,7 @@ fun case_1() { x = null } x - x.not() + x.not() } } @@ -32,7 +32,7 @@ fun case_2() { x = null } finally { } x - x.not() + x.not() } } @@ -52,7 +52,7 @@ fun case_3(x: String?) { } } x - x.length + x.length } /* @@ -69,7 +69,7 @@ fun case_4(x: String?) { } } x - x.length + x.length } /* @@ -86,7 +86,7 @@ fun case_5(x: String?) { } } while (true) x - x.length + x.length } /* @@ -105,5 +105,5 @@ fun case_6(x: String?) { } } while (true) x - x.length + x.length } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt index bfdb0be3edd..08cad2f0ca1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt @@ -10,18 +10,18 @@ fun case_1() { var x: MutableList? = mutableListOf(1) x!! - & kotlin.collections.MutableList?")!>x[if (true) {x=null;0} else 0] += ? & kotlin.collections.MutableList?")!>x[0] + & kotlin.collections.MutableList?")!>x[if (true) {x=null;0} else 0] += ? & kotlin.collections.MutableList?")!>x[0] ? & kotlin.collections.MutableList?")!>x - ? & kotlin.collections.MutableList?")!>x[0].inv() + ? & kotlin.collections.MutableList?")!>x[0].inv() } // TESTCASE NUMBER: 2 fun case_2() { var x: MutableList? = mutableListOf(1) x!! - & kotlin.collections.MutableList?")!>x[if (true) {x=null;0} else 0] = ? & kotlin.collections.MutableList?")!>x[0] + & kotlin.collections.MutableList?")!>x[if (true) {x=null;0} else 0] = ? & kotlin.collections.MutableList?")!>x[0] ? & kotlin.collections.MutableList?")!>x - ? & kotlin.collections.MutableList?")!>x[0].inv() + ? & kotlin.collections.MutableList?")!>x[0].inv() } // TESTCASE NUMBER: 3 @@ -30,7 +30,7 @@ fun case_3() { x!! & kotlin.collections.MutableList?")!>x[0] = if (true) {x=null;0} else 0 ? & kotlin.collections.MutableList?")!>x - ? & kotlin.collections.MutableList?")!>x[0].inv() + ? & kotlin.collections.MutableList?")!>x[0].inv() } /* @@ -55,16 +55,16 @@ fun case_5() { var x: Class? = Class() x!! x(if (true) {x=null;0} else 0, x) - x.fun_1() + x.fun_1() } // TESTCASE NUMBER: 6 fun case_6() { var x: MutableList>? = mutableListOf(mutableListOf(1)) x!! - > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0][>? & kotlin.collections.MutableList>?")!>x[0][0]] += 10 + > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0][>? & kotlin.collections.MutableList>?")!>x[0][0]] += 10 >? & kotlin.collections.MutableList>?")!>x - >? & kotlin.collections.MutableList>?")!>x[0][0].inv() + >? & kotlin.collections.MutableList>?")!>x[0][0].inv() } /* @@ -76,21 +76,21 @@ fun case_7() { var x: Class? = Class() x!! x(if (true) {x=null;0} else 0)(x) - x.fun_1() + x.fun_1() } // TESTCASE NUMBER: 8 fun case_8() { var x: MutableList>? = mutableListOf(mutableListOf(1)) x!! - > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].addAll(1, >? & kotlin.collections.MutableList>?")!>x[0]) + > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].addAll(1, >? & kotlin.collections.MutableList>?")!>x[0]) } // TESTCASE NUMBER: 9 fun case_9() { var x: MutableList>? = mutableListOf(mutableListOf(1)) x!! - > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].subList(0, 2)[>? & kotlin.collections.MutableList>?")!>x[0][0]] + > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].subList(0, 2)[>? & kotlin.collections.MutableList>?")!>x[0][0]] } /* @@ -101,7 +101,7 @@ fun case_9() { fun case_10() { var x: MutableList>? = mutableListOf(mutableListOf(1)) x!! - > & kotlin.collections.MutableList>?")!>x.subList(if (true) {x=null;0} else 0, 2)[>? & kotlin.collections.MutableList>?")!>x[0][0]] + > & kotlin.collections.MutableList>?")!>x.subList(if (true) {x=null;0} else 0, 2)[>? & kotlin.collections.MutableList>?")!>x[0][0]] } /* @@ -112,5 +112,5 @@ fun case_10() { fun case_11() { var x: MutableList>? = mutableListOf(mutableListOf(1)) x!! - > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].subList(>? & kotlin.collections.MutableList>?")!>x[0][0], 2) + > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].subList(>? & kotlin.collections.MutableList>?")!>x[0][0], 2) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt index d69c925a5d8..de66e6e0583 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt @@ -14,7 +14,7 @@ fun case_1(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 2 @@ -38,7 +38,7 @@ fun case_3(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } /* @@ -53,7 +53,7 @@ fun case_4(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 5 @@ -64,7 +64,7 @@ fun case_5(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 6 @@ -79,7 +79,7 @@ fun case_6(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } // TESTCASE NUMBER: 7 @@ -108,5 +108,5 @@ fun case_8(x: Boolean?, y: Boolean?) { } x - x.not() + x.not() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt index c31bf6671be..7a6af78a908 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt @@ -10,7 +10,7 @@ fun case_1(a: Any?) { } a - a.equals(10) + a.equals(10) } // TESTCASE NUMBER: 2 @@ -23,7 +23,7 @@ fun case_2(a: Any?) { })() a - a.equals(10) + a.equals(10) } // TESTCASE NUMBER: 3 @@ -36,7 +36,7 @@ fun case_3(a: Any?) { } a - a.equals(10) + a.equals(10) } // TESTCASE NUMBER: 4 @@ -49,7 +49,7 @@ fun case_4(a: Any?) { } a - a.equals(10) + a.equals(10) } /* @@ -65,7 +65,7 @@ fun case_5(a: Any?) { } a - a.equals(10) + a.equals(10) } /* @@ -81,7 +81,7 @@ fun case_6(a: Any?) { } a - a.equals(10) + a.equals(10) } /* @@ -97,7 +97,7 @@ fun case_7(a: Any?) { } a - a.equals(10) + a.equals(10) } // TESTCASE NUMBER: 8 @@ -112,5 +112,5 @@ fun case_8(a: Any?) { } a - a.equals(10) + a.equals(10) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt index 05ab6ad76a3..83a0c6a30f8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt @@ -30,8 +30,8 @@ class Case5(val y: Any?): ClassWithCostructorParam(y as Interface1), Interface1 // TESTCASE NUMBER: 6 fun case_6(a: Int?) = object : ClassWithCostructorParam(a!!) { - fun run() = a.toShort() + fun run() = a.toShort() init { - println(a.toShort()) + println(a.toShort()) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt index 767a3147e0d..c2ae00182c8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt @@ -14,7 +14,7 @@ fun case_1() { break } x - x.length + x.length } /* @@ -29,7 +29,7 @@ fun case_3() { break } x - x.length + x.length } /* @@ -44,7 +44,7 @@ fun case_4() { break } x - x.not() + x.not() } // TESTCASE NUMBER: 5 @@ -57,7 +57,7 @@ fun case_5() { break } x - x.not() + x.not() } // TESTCASE NUMBER: 6 @@ -65,12 +65,12 @@ fun case_6() { var x: Boolean? = true while (false && x!!) { x - x.not() + x.not() x = null break } x - x.not() + x.not() } // TESTCASE NUMBER: 7 @@ -78,12 +78,12 @@ fun case_7() { var x: Boolean? = true while (true || x!!) { x - x.not() + x.not() x = null break } x - x.not() + x.not() } // TESTCASE NUMBER: 8 @@ -91,12 +91,12 @@ fun case_8() { var x: Boolean? = true while (!(false && x!!)) { x - x.not() + x.not() x = null break } x - x.not() + x.not() } // TESTCASE NUMBER: 9 @@ -137,12 +137,12 @@ fun case_12() { var x: Boolean? = true do { x - x.not() + x.not() x = null break } while (true && x!!) x - x.not() + x.not() } // TESTCASE NUMBER: 13 @@ -150,12 +150,12 @@ fun case_13() { var x: Boolean? = true do { x - x.not() + x.not() x = null break } while (false && x!!) x - x.not() + x.not() } // TESTCASE NUMBER: 14 @@ -163,12 +163,12 @@ fun case_14() { var x: Boolean? = true do { x - x.not() + x.not() x = null break } while (true || x!!) x - x.not() + x.not() } // TESTCASE NUMBER: 15 @@ -176,12 +176,12 @@ fun case_15() { var x: Boolean? = true do { x - x.not() + x.not() x = null break } while (!(false && x!!)) x - x.not() + x.not() } /* @@ -195,7 +195,7 @@ fun case_16() { break } x - x.not() + x.not() } /* @@ -209,5 +209,5 @@ fun case_17() { break } x - x.not() + x.not() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt index e36e5e01c9b..7c82b872312 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt @@ -12,7 +12,7 @@ fun case_1() { x = "Test" println("${if (true) x = null else 1}") x - x.length + x.length } /* @@ -25,7 +25,7 @@ fun case_2() { x = "Test" println("${try { x = null } finally { }}") x - x.length + x.length } /* @@ -38,7 +38,7 @@ fun case_3() { x = "Test" println("${try { } finally { x = null }}") x - x.length + x.length } /* @@ -51,7 +51,7 @@ fun case_4() { x = "Test" println("${try { x = null } catch (e: Exception) { } finally { }}") x - x.length + x.length } /* @@ -64,7 +64,7 @@ fun case_5() { x = "Test" println("${try { } catch (e: Exception) { x = null } finally { }}") x - x.length + x.length } /* @@ -77,7 +77,7 @@ fun case_6() { x = "Test" println("${try { } catch (e: Exception) { } finally { x = null }}") x - x.length + x.length } /* @@ -90,7 +90,7 @@ fun case_7() { x = "Test" println("${try { x = null } catch (e: Exception) { }}") x - x.length + x.length } /* @@ -103,7 +103,7 @@ fun case_8() { x = "Test" println("${try { } catch (e: Exception) { x = null }}") x - x.length + x.length } /* @@ -116,5 +116,5 @@ fun case_9() { x = "Test" println("${when (null) { else -> x = null } }") x - x.length + x.length } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt index 8d0b1560404..ceaacb181be 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt @@ -13,7 +13,7 @@ fun case_1() { x x++ x - x.equals(10) + x.equals(10) } } @@ -28,7 +28,7 @@ fun case_2() { x x-- x - x.equals(10) + x.equals(10) } /* @@ -42,7 +42,7 @@ fun case_3() { x --x x - x.equals(10) + x.equals(10) } /* @@ -56,7 +56,7 @@ fun case_4() { x ++x x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 5 @@ -66,7 +66,7 @@ fun case_5() { x x = x + x x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 6 @@ -76,7 +76,7 @@ fun case_6() { x x = x - x x - x.equals(10) + x.equals(10) } } @@ -91,7 +91,7 @@ fun case_7() { x x += x x - x.equals(10) + x.equals(10) } /* @@ -105,5 +105,5 @@ fun case_8() { x x -= x x - x.equals(10) + x.equals(10) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt index 36564f9cf74..a9ffdf256fe 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt @@ -16,7 +16,7 @@ fun case_1() { } } x - x.length + x.length } /* @@ -33,7 +33,7 @@ fun case_2() { } } x - x.length + x.length } /* @@ -50,7 +50,7 @@ fun case_3(y: Nothing?) { } } x - x.length + x.length } /* @@ -69,7 +69,7 @@ fun case_4(y: Nothing?) { } } x - x.length + x.length } // TESTCASE NUMBER: 5 @@ -82,7 +82,7 @@ fun case_5(y: Nothing?) { } } x - x.length + x.length } // TESTCASE NUMBER: 6 @@ -98,7 +98,7 @@ fun case_6(y: Nothing?) { break } x - x.length + x.length } /* @@ -115,7 +115,7 @@ fun case_7() { } while (x == null) } while (true) x - x.length + x.length } /* @@ -134,7 +134,7 @@ fun case_8(y: Nothing?) { } while (x === y) } while (true) x - x.length + x.length } // TESTCASE NUMBER: 9 @@ -146,7 +146,7 @@ fun case_9() { x = null } while (x != null) x - x.length + x.length } } @@ -159,7 +159,7 @@ fun case_10() { x = null } while (true) x - x.length + x.length } } @@ -173,6 +173,6 @@ fun case_11() { break } while (x == null) x - x.length + x.length } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt index 1e10a3bfed2..bba69fbb6fd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt @@ -13,7 +13,7 @@ fun case_1() { println(x ?: break) } x - x.length + x.length } /* @@ -27,7 +27,7 @@ fun case_2(y: MutableList) { y[x ?: break] = 10 } x - x.inv() + x.inv() } /* @@ -41,7 +41,7 @@ fun case_3(y: MutableList) { y[0] = x ?: break } x - x.inv() + x.inv() } // TESTCASE NUMBER: 4 @@ -51,7 +51,7 @@ fun case_4() { x ?: break } x - x.inv() + x.inv() } // TESTCASE NUMBER: 5 @@ -61,7 +61,7 @@ fun case_5(y: Boolean) { y && (x ?: break) } x - x.not() + x.not() } // TESTCASE NUMBER: 6 @@ -71,7 +71,7 @@ fun case_6(y: Boolean) { y || (x ?: break) } x - x.not() + x.not() } // TESTCASE NUMBER: 7 @@ -81,7 +81,7 @@ fun case_7(y: Boolean?) { y ?: x ?: break } x - x.not() + x.not() } /* @@ -96,7 +96,7 @@ fun case_8() { y += x ?: break } x - x.inv() + x.inv() } /* @@ -111,7 +111,7 @@ fun case_9() { y -= x ?: break } x - x.inv() + x.inv() } /* @@ -126,7 +126,7 @@ fun case_10() { val z = y - (x ?: break) } x - x.inv() + x.inv() } /* @@ -141,7 +141,7 @@ fun case_11() { val z = y * (x ?: break) } x - x.inv() + x.inv() } // TESTCASE NUMBER: 12 @@ -152,7 +152,7 @@ fun case_12() { y += if (x == null) break else 10 } x - x.inv() + x.inv() } // TESTCASE NUMBER: 13 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt index 79edaa0df14..c21d640524a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt @@ -8,8 +8,8 @@ fun case_1(x: Any?) { x x.inv() x.not() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -19,8 +19,8 @@ fun case_2(x: Any?) { x x.inv() x.not() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -29,8 +29,8 @@ inline fun case_3(x: Any?) { if (x is Int is T) { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -39,8 +39,8 @@ inline fun case_4(x: Any?) { if (x is Int is T == null) { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -49,8 +49,8 @@ fun case_5(x: Any?) { if (x is Int != null) { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -59,8 +59,8 @@ fun case_6(x: Any?) { if (x is Int == null) { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -69,8 +69,8 @@ fun case_7(x: Any?) { if (!(x !is Int) == false) { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -79,8 +79,8 @@ fun case_8(x: Any?) { if (!(x !is Int) == true) else { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -89,8 +89,8 @@ fun case_9(x: Any?) { if (x !is Int !is Any?) { x x.inv() - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -98,8 +98,8 @@ fun case_9(x: Any?) { inline fun case_10(x: Any?) { if (x is T is K is L) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -107,8 +107,8 @@ inline fun case_10(x: Any?) { inline fun case_11(x: Any?) { if (x is Int !is K !is T !is L) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -116,8 +116,8 @@ inline fun case_11(x: Any?) { inline fun case_12(x: Any?) { if (x !is K !is T !is L) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -125,8 +125,8 @@ inline fun case_12(x: Any?) { inline fun case_13(x: Any?) { if (!(x !is K !is T !is L)) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -134,8 +134,8 @@ inline fun case_13(x: Any?) { inline fun case_14(x: Any?) { if (!(x !is T is Boolean)) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -143,8 +143,8 @@ inline fun case_14(x: Any?) { inline fun case_15(x: Any?) { if (!(x !is T) is Boolean) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -152,8 +152,8 @@ inline fun case_15(x: Any?) { inline fun case_16(x: Any?) { if (((x is K) is T) is L) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -161,8 +161,8 @@ inline fun case_16(x: Any?) { inline fun case_17(x: Any?) { if (x is T is T) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -170,8 +170,8 @@ inline fun case_17(x: Any?) { inline fun case_18(x: Any?) { if (x !is T is T) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } @@ -179,7 +179,7 @@ inline fun case_18(x: Any?) { inline fun case_19(x: Any?) { if (x is T !is T) { x - x.propAny - x.funAny() + x.propAny + x.funAny() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt index 528fe33429c..a3e18e78507 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt @@ -38,11 +38,11 @@ inline fun case_3(x: Any?) { is T? -> return else -> { x - x.equals(10) + x.equals(10) } } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 4 @@ -51,11 +51,11 @@ inline fun case_4(x: Any?) { is T -> return else -> { x - x.equals(10) + x.equals(10) } } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 5 @@ -72,7 +72,7 @@ inline fun case_5(x: Any?) { inline fun case_6(x: Any?) { if (x is T?) return x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 7 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt index ccd654a62e8..213579890a6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt @@ -27,7 +27,7 @@ fun case_2(x: Boolean?, y: Any?) { if (x == false) return if (y != x) { y - y.equals(10) + y.equals(10) } } @@ -39,7 +39,7 @@ fun case_3(x : Unit?, y : Any?) { if (x == kotlin.Unit) return if (y != x) { y - y.equals(10) + y.equals(10) } } @@ -51,7 +51,7 @@ fun case_4(x : EnumClassSingle?, y : Any?) { if (x == EnumClassSingle.EVERYTHING) return if (y != x) { y - y.equals(10) + y.equals(10) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt index ac3393b0bc1..90152bf3f53 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt @@ -9,7 +9,7 @@ fun case_1(x: Number?): Long? { if (x is Long?) return x x - return x.toLong() + return x.toLong() } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt index fc2fd14f197..35387be3f9a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt @@ -105,7 +105,7 @@ inline fun case_12(x: Any?) { if (x !is T) { if (x is T is K) { x - x.equals(10) + x.equals(10) } } } @@ -115,7 +115,7 @@ inline fun case_13(x: Any?) { if (x !is T) { if (x !is K) { x - x.equals(10) + x.equals(10) } } } @@ -125,7 +125,7 @@ inline fun case_14(x: Any?) { if (x is K) else { if (x !is T) { x - x.equals(10) + x.equals(10) } } } @@ -135,7 +135,7 @@ inline fun case_15(x: Any?) { if (x !is T) { if (x is K) else { x - x.equals(10) + x.equals(10) } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt index 9d0d22d7566..6d4234beba6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt @@ -6,7 +6,7 @@ fun case_1(x: Int?) { if ((x is Int) ?: (x is Int)) { x - x.inv() + x.inv() } } @@ -14,7 +14,7 @@ fun case_1(x: Int?) { fun case_2(x: Int?) { if (x?.equals(1) ?: x is Int) { x - x.inv() + x.inv() } } @@ -22,7 +22,7 @@ fun case_2(x: Int?) { fun case_3(x: Boolean?) { if (x ?: (x != null)) { x - x.not() + x.not() } } @@ -30,7 +30,7 @@ fun case_3(x: Boolean?) { fun case_4(x: Boolean?) { if (if (x != null) x else x != null) { x - x.not() + x.not() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt index 05b2ea29d44..16badd42e67 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt @@ -7,9 +7,9 @@ fun case_1(x: Class?) { if (x?.fun_4()?.fun_4()?.fun_4()?.fun_4() != null) { x x.fun_4() - x.fun_4().fun_4() - x.fun_4().fun_4().fun_4() - x.fun_4().fun_4().fun_4().fun_4() + x.fun_4().fun_4() + x.fun_4().fun_4().fun_4() + x.fun_4().fun_4().fun_4().fun_4() } } @@ -18,7 +18,7 @@ fun case_2(x: Class?) { if (x?.fun_4()?.prop_8 != null) { x x.fun_4() - x.fun_4().prop_8 + x.fun_4().prop_8 } } @@ -27,7 +27,7 @@ fun case_3(x: Class?) { if (x?.prop_8?.fun_4() != null) { x x.prop_8 - x.prop_8.fun_4().prop_8 + x.prop_8.fun_4().prop_8 } } @@ -35,7 +35,7 @@ fun case_3(x: Class?) { fun case_4(x: Class?) { if (x?.prop_8.also { } != null) { x - x.prop_8 - x.prop_8.fun_4() + x.prop_8 + x.prop_8.fun_4() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt index 33826d89042..61dded58f92 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt @@ -10,7 +10,7 @@ fun case_1(x: T?, y: K?) { x.equals(10) z - z.equals(10) + z.equals(10) } // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt index c8701c8a687..6907969c88f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt @@ -10,29 +10,29 @@ fun case_1(x: T) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() x.apply { equals(null) } x.apply { propT } - x.apply { propAny } + x.apply { propAny } x.apply { propNullableT } x.apply { propNullableAny } x.apply { funT() } - x.apply { funAny() } + x.apply { funAny() } x.apply { funNullableT() } x.apply { funNullableAny(); x.equals(null) } x.also { it.equals(null) } x.also { it.propT } - x.also { it.propAny } + x.also { it.propAny } x.also { it.propNullableT } x.also { it.propNullableAny } x.also { it.funT() } - x.also { it.funAny() } + x.also { it.funAny() } x.also { it.funNullableT() } x.also { it.funNullableAny() } } @@ -42,31 +42,31 @@ fun case_1(x: T) { fun case_2(x: T?, y: Nothing?) { if (y != x) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() - x.apply { equals(null) } + x.apply { equals(null) } x.apply { propT } - x.apply { propAny } + x.apply { propAny } x.apply { propNullableT } x.apply { propNullableAny } x.apply { funT() } - x.apply { funAny() } + x.apply { funAny() } x.apply { funNullableT() } - x.apply { funNullableAny(); x.equals(null) } - x.also { it.equals(null) } + x.apply { funNullableAny(); x.equals(null) } + x.also { it.equals(null) } x.also { it.propT } - x.also { it.propAny } + x.also { it.propAny } x.also { it.propNullableT } x.also { it.propNullableAny } x.also { it.funT() } - x.also { it.funAny() } + x.also { it.funAny() } x.also { it.funNullableT() } x.also { it.funNullableAny() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt index 3f1728cb83a..447f74470d2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt @@ -50,13 +50,13 @@ fun case_4(x: Number?) { fun case_5(x: Char?, y: Nothing?) { if (x != y) else return x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -65,13 +65,13 @@ fun case_5(x: Char?, y: Nothing?) { fun case_6(x: Object?) { if (x !== implicitNullableNothingProperty) else { return } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -80,13 +80,13 @@ fun case_6(x: Object?) { fun case_7(x: Class?) { if (x === implicitNullableNothingProperty || false || false || false) { return } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -95,7 +95,7 @@ fun case_7(x: Class?) { fun case_8(x: Int?) { if (false || false || false || x == nullableNothingProperty) return x - x.inv() + x.inv() } // TESTCASE NUMBER: 9 @@ -104,11 +104,11 @@ fun case_9(x: String?) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -192,13 +192,13 @@ fun case_14(x: MutableCollection?) { fun case_15(x: MutableCollection?, y: Nothing?) { if (x != y) else return ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -207,13 +207,13 @@ fun case_15(x: MutableCollection?, y: Nothing?) { fun case_16(x: Collection>>>>>>?) { if (x !== implicitNullableNothingProperty) else { return } >>>>>>?")!>x - >>>>>>?")!>x.equals(null) + >>>>>>?")!>x.equals(null) >>>>>>?")!>x.propT - >>>>>>?")!>x.propAny + >>>>>>?")!>x.propAny >>>>>>?")!>x.propNullableT >>>>>>?")!>x.propNullableAny >>>>>>?")!>x.funT() - >>>>>>?")!>x.funAny() + >>>>>>?")!>x.funAny() >>>>>>?")!>x.funNullableT() >>>>>>?")!>x.funNullableAny() } @@ -222,13 +222,13 @@ fun case_16(x: Collection?) { if (x === implicitNullableNothingProperty || false) { return } ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -237,13 +237,13 @@ fun case_17(x: MutableMap<*, *>?) { fun case_18(x: MutableMap?) { if (false || false || false || x == nullableNothingProperty) return ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -319,13 +319,13 @@ fun case_23(x: Inv?) { fun case_24(x: Inv?, y: Nothing?) { if (x !== y && true) else return ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -384,13 +384,13 @@ fun case_28(x: Number?) { fun case_29(x: Char?, y: Nothing?) = l@ { if (x != y) else return@l x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -400,13 +400,13 @@ fun case_30(x: Object?): Any { return (l@ { if (x !== implicitNullableNothingProperty) else { return@l } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() })() @@ -417,13 +417,13 @@ fun case_31(x: Class?): Any { return l@ { if (x === implicitNullableNothingProperty || false || false || false) { return@l } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -434,13 +434,13 @@ fun case_32(x: Any?) { case_32((l@ { if (false || false || false || x == nullableNothingProperty) return@l x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() })()) @@ -451,13 +451,13 @@ fun case_33(x: Any?) { case_33(l@ { if (x != implicitNullableNothingProperty && true && true && true) else { return@l } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() }) @@ -567,13 +567,13 @@ fun case_39(x: MutableCollection?, y: Nothing?) { (l2@ { if (x != y) else return@l2 ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() })() @@ -584,13 +584,13 @@ fun case_40(x: Collection>>>>>>?")!>x - >>>>>>?")!>x.equals(null) + >>>>>>?")!>x.equals(null) >>>>>>?")!>x.propT - >>>>>>?")!>x.propAny + >>>>>>?")!>x.propAny >>>>>>?")!>x.propNullableT >>>>>>?")!>x.propNullableAny >>>>>>?")!>x.funT() - >>>>>>?")!>x.funAny() + >>>>>>?")!>x.funAny() >>>>>>?")!>x.funNullableT() >>>>>>?")!>x.funNullableAny() })() @@ -601,13 +601,13 @@ fun case_41(x: MutableMap<*, *>?) { listOf(l@ { if (x === implicitNullableNothingProperty || false) { return@l } ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() }) @@ -618,13 +618,13 @@ fun case_42(x: MutableMap?) { return (l@ { if (false || false || false || x == nullableNothingProperty) return@l ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() })() @@ -712,13 +712,13 @@ fun case_48(x: Inv?, y: Nothing?) { val y = ((((l@ { if (x !== y && true) else return@l ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() })))) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt index 3fd920f67d1..462d5c8da62 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt @@ -49,13 +49,13 @@ fun case_4(x: Number?) { fun case_5(x: Char?, y: Nothing?) { if (x != y) else throw Exception() x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -64,13 +64,13 @@ fun case_5(x: Char?, y: Nothing?) { fun case_6(x: Object?) { if (x !== implicitNullableNothingProperty) else { throw Exception() } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -79,13 +79,13 @@ fun case_6(x: Object?) { fun case_7(x: Class?) { if (x === implicitNullableNothingProperty || false || false || false) { throw Exception() } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -94,7 +94,7 @@ fun case_7(x: Class?) { fun case_8(x: Int?) { if (false || false || false || x == nullableNothingProperty) throw Exception() x - x.inv() + x.inv() } // TESTCASE NUMBER: 9 @@ -103,11 +103,11 @@ fun case_9(x: String?) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -191,13 +191,13 @@ fun case_14(x: MutableCollection?) { fun case_15(x: MutableCollection?, y: Nothing?) { if (x != y) else throw Exception() ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -206,13 +206,13 @@ fun case_15(x: MutableCollection?, y: Nothing?) { fun case_16(x: Collection>>>>>>?) { if (x !== implicitNullableNothingProperty) else { throw Exception() } >>>>>>?")!>x - >>>>>>?")!>x.equals(null) + >>>>>>?")!>x.equals(null) >>>>>>?")!>x.propT - >>>>>>?")!>x.propAny + >>>>>>?")!>x.propAny >>>>>>?")!>x.propNullableT >>>>>>?")!>x.propNullableAny >>>>>>?")!>x.funT() - >>>>>>?")!>x.funAny() + >>>>>>?")!>x.funAny() >>>>>>?")!>x.funNullableT() >>>>>>?")!>x.funNullableAny() } @@ -221,13 +221,13 @@ fun case_16(x: Collection?) { if (x === implicitNullableNothingProperty || false) { throw Exception() } ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -236,13 +236,13 @@ fun case_17(x: MutableMap<*, *>?) { fun case_18(x: MutableMap?) { if (false || false || false || x == nullableNothingProperty) throw Exception() ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -318,13 +318,13 @@ fun case_23(x: Inv?) { fun case_24(x: Inv?, y: Nothing?) { if (x !== y && true) else throw Exception() ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } @@ -333,13 +333,13 @@ fun case_24(x: Inv?, y: Nothing?) { fun case_25(x: Inv?, y: Nothing?) { if (x !== y) else try { throw Exception() } finally { throw Exception() } ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt index 973070c70d5..6e1c672f4d2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt @@ -58,13 +58,13 @@ fun case_5(x: Char?, y: Nothing?, f: Boolean) { do { if (x != y) else continue x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } while (f) @@ -75,13 +75,13 @@ fun case_6(x: Object?, f: Boolean) { while (f) { if (x !== implicitNullableNothingProperty) else { continue } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -92,13 +92,13 @@ fun case_7(x: Class?, list: List) { for (element in list) { if (x === implicitNullableNothingProperty || false || false || false) { break } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -109,7 +109,7 @@ fun case_8(x: Int?) { for (i in 0..10) { if (false || false || false || x == nullableNothingProperty) continue x - x.inv() + x.inv() } } @@ -118,7 +118,7 @@ fun case_9(list: List) { for (element in list) { if (element != implicitNullableNothingProperty && true && true && true) else { break } element - element.inv() + element.inv() } } @@ -127,13 +127,13 @@ fun case_10(x: Float?) { while (false) { if (true && true && true && x !== null) else break x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -205,9 +205,9 @@ fun case_15(map: MutableMap, y: Nothing?) { if (k != y) else break if (v != y) else continue k - k.inv() + k.inv() v - v.inv() + v.inv() } } @@ -216,9 +216,9 @@ fun case_16(map: Map) { for ((k, v) in map) { if (k !== implicitNullableNothingProperty && v !== implicitNullableNothingProperty) else { continue } k - k.inv() + k.inv() v - v.inv() + v.inv() } } @@ -227,13 +227,13 @@ fun case_17(x: T?, f: Boolean) { while (f) { if (x === implicitNullableNothingProperty || false) { break } x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -246,11 +246,11 @@ fun case_18(x: T, f: Boolean) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -263,21 +263,21 @@ fun case_19(map: MutableMap, y: Nothing?) { k k.equals(null) k.propT - k.propAny + k.propAny k.propNullableT k.propNullableAny k.funT() - k.funAny() + k.funAny() k.funNullableT() k.funNullableAny() v v.equals(null) v.propT - v.propAny + v.propAny v.propNullableT v.propNullableAny v.funT() - v.funAny() + v.funAny() v.funNullableT() v.funNullableAny() } @@ -377,13 +377,13 @@ fun case_24(x: Inv?, y: Nothing?) { do { if (x !== y && true) else continue ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } while (true) @@ -398,13 +398,13 @@ fun case_25(x: Inv?, y: Nothing?, z: List) { continue } ?")!>x - ?")!>x.equals(null) + ?")!>x.equals(null) ?")!>x.propT - ?")!>x.propAny + ?")!>x.propAny ?")!>x.propNullableT ?")!>x.propNullableAny ?")!>x.funT() - ?")!>x.funAny() + ?")!>x.funAny() ?")!>x.funNullableT() ?")!>x.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt index 02c785698d2..972c726a167 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt @@ -25,13 +25,13 @@ class Case8_16__2 { fun case_1(x: Any?) { if (x != null || false) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -40,14 +40,14 @@ fun case_1(x: Any?) { // TESTCASE NUMBER: 2 fun case_2(a: DeepObject.A.B.C.D.E.F.G.J?) = if (false || a != null == true == false == false == false == true == false == true == false == false == true == true || false) { - a.x - a.equals(null) + a.x + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } else -1 @@ -67,19 +67,19 @@ fun case_3(b: Boolean) { val y = if (b) x else null if (false || false || false || false || y !== null) { - val z = ?")!>y() - ?>?")!>y.equals(null) + val z = ?")!>y() + ?>?")!>y.equals(null) ?>?")!>y.propT - ?>?")!>y.propAny + ?>?")!>y.propAny ?>?")!>y.propNullableT ?>?")!>y.propNullableAny ?>?")!>y.funT() - ?>?")!>y.funAny() + ?>?")!>y.funAny() ?>?")!>y.funNullableT() ?>?")!>y.funNullableAny() if (z != null || false) { - ?")!>z.a + ?")!>z.a } } } @@ -87,14 +87,14 @@ fun case_3(b: Boolean) { // TESTCASE NUMBER: 4 fun case_4(a: ((Float) -> Int?)?, b: Float?) { if (a != null == true && b != null == true || false || false || false || false || false || false || false || false || false) { - val x = a(b) - ?")!>a.equals(null) + val x = a(b) + ?")!>a.equals(null) ?")!>a.propT - ?")!>a.propAny + ?")!>a.propAny ?")!>a.propNullableT ?")!>a.propNullableAny ?")!>a.funT() - ?")!>a.funAny() + ?")!>a.funAny() ?")!>a.funNullableT() ?")!>a.funNullableAny() @@ -125,16 +125,16 @@ fun case_5(b: Boolean) { } else null if (a != null && a.B5 != null && a.B5.C5 != null && a.B5.C5.D5 != null && a.B5.C5.D5.x != null && b || false) { - a.B5.C5.D5.x - a.B5.C5.D5.x.equals(null) - a.B5.C5.D5.x.propT - a.B5.C5.D5.x.propAny - a.B5.C5.D5.x.propNullableT - a.B5.C5.D5.x.propNullableAny - a.B5.C5.D5.x.funT() - a.B5.C5.D5.x.funAny() - a.B5.C5.D5.x.funNullableT() - a.B5.C5.D5.x.funNullableAny() + a.B5.C5.D5.x + a.B5.C5.D5.x.equals(null) + a.B5.C5.D5.x.propT + a.B5.C5.D5.x.propAny + a.B5.C5.D5.x.propNullableT + a.B5.C5.D5.x.propNullableAny + a.B5.C5.D5.x.funT() + a.B5.C5.D5.x.funAny() + a.B5.C5.D5.x.funNullableT() + a.B5.C5.D5.x.funNullableAny() } } @@ -142,13 +142,13 @@ fun case_5(b: Boolean) { fun case_6(z: Boolean?) { if (false || EnumClassWithNullableProperty.B.prop_1 != null && z != null && z) { EnumClassWithNullableProperty.B.prop_1 - EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.equals(null) EnumClassWithNullableProperty.B.prop_1.propT - EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propAny EnumClassWithNullableProperty.B.prop_1.propNullableT EnumClassWithNullableProperty.B.prop_1.propNullableAny EnumClassWithNullableProperty.B.prop_1.funT() - EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funAny() EnumClassWithNullableProperty.B.prop_1.funNullableT() EnumClassWithNullableProperty.B.prop_1.funNullableAny() } @@ -247,14 +247,14 @@ fun case_10(a: DeepObject.A.B.C.D.E.F.G.J?) = if (a == null == true == false == false == false == true == false == true == false == false == true == true && true) { -1 } else { - a.x - a.equals(null) + a.x + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } @@ -274,14 +274,14 @@ fun case_11(b: Boolean) { val y = if (b) x else null if (y === null && true) else { - val z = ?")!>y() - ?>?")!>y.equals(null) + val z = ?")!>y() + ?>?")!>y.equals(null) ?>?")!>y.propT - ?>?")!>y.propAny + ?>?")!>y.propAny ?>?")!>y.propNullableT ?>?")!>y.propNullableAny ?>?")!>y.funT() - ?>?")!>y.funAny() + ?>?")!>y.funAny() ?>?")!>y.funNullableT() ?>?")!>y.funNullableAny() @@ -298,14 +298,14 @@ fun case_12(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { if (true && a == null == true || b == null == true) { } else { - val x = a(b) - ?")!>a.equals(null) + val x = a(b) + ?")!>a.equals(null) ?")!>a.propT - ?")!>a.propAny + ?")!>a.propAny ?")!>a.propNullableT ?")!>a.propNullableAny ?")!>a.funT() - ?")!>a.funAny() + ?")!>a.funAny() ?")!>a.funNullableT() ?")!>a.funNullableAny() b.equals(null) @@ -357,16 +357,16 @@ fun case_13(b: Boolean, c: Boolean, d: Boolean) { if ((a == null || a.B19 == null || a.B19.C19 == null || a.B19.C19.D19 == null || a.B19.C19.D19.x == null || b || c || !d) && true) { } else { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(null) - a.B19.C19.D19.x.propT - a.B19.C19.D19.x.propAny - a.B19.C19.D19.x.propNullableT - a.B19.C19.D19.x.propNullableAny - a.B19.C19.D19.x.funT() - a.B19.C19.D19.x.funAny() - a.B19.C19.D19.x.funNullableT() - a.B19.C19.D19.x.funNullableAny() + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() } } @@ -380,13 +380,13 @@ fun case_14(z: Boolean?) { } else { EnumClassWithNullableProperty.B.prop_1 - EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.equals(null) EnumClassWithNullableProperty.B.prop_1.propT - EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propAny EnumClassWithNullableProperty.B.prop_1.propNullableT EnumClassWithNullableProperty.B.prop_1.propNullableAny EnumClassWithNullableProperty.B.prop_1.funT() - EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funAny() EnumClassWithNullableProperty.B.prop_1.funNullableT() EnumClassWithNullableProperty.B.prop_1.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt index 1c3fc096dca..2fddb835ba8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt @@ -52,8 +52,8 @@ inline fun case_4(x: Any?) { (x as? T)!! if (x is T?) { x - x.length - x.get(0) + x.length + x.get(0) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt index 1c3fc096dca..2fddb835ba8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt @@ -52,8 +52,8 @@ inline fun case_4(x: Any?) { (x as? T)!! if (x is T?) { x - x.length - x.get(0) + x.length + x.get(0) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt index 1c3fc096dca..2fddb835ba8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt @@ -52,8 +52,8 @@ inline fun case_4(x: Any?) { (x as? T)!! if (x is T?) { x - x.length - x.get(0) + x.length + x.get(0) } } 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 fc70e9530eb..61de817a017 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 @@ -11,9 +11,9 @@ fun case_1(x: Class?) { if (x!!.prop_8?.prop_8?.prop_8?.prop_8 != null) { x x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -27,8 +27,8 @@ fun case_2(x: Class?) { x x.prop_8 x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -43,7 +43,7 @@ fun case_3(x: Class?) { x.prop_8 x.prop_8.prop_8 x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 } } @@ -56,9 +56,9 @@ fun case_4(x: Class?) { if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { x x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -72,8 +72,8 @@ fun case_5(x: Class?) { x x.prop_8 x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -88,7 +88,7 @@ fun case_6(x: Class?) { x.prop_8 x.prop_8.prop_8 x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 } } @@ -101,9 +101,9 @@ fun case_7(x: Class) { if (x!!.prop_8?.prop_8?.prop_8?.prop_8 != null) { x x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -116,9 +116,9 @@ fun case_8(x: Class) { if (x!!.prop_8?.prop_8?.prop_8?.prop_8 != null) { x x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } // TESTCASE NUMBER: 9 @@ -136,8 +136,8 @@ fun case_9(x: T) { */ fun case_10(x: Inv?) { if (x!!.prop_1?.prop_1?.prop_1?.prop_2 != null) { - x.prop_1.prop_1.prop_1.prop_2 - x.prop_1.prop_1.prop_1.prop_2.equals(10) + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) } } @@ -148,8 +148,8 @@ fun case_10(x: Inv?) { */ inline fun case_11(x: Inv?) { if (x?.prop_1!!.prop_1?.prop_1?.prop_2 == null) else { - x.prop_1.prop_1.prop_1.prop_2 - x.prop_1.prop_1.prop_1.prop_2.equals(10) + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) } } @@ -161,7 +161,7 @@ inline fun case_11(x: Inv?) { fun case_12(x: Inv?) { if (x?.prop_1?.prop_1?.prop_1!!.prop_1 == null) else { x.prop_1.prop_1.prop_1.prop_1 - x.prop_1.prop_1.prop_1.prop_1.equals(10) + x.prop_1.prop_1.prop_1.prop_1.equals(10) } } @@ -172,7 +172,7 @@ fun case_12(x: Inv?) { */ inline fun case_13(x: Out?) { if (x?.prop_1?.prop_1!!.prop_1?.prop_1 != null) { - x.prop_1.prop_1.prop_1.prop_1 - x.prop_1.prop_1.prop_1.prop_1.equals(10) + x.prop_1.prop_1.prop_1.prop_1 + x.prop_1.prop_1.prop_1.prop_1.equals(10) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt index d2c30cd69ea..0e315921960 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt @@ -11,9 +11,9 @@ fun case_1(x: Any?) { if ((x as Class).prop_8?.prop_8?.prop_8?.prop_8 != null) { x x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -26,9 +26,9 @@ fun case_2(x: Class?) { if ((x as Class).prop_8?.prop_8?.prop_8?.prop_8 !== null) { x x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -40,10 +40,10 @@ fun case_2(x: Class?) { fun case_3(x: Any?) { if ((x as Class?)?.prop_8?.prop_8?.prop_8?.prop_8 == null) else { x - x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8.prop_8 + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 } } @@ -55,10 +55,10 @@ fun case_3(x: Any?) { fun case_4(x: Any?) { if ((x as Class?)!!.prop_8?.prop_8?.prop_8?.prop_8 == null) else { x - x.prop_8 - x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8.prop_8 + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 } } @@ -72,8 +72,8 @@ fun case_5(x: Class?) { x x.prop_8 x.prop_8.prop_8 - x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 } } @@ -88,7 +88,7 @@ fun case_6(x: Class?) { x.prop_8 x.prop_8.prop_8 x.prop_8.prop_8.prop_8 - x.prop_8.prop_8.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt index 7962e99eac4..31947eda671 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt @@ -13,7 +13,7 @@ fun case_1(x: Any?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 2 @@ -24,7 +24,7 @@ fun case_2(x: Any?) { } x - x.equals(10) + x.equals(10) } /* @@ -38,7 +38,7 @@ fun case_3(x: Any?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 4 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt index dc3d3d23c97..68193e742cb 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt @@ -13,7 +13,7 @@ fun case_1(x: Any?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 2 @@ -24,7 +24,7 @@ fun case_2(a: Any?) { } a - a.equals(10) + a.equals(10) } /* @@ -38,7 +38,7 @@ fun case_3(x: Int?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 4 @@ -48,7 +48,7 @@ fun case_4(x: Boolean?) { } x - x.equals(10) + x.equals(10) } /* @@ -62,7 +62,7 @@ fun case_5(x: Boolean?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 6 @@ -72,7 +72,7 @@ fun case_6(x: Boolean?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 7 @@ -82,7 +82,7 @@ fun case_7(x: Boolean?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 8 @@ -110,7 +110,7 @@ fun case_10(x: Boolean?) { } x - x.equals(10) + x.equals(10) } // TESTCASE NUMBER: 11 @@ -147,7 +147,7 @@ fun case_13(x: Boolean?) { } x - x.equals(10) + x.equals(10) } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt index 9b62fcdd1c6..76fd6697ca9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt @@ -97,8 +97,8 @@ fun case_10(x: Any?) { */ fun case_11(x: Any?) { if ((x as Boolean?)!!) { - x.not() - select(x).not() + x.not() + select(x).not() } } @@ -121,8 +121,8 @@ fun case_12(x: Any?) { */ fun case_13(x: Any?) { if (x as Boolean? ?: x!!) { - x.not() - select(x).not() + x.not() + select(x).not() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt index 8a474faaf97..b36b084f65c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt @@ -13,7 +13,7 @@ import kotlin.reflect.* fun case_1(x: Int?) { if (x != funNothingQuest() == true) { x - x.inv() + x.inv() } } @@ -26,7 +26,7 @@ fun case_2(x: Int?) { operator fun Nothing?.not() = null if (x != !null != false) { x - x.inv() + x.inv() } } @@ -50,7 +50,7 @@ fun case_3(x: Int?) { fun case_4(x: Int?, y: List) { if (x == y[0] == true) { x - x.inv() + x.inv() } } @@ -66,7 +66,7 @@ fun case_5(x: Int?) { if (x == y.z == true) { x - x.inv() + x.inv() } } @@ -80,7 +80,7 @@ fun case_6(x: Int?) { if (x == y == true) { x - x.inv() + x.inv() } } @@ -97,7 +97,7 @@ fun case_7(x: Int?) { if (x == y.z == true) { x - x.inv() + x.inv() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt index 9415700500e..f8f56b1e824 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt @@ -89,7 +89,7 @@ fun T.case_9() = this fun case_9() { var x: Int? = 10 x = null - x.case_9() + x.case_9() } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt index ce11b7f0721..beab8636a9b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt @@ -142,7 +142,7 @@ fun case_11() { x as? Any ?: null!! do { x - x = x.equals(10) + x = x.equals(10) } while (x != null) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt index 3f6e10f3772..19514767c5f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt @@ -19,13 +19,13 @@ fun case_1(x: Any?) { val y = null if (x != y) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -51,13 +51,13 @@ fun case_3() { if (Object.prop_1 == y) else { Object.prop_1 - Object.prop_1.equals(null) + Object.prop_1.equals(null) Object.prop_1.propT - Object.prop_1.propAny + Object.prop_1.propAny Object.prop_1.propNullableT Object.prop_1.propNullableAny Object.prop_1.funT() - Object.prop_1.funAny() + Object.prop_1.funAny() Object.prop_1.funNullableT() Object.prop_1.funNullableAny() } @@ -67,13 +67,13 @@ fun case_3() { fun case_4(x: Char?, y: Nothing?) { if (x != y && true) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -86,13 +86,13 @@ fun case_5() { if (x !== y) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -104,13 +104,13 @@ fun case_6(x: EmptyClass?, z: Nothing?) { if (x != z && !y) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -122,13 +122,13 @@ fun case_7(x: EmptyObject?) { if (x != y || x != y) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -160,11 +160,11 @@ fun case_9(x: TypealiasNullableString?, y: Nothing?) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -206,11 +206,11 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -240,13 +240,13 @@ fun case_13(x: EmptyClass12_48?, z: Nothing?) = throw Exception() } else { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -268,11 +268,11 @@ fun case_14() { a.x a.x.equals(null) a.x.propT - a.x.propAny + a.x.propAny a.x.propNullableT a.x.propNullableAny a.x.funT() - a.x.funAny() + a.x.funAny() a.x.funNullableT() a.x.funNullableAny() } @@ -309,13 +309,13 @@ fun case_16() { // TESTCASE NUMBER: 17 val case_17 = if (nullableIntProperty === implicitNullableNothingProperty) 0 else { nullableIntProperty - nullableIntProperty.equals(null) + nullableIntProperty.equals(null) nullableIntProperty.propT - nullableIntProperty.propAny + nullableIntProperty.propAny nullableIntProperty.propNullableT nullableIntProperty.propNullableAny nullableIntProperty.funT() - nullableIntProperty.funAny() + nullableIntProperty.funAny() nullableIntProperty.funNullableT() nullableIntProperty.funNullableAny() } @@ -330,13 +330,13 @@ fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Boolean) { if (a != (if (b) x else y) || x !== a) { a - a.equals(null) + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } @@ -363,17 +363,17 @@ fun case_19(b: Boolean) { } } else z - if (a != z && a.B19 !== z && a.B19.C19 != z && a.B19.C19.D19 != z && a.B19.C19.D19.x !== z) { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(null) - a.B19.C19.D19.x.propT - a.B19.C19.D19.x.propAny - a.B19.C19.D19.x.propNullableT - a.B19.C19.D19.x.propNullableAny - a.B19.C19.D19.x.funT() - a.B19.C19.D19.x.funAny() - a.B19.C19.D19.x.funNullableT() - a.B19.C19.D19.x.funNullableAny() + if (a != z && a.B19 !== z && a.B19.C19 != z && a.B19.C19.D19 != z && a.B19.C19.D19.x !== z) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() } } @@ -391,13 +391,13 @@ fun case_20(x: Boolean, y: Nothing?) { if (z.B19.C19.D19 !== y) { z.B19.C19.D19 - z.B19.C19.D19.equals(null) + z.B19.C19.D19.equals(null) z.B19.C19.D19.propT - z.B19.C19.D19.propAny + z.B19.C19.D19.propAny z.B19.C19.D19.propNullableT z.B19.C19.D19.propNullableAny z.B19.C19.D19.funT() - z.B19.C19.D19.funAny() + z.B19.C19.D19.funAny() z.B19.C19.D19.funNullableT() z.B19.C19.D19.funNullableAny() } @@ -407,13 +407,13 @@ fun case_20(x: Boolean, y: Nothing?) { fun case_21() { if (EnumClassWithNullableProperty.A.prop_1 !== implicitNullableNothingProperty) { EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.equals(null) EnumClassWithNullableProperty.A.prop_1.propT - EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propAny EnumClassWithNullableProperty.A.prop_1.propNullableT EnumClassWithNullableProperty.A.prop_1.propNullableAny EnumClassWithNullableProperty.A.prop_1.funT() - EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funAny() EnumClassWithNullableProperty.A.prop_1.funNullableT() EnumClassWithNullableProperty.A.prop_1.funNullableAny() } @@ -422,14 +422,14 @@ fun case_21() { // TESTCASE NUMBER: 22 fun case_22(a: (() -> Unit)?) { if (a != implicitNullableNothingProperty) { - a() - ?")!>a.equals(null) + a() + ?")!>a.equals(null) ?")!>a.propT - ?")!>a.propAny + ?")!>a.propAny ?")!>a.propNullableT ?")!>a.propNullableAny ?")!>a.funT() - ?")!>a.funAny() + ?")!>a.funAny() ?")!>a.funNullableT() ?")!>a.funNullableAny() } @@ -438,16 +438,16 @@ fun case_22(a: (() -> Unit)?) { // TESTCASE NUMBER: 23 fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { if (a != z && b !== z && b !== z) { - val x = a(b) + val x = a(b) if (x != z || x !== implicitNullableNothingProperty) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -457,23 +457,23 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { // TESTCASE NUMBER: 24 fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) = if (a !== z && b !== z) { - a(?")!>b) - , kotlin.Unit>?")!>a.equals(null) + a(?")!>b) + , kotlin.Unit>?")!>a.equals(null) , kotlin.Unit>?")!>a.propT - , kotlin.Unit>?")!>a.propAny + , kotlin.Unit>?")!>a.propAny , kotlin.Unit>?")!>a.propNullableT , kotlin.Unit>?")!>a.propNullableAny , kotlin.Unit>?")!>a.funT() - , kotlin.Unit>?")!>a.funAny() + , kotlin.Unit>?")!>a.funAny() , kotlin.Unit>?")!>a.funNullableT() , kotlin.Unit>?")!>a.funNullableAny() - ?")!>b.equals(null) + ?")!>b.equals(null) ?")!>b.propT - ?")!>b.propAny + ?")!>b.propAny ?")!>b.propNullableT ?")!>b.propNullableAny ?")!>b.funT() - ?")!>b.funAny() + ?")!>b.funAny() ?")!>b.funNullableT() ?")!>b.funNullableAny() } else z @@ -489,17 +489,17 @@ fun case_25(b: Boolean, z: Nothing?) { val y = if (b) x else z if (y !== z || y != implicitNullableNothingProperty) { - val z1 = ?")!>y() + val z1 = ?")!>y() if (z1 != z && implicitNullableNothingProperty !== z1) { - ?")!>z1.a - ?")!>z1.equals(null) + ?")!>z1.a + ?")!>z1.equals(null) ?")!>z1.propT - ?")!>z1.propAny + ?")!>z1.propAny ?")!>z1.propNullableT ?")!>z1.propNullableAny ?")!>z1.funT() - ?")!>z1.funAny() + ?")!>z1.funAny() ?")!>z1.funNullableT() ?")!>z1.funNullableAny() } @@ -511,16 +511,16 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) { var z = null if (a != z == true && b != implicitNullableNothingProperty == true) { - val x = a(b) + val x = a(b) if (x != implicitNullableNothingProperty == true || z !== x) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -532,13 +532,13 @@ fun case_27(z: Nothing?) { if (Object.prop_1 == z == true == true == true == true == true == true == true == true == true == true == true == true == true == true) else { Object.prop_1 - Object.prop_1.equals(null) + Object.prop_1.equals(null) Object.prop_1.propT - Object.prop_1.propAny + Object.prop_1.propAny Object.prop_1.propNullableT Object.prop_1.propNullableAny Object.prop_1.funT() - Object.prop_1.funAny() + Object.prop_1.funAny() Object.prop_1.funNullableT() Object.prop_1.funNullableAny() } @@ -547,14 +547,14 @@ fun case_27(z: Nothing?) { // TESTCASE NUMBER: 28 fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = if (a != implicitNullableNothingProperty == true == false == false == false == true == false == true == false == false == true == true) { - a.x - a.equals(null) + a.x + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } else -1 @@ -575,17 +575,17 @@ fun case_29(x: Boolean) { val y = if (x) z else null if (false || false || false || false || y !== v) { - val t = ?")!>y() + val t = ?")!>y() if (z !== t || false) { - ?")!>t.a - ?")!>t.equals(null) + ?")!>t.a + ?")!>t.equals(null) ?")!>t.propT - ?")!>t.propAny + ?")!>t.propAny ?")!>t.propNullableT ?")!>t.propNullableAny ?")!>t.funT() - ?")!>t.funAny() + ?")!>t.funAny() ?")!>t.funNullableT() ?")!>t.funNullableAny() } @@ -595,16 +595,16 @@ fun case_29(x: Boolean) { // TESTCASE NUMBER: 30 fun case_30(a: ((Float) -> Int?)?, b: Float?) { if (implicitNullableNothingProperty != a == true && b != implicitNullableNothingProperty == true || false || false || false || false || false || false || false || false || false) { - val x = a(b) + val x = a(b) if (false || implicitNullableNothingProperty != x == true) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -615,13 +615,13 @@ fun case_30(a: ((Float) -> Int?)?, b: Float?) { fun case_31(z1: Boolean?, z: Nothing?) { if (false || EnumClassWithNullableProperty.A.prop_1 != z && z1 !== z && z1) { EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.equals(null) EnumClassWithNullableProperty.A.prop_1.propT - EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propAny EnumClassWithNullableProperty.A.prop_1.propNullableT EnumClassWithNullableProperty.A.prop_1.propNullableAny EnumClassWithNullableProperty.A.prop_1.funT() - EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funAny() EnumClassWithNullableProperty.A.prop_1.funNullableT() EnumClassWithNullableProperty.A.prop_1.funNullableAny() } @@ -632,14 +632,14 @@ fun case_32(a: DeepObject.A.B.C.D.E.F.G.J?) = if (a == implicitNullableNothingProperty == true == false == false == false == true == false == true == false == false == true == true && true) { -1 } else { - a.x - a.equals(null) + a.x + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } @@ -651,18 +651,18 @@ fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { if (true && a == z == true || b == null == true) { } else { - val x = a(b) - if (x == z == true && x === z || (c != z && !c)) { + val x = a(b) + if (x == z == true && x === z || (c != z && !c)) { } else { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -681,13 +681,13 @@ fun case_34(z1: Boolean?) { } else { EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.equals(null) EnumClassWithNullableProperty.A.prop_1.propT - EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propAny EnumClassWithNullableProperty.A.prop_1.propNullableT EnumClassWithNullableProperty.A.prop_1.propNullableAny EnumClassWithNullableProperty.A.prop_1.funT() - EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funAny() EnumClassWithNullableProperty.A.prop_1.funNullableT() EnumClassWithNullableProperty.A.prop_1.funNullableAny() } @@ -807,11 +807,11 @@ fun case_44(x: TypealiasNullableString?, z1: Nothing?) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -953,9 +953,9 @@ fun case_54(b: Boolean) { val z = null - if (a != z && a.B54 !== a.z && a.B54.C54 != a.z && a.B54.C54.D54 != a.z && a.B54.C54.D54.x === a.z) { - a.B54.C54.D54.x - a.B54.C54.D54.x.hashCode() + if (a != z && a.B54 !== a.z && a.B54.C54 != a.z && a.B54.C54.D54 != a.z && a.B54.C54.D54.x === a.z) { + a.B54.C54.D54.x + a.B54.C54.D54.x.hashCode() } } @@ -1022,22 +1022,22 @@ fun case_59(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) { if (false || false || a == z && b === z) { , kotlin.Unit>?")!>a ?")!>b - , kotlin.Unit>?")!>a.equals(null) + , kotlin.Unit>?")!>a.equals(null) , kotlin.Unit>?")!>a.propT - , kotlin.Unit>?")!>a.propAny + , kotlin.Unit>?")!>a.propAny , kotlin.Unit>?")!>a.propNullableT , kotlin.Unit>?")!>a.propNullableAny , kotlin.Unit>?")!>a.funT() - , kotlin.Unit>?")!>a.funAny() + , kotlin.Unit>?")!>a.funAny() , kotlin.Unit>?")!>a.funNullableT() , kotlin.Unit>?")!>a.funNullableAny() - ?")!>b.equals(null) + ?")!>b.equals(null) ?")!>b.propT - ?")!>b.propAny + ?")!>b.propAny ?")!>b.propNullableT ?")!>b.propNullableAny ?")!>b.funT() - ?")!>b.funAny() + ?")!>b.funAny() ?")!>b.funNullableT() ?")!>b.funNullableAny() } @@ -1054,7 +1054,7 @@ fun case_60(b: Boolean) { val y = if (b) x else nullableNothingProperty if (y != nullableNothingProperty) { - val z = ?")!>y() + val z = ?")!>y() if (z == nullableNothingProperty) { ?")!>z @@ -1067,13 +1067,13 @@ fun case_61(x: Any?) { if (x is Number?) { if (x !== implicitNullableNothingProperty) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1085,13 +1085,13 @@ fun case_62(x: Any?) { var z = null if (x is Number? && x is Int? && x != z) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1107,13 +1107,13 @@ fun case_63(x: Any?, b: Boolean) { if (x !== when (b) { true -> z1; false -> z2; else -> z3 }) { if (x is Int?) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1150,13 +1150,13 @@ fun case_65(x: Any?, z: Nothing?) { if (x is ClassLevel5?) { if (x != z) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1178,13 +1178,13 @@ fun case_66(x: Any?, z1: Nothing?, z2: Nothing?, b: Boolean) { if (x != if (b) { z1 } else { z2 } && x is ClassLevel4?) { if (x is ClassLevel5?) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1201,13 +1201,13 @@ fun case_67(x: Any?) { if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1219,13 +1219,13 @@ fun case_68(x: Any?, z: Nothing?) { if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1239,13 +1239,13 @@ fun case_68(x: Any?, z: Nothing?) { fun case_69(x: Any?, z: Nothing?) { if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3? && x is ClassLevel4? && x != try { z } catch (e: Exception) { z } && x is ClassLevel5?) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -1258,25 +1258,25 @@ fun case_70(x: Any?) { } else if (x is ClassLevel5? && x != nullableNothingProperty || x != implicitNullableNothingProperty) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } } else if (x is ClassLevel4? && x !== nullableNothingProperty && x is ClassLevel5?) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt index 35b2c743446..f973a6f5b29 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt @@ -158,7 +158,7 @@ class Case11 { if (y == case_12) throw Exception() y - y.length + y.length } constructor() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt index 22eab5e350a..a47421beaf7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt @@ -22,7 +22,7 @@ fun case_1(x: Any?) { fun case_2(x: Pair<*, *>?) { if (x is Nothing?) return ?")!>x - ?")!>x.equals(10) + ?")!>x.equals(10) } /* @@ -33,7 +33,7 @@ fun case_2(x: Pair<*, *>?) { fun case_3(x: Any?) { if (x is Nothing?) throw Exception() x - x.equals(10) + x.equals(10) } /* @@ -46,11 +46,11 @@ fun case_4(x: Pair<*, *>?) { is Nothing? -> return else -> { ?")!>x - ?")!>x.equals(10) + ?")!>x.equals(10) } } ?")!>x - ?")!>x.equals(10) + ?")!>x.equals(10) } /* @@ -80,9 +80,9 @@ fun case_6(x: Any?) { is Nothing? -> return is Any? -> { x - x.equals(10) + x.equals(10) } } x - x.equals(10) + x.equals(10) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt index 9d2a68bc07b..3aee4686e01 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt @@ -14,7 +14,7 @@ fun case_1(x: Any?) { fun case_2(x: Any?) { (x as Nothing?)!! x - x.inv() + x.inv() } // TESTCASE NUMBER: 3 @@ -29,7 +29,7 @@ fun case_3(x: Any?) { fun case_4(x: Any?) { if (x as Class? is Class) { x - x.prop_1 + x.prop_1 } } @@ -37,7 +37,7 @@ fun case_4(x: Any?) { fun case_5(x: Any?) { if (x as Nothing? is Nothing) { x - x.inv() + x.inv() } } @@ -45,14 +45,14 @@ fun case_5(x: Any?) { fun case_6(x: Any?) { (x as String?)!! x - x.length + x.length } // TESTCASE NUMBER: 7 fun case_7(x: Any?) { if (x as String? != null) { x - x.length + x.length } } @@ -60,6 +60,6 @@ fun case_7(x: Any?) { fun case_8(x: Any?) { if (x as String? == null) { x - x.length + x.length } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt index 1996f458525..b4ad1ffb4be 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt @@ -14,14 +14,14 @@ fun test1(x: ClassLevel1?) { fun case_2(x: Any?) { (x as ClassLevel1?)!! x - x.test1() + x.test1() } // TESTCASE NUMBER: 3 fun case_3(x: Any?) { if (x as ClassLevel1? is ClassLevel1) { x - x.test1() + x.test1() } } @@ -29,7 +29,7 @@ fun case_3(x: Any?) { fun case_4(x: Any?) { if ((x as Class).prop_8 != null) { x - x.prop_8.prop_8 + x.prop_8.prop_8 } } @@ -37,6 +37,6 @@ fun case_4(x: Any?) { fun case_5(x: Class) { if (x!!.prop_8 != null) { x - x.prop_8.prop_8 + x.prop_8.prop_8 } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt index f0c2ef2fb9f..516e0537601 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt @@ -100,13 +100,13 @@ fun case_6(x: Class?) { if (((false || x != null || false) && !y) || x != null) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -311,13 +311,13 @@ val case_17 = if (nullableIntPropert fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Nothing?) { if (a != null || b !== a || false) { a - a.equals(null) + a.equals(null) a.propT - a.propAny + a.propAny a.propNullableT a.propNullableAny a.funT() - a.funAny() + a.funAny() a.funNullableT() a.funNullableAny() } @@ -344,17 +344,17 @@ fun case_19(b: Boolean) { } } else null - if (a != null && a.B19 != a.y && a.B19.C19 != a.y && a.B19.C19.D19 != a.y && a.B19.C19.D19.x != a.y) { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(null) - a.B19.C19.D19.x.propT - a.B19.C19.D19.x.propAny - a.B19.C19.D19.x.propNullableT - a.B19.C19.D19.x.propNullableAny - a.B19.C19.D19.x.funT() - a.B19.C19.D19.x.funAny() - a.B19.C19.D19.x.funNullableT() - a.B19.C19.D19.x.funNullableAny() + if (a != null && a.B19 != a.y && a.B19.C19 != a.y && a.B19.C19.D19 != a.y && a.B19.C19.D19.x != a.y) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() } } @@ -373,13 +373,13 @@ fun case_20(b: Boolean) { if (a.B19.C19.D19 !== null || a.y != a.B19.C19.D19) { a.B19.C19.D19 - a.B19.C19.D19.equals(null) + a.B19.C19.D19.equals(null) a.B19.C19.D19.propT - a.B19.C19.D19.propAny + a.B19.C19.D19.propAny a.B19.C19.D19.propNullableT a.B19.C19.D19.propNullableAny a.B19.C19.D19.funT() - a.B19.C19.D19.funAny() + a.B19.C19.D19.funAny() a.B19.C19.D19.funNullableT() a.B19.C19.D19.funNullableAny() } @@ -406,14 +406,14 @@ fun case_21() { fun case_22(a: (() -> Unit)?) { var y = null if (a != null || y != a) { - a() - ?")!>a.equals(null) + a() + ?")!>a.equals(null) ?")!>a.propT - ?")!>a.propAny + ?")!>a.propAny ?")!>a.propNullableT ?")!>a.propNullableAny ?")!>a.funT() - ?")!>a.funAny() + ?")!>a.funAny() ?")!>a.funNullableT() ?")!>a.funNullableAny() } @@ -422,16 +422,16 @@ fun case_22(a: (() -> Unit)?) { // TESTCASE NUMBER: 23 fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) { if (a != null && b !== null || a != c && b !== c) { - val x = a(b) + val x = a(b) if (x != null || c !== x) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -441,23 +441,23 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) { // TESTCASE NUMBER: 24 fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = if (a !== null && b !== null || implicitNullableNothingProperty != a && nullableNothingProperty !== b) { - a(?")!>b) - , kotlin.Unit>?")!>a.equals(null) + a(?")!>b) + , kotlin.Unit>?")!>a.equals(null) , kotlin.Unit>?")!>a.propT - , kotlin.Unit>?")!>a.propAny + , kotlin.Unit>?")!>a.propAny , kotlin.Unit>?")!>a.propNullableT , kotlin.Unit>?")!>a.propNullableAny , kotlin.Unit>?")!>a.funT() - , kotlin.Unit>?")!>a.funAny() + , kotlin.Unit>?")!>a.funAny() , kotlin.Unit>?")!>a.funNullableT() , kotlin.Unit>?")!>a.funNullableAny() - ?")!>b.equals(null) + ?")!>b.equals(null) ?")!>b.propT - ?")!>b.propAny + ?")!>b.propAny ?")!>b.propNullableT ?")!>b.propNullableAny ?")!>b.funT() - ?")!>b.funAny() + ?")!>b.funAny() ?")!>b.funNullableT() ?")!>b.funNullableAny() } else null @@ -475,7 +475,7 @@ fun case_25(b: Boolean) { if (y !== null || x()!!.b != y) { if (x()!!.b != y) { - val z = ?")!>y() + val z = ?")!>y() if (z != null) { & ?")!>z.a @@ -498,7 +498,7 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) { var c: Nothing? = null if (a != null == true && b != null == true || c != a == true && b != c == true) { - val x = a(b) + val x = a(b) if (x != null == true) { x x.equals(null)