diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.kt index 47f1261ef41..8f052f6530b 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 53d7578055b..680f4d71965 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 191e6c3c1fc..327e8273b11 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 0633a92d865..f954bff67f3 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 1a3e930d382..076f593e151 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 799697c6597..2914d63d78d 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 7f20364c055..fcf5c715f73 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 135353bff85..3f5877d797c 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 f8fa330fba3..50a6d0cc510 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 0669629735d..4ed7c2294c1 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 4378b7ecc59..83a74410769 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 7c160fba45c..05c62c6d6d5 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 f684cc63a20..bee9f7f464e 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 e6abe4d7c53..b5ef1f744b1 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 2012d4f0aec..e0aa879b4a3 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 e6cf24145ab..6087af3a99d 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/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/components/ErrorNodeDiagnosticCollectorComponent.kt index 80771809fda..6a2e10ea473 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 @@ -122,7 +122,6 @@ class ErrorNodeDiagnosticCollectorComponent(collector: AbstractDiagnosticCollect rootCause.actualType?.isNullable == true && (rootCause.expectedType == null || !rootCause.expectedType!!.isMarkedNullable) ) { - // TODO: report on call operation node, e.g., x.length instead of x.length val expectedType = rootCause.expectedType if (expectedType == null || expectedType.isEffectivelyNotNull()) { 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 011026d1fb7..83ee92ce381 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 @@ -209,7 +209,7 @@ object FirErrors { val WRONG_IMPLIES_CONDITION by warning0() // Nullability - val UNSAFE_CALL by error1() + val UNSAFE_CALL by error1(SourceElementPositioningStrategies.DOT_BY_SELECTOR) // TODO: val UNSAFE_IMPLICIT_INVOKE_CALL by error1() // TODO: val UNSAFE_INFIX_CALL by ... // TODO: val UNSAFE_OPERATOR_CALL by ... diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 75912ff75ae..676434586c3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -271,6 +271,26 @@ object LightTreePositioningStrategies { return markElement(modifier ?: node, startOffset, endOffset, tree, node) } } + + val DOT_BY_SELECTOR: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark( + node: LighterASTNode, + startOffset: Int, + endOffset: Int, + tree: FlyweightCapableTreeStructure + ): List { + if (node.tokenType != KtNodeTypes.REFERENCE_EXPRESSION && node.tokenType != KtNodeTypes.CALL_EXPRESSION) { + // TODO: normally CALL_EXPRESSION should not be here. In PSI we have REFERENCE_EXPRESSION even for x.bar() case + // Remove CALL_EXPRESSION from here and repeat code below twice (see PSI counterpart) when fixed + return super.mark(node, startOffset, endOffset, tree) + } + val parentNode = tree.getParent(node) ?: return super.mark(node, startOffset, endOffset, tree) + if (parentNode.tokenType == KtNodeTypes.DOT_QUALIFIED_EXPRESSION) { + return markElement(tree.dotOperator(parentNode) ?: node, startOffset, endOffset, tree, node) + } + return super.mark(node, startOffset, endOffset, tree) + } + } } fun FirSourceElement.hasValOrVar(): Boolean = @@ -285,6 +305,9 @@ fun FirSourceElement.hasPrimaryConstructor(): Boolean = private fun FlyweightCapableTreeStructure.constructorKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.CONSTRUCTOR_KEYWORD) +private fun FlyweightCapableTreeStructure.dotOperator(node: LighterASTNode): LighterASTNode? = + findChildByType(node, KtTokens.DOT) + private fun FlyweightCapableTreeStructure.initKeyword(node: LighterASTNode): LighterASTNode? = findChildByType(node, KtTokens.INIT_KEYWORD) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt index deb902c6457..3ba463eeb9b 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -62,4 +62,9 @@ object SourceElementPositioningStrategies { LightTreePositioningStrategies.PARAMETER_VARARG_MODIFIER, PositioningStrategies.PARAMETER_VARARG_MODIFIER ) + + val DOT_BY_SELECTOR = SourceElementPositioningStrategy( + LightTreePositioningStrategies.DOT_BY_SELECTOR, + PositioningStrategies.DOT_BY_SELECTOR + ) } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index ade1bd61250..14fd5581a38 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -703,4 +703,19 @@ object PositioningStrategies { } } } + + val DOT_BY_SELECTOR: PositioningStrategy = object : PositioningStrategy() { + override fun mark(element: PsiElement): List { + when (element) { + is KtNameReferenceExpression -> { + var parent = element + repeat(2) { + parent = parent.parent + (parent as? KtDotQualifiedExpression)?.operationTokenNode?.psi?.let { return mark(it) } + } + } + } + return super.mark(element) + } + } } diff --git a/compiler/testData/diagnostics/tests/BreakContinue.fir.kt b/compiler/testData/diagnostics/tests/BreakContinue.fir.kt index 3dd08bac65a..469ac667bd4 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 e8503b1ae07..a59a6f45cfb 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/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt index a61a47ce9eb..adc7b453dc3 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ForLoopWithExtensionIteratorOnNullable.fir.kt @@ -7,7 +7,7 @@ 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) {} } diff --git a/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValNullability.fir.kt b/compiler/testData/diagnostics/tests/dataFlow/assignment/uninitializedValNullability.fir.kt index cee27e5b00a..f65640dd63f 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/extensions/ExtensionFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt index d97a9489f92..26888c69552 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 97b7009ccad..30a0fe540d1 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?.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 22fe4826bd5..138db690973 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/inference/completion/lambdaWithVariableAndNothing.fir.kt b/compiler/testData/diagnostics/tests/inference/completion/lambdaWithVariableAndNothing.fir.kt index bea156ac175..e9ddf1d9b6f 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 f058a9a90a1..ff15f73a325 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/sam/enhancedSamConstructor.fir.kt b/compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.fir.kt index 5a6c239f2a3..0b5a2d8db28 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/nullabilityAndSmartCasts/InfixCallNullability.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt index 72cd24bbdde..4f3edd28f85 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.fir.kt @@ -13,18 +13,18 @@ fun test(x : Int?, a : A?) { x?.plus(1) x + 1 -x - x.unaryMinus() + x.unaryMinus() x?.unaryMinus() - a.plus(1) + a.plus(1) a?.plus(1) a plus 1 a + 1 -a - a.unaryMinus() + a.unaryMinus() a?.unaryMinus() - a.div(1) + a.div(1) a / 1 a div 1 a?.div(1) @@ -36,6 +36,6 @@ fun test(x : Int?, a : A?) { 1 in a a contains 1 - 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 2f5c6a7e097..afbacdf9d23 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 9e276aeb021..37770900ab6 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() @@ -34,8 +34,8 @@ fun A?.test3() { 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 deleted file mode 100644 index a874fdd3e2d..00000000000 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -//KT-1270 Poor highlighting when trying to dereference a nullable reference - -package kt1270 - -fun foo() { - val sc = java.util.HashMap()[""] - val value = sc.value -} - -private class SomeClass() { - val value : Int = 5 -} diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.kt index 7f56511c759..37992b3da4a 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt1270.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE //KT-1270 Poor highlighting when trying to dereference a nullable reference diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2125.fir.kt index de9fdea7140..cbea5e11219 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 deleted file mode 100644 index 8bf5b4f0e03..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FILE: A.java - -// It's supposed that there is no JSR-305 annotation in classpath -public interface A { - public boolean foo(@javax.annotation.Nullable T y) {} -} - -// FILE: B.java - -public class B { - public static void bar(A y) {} -} - -// FILE: main.kt -fun test() { - B.bar() { it.hashCode() > 0 } -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.kt b/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.kt index 9d7e4b8a14d..68bc08b12d1 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/noAnnotationInClassPath.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java // It's supposed that there is no JSR-305 annotation in classpath diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt deleted file mode 100644 index b283f99169b..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.fir.kt +++ /dev/null @@ -1,45 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// FILE: J.java - -import org.jetbrains.annotations.*; - -public class J { - @NotNull - public static J staticNN; - @Nullable - public static J staticN; - public static J 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 - - platformNN.foo() - platformN.foo() - platformJ.foo() - - with(platformNN) { - foo() - } - with(platformN) { - foo() - } - with(platformJ) { - foo() - } - - platformNN.bar() - platformN.bar() - platformJ.bar() -} - -fun J.foo() {} -fun J?.bar() {} diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.kt index 4ae96335e20..7d60e65caba 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceExtension.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt deleted file mode 100644 index 4422bd3d76e..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.fir.kt +++ /dev/null @@ -1,40 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// FILE: J.java - -import org.jetbrains.annotations.*; - -public class J { - @NotNull - public static J staticNN; - @Nullable - public static J staticN; - public static J staticJ; - - public void foo() {} -} - -// 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 - - platformNN.foo() - platformN.foo() - platformJ.foo() - - with(platformNN) { - foo() - } - with(platformN) { - foo() - } - with(platformJ) { - foo() - } -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.kt index e5623f1313a..b882bf9d42f 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/derefenceMember.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/invoke.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/invoke.fir.kt index f858bc8d56f..8189379f712 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 deleted file mode 100644 index 6bc3106d2f2..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.fir.kt +++ /dev/null @@ -1,24 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// KT-6829 False warning on map to @Nullable - -// FILE: J.java - -import org.jetbrains.annotations.*; - -public class J { - - @Nullable - public String method() { return ""; } -} - -// FILE: k.kt - -fun foo(collection: Collection) { - val mapped = collection.map { it.method() } - mapped[0].length -} - -public fun Iterable.map(transform: (T) -> R): List { - null!! -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt index 672e15d006f..bbd9e2115e9 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/kt6829.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // KT-6829 False warning on map to @Nullable diff --git a/compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/typeEnhancement/overriddenExtensions.fir.kt index 1efd7128a34..6050510761f 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/regressions/kt12898.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt12898.fir.kt index 24aa3ce70c9..f54ea71e143 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/kt557.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt index c48032772db..e5b427e5149 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/implicitInvokeAfterSafeCall.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt index 21bb974a2bc..b47186d0eeb 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 adcc02931d2..a339133b60c 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt @@ -7,7 +7,7 @@ fun test(a: A) { (a.x)("") } "".(a.x)() - a.x("") + a.x("") (a.x)("") with("") { 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 1f172f753b1..ee5b1fb0b16 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt30695_2.fir.kt @@ -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() } diff --git a/compiler/testData/diagnostics/tests/safeCall.fir.kt b/compiler/testData/diagnostics/tests/safeCall.fir.kt index 0fab2d0aaf5..2cdf67aa545 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() = "" diff --git a/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt index eacb222a921..7addcc32b87 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 6cc76dce8d8..48eba2309dd 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 0a93220068b..0a2f990344a 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 e4f801c3529..2553f583b3e 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 0942e634d82..7cb7444019d 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 a0b569474bb..aa9eca4af42 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 195b7264fcc..1789cdb3530 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 deleted file mode 100644 index a97995bf7b1..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.fir.kt +++ /dev/null @@ -1,50 +0,0 @@ -// !LANGUAGE: -BooleanElvisBoundSmartCasts - -interface Order { - val expired: Boolean? - - fun notExpired(): Boolean - - fun doSomething() -} - -fun foo(o: Any) { - val order = o as? Order - if (order?.expired ?: false) { - order.doSomething() - } - else { - - } - if (order?.notExpired() ?: false) { - order.doSomething() - } -} - -fun bar(o: Any) { - val order = o as? Order - if (order?.expired ?: true) { - - } - else { - order!!.doSomething() - } - if (order?.notExpired() ?: true) { - - } - else { - order!!.doSomething() - } -} - -fun baz(o: Boolean?) { - if (o ?: false) { - o.hashCode() - } - if (o ?: true) { - - } - else { - o.hashCode() - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.kt index aa8525d1d2e..c15d4fe3ffc 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOff.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: -BooleanElvisBoundSmartCasts interface Order { diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOn.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/basicOn.fir.kt index 414fb5033f0..89029fb6fd7 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 deleted file mode 100644 index 9f7cab3fbbe..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// Based on KT-9100 -fun test(x: Any?, y: Any?): Any { - val z = x ?: y!! - y.hashCode() - // !! / ?. is necessary here, because y!! above may not be executed - y?.hashCode() - y!!.hashCode() - return z -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.kt b/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.kt index ac6084bbe2c..67ce0a76f2c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvisExclExcl.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // Based on KT-9100 fun test(x: Any?, y: Any?): Any { val z = x ?: y!! diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.fir.kt index 6f98ac66762..b1374cd0426 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 89fe005a236..1bbd7a7008a 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 3279bad6e1c..251e75b1d54 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 92375c17b25..cd23155b55e 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 fe696141e76..33fc365b7a8 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 deleted file mode 100644 index ba139fb72fc..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// !DIAGNOSTICS: -UNNECESSARY_NOT_NULL_ASSERTION -// See KT-9126: Variable change does not affect data flow info for its fields - -class My(val x: Int?) - -fun foo() { - var y: My? = My(42) - if (y!!.x != null) { - y = My(null) - y!!.x.hashCode() - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.kt b/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.kt index 2d406e0dc06..ecd7948c674 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/fieldExclExcl.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNNECESSARY_NOT_NULL_ASSERTION // See KT-9126: Variable change does not affect data flow info for its fields diff --git a/compiler/testData/diagnostics/tests/smartCasts/fieldPlus.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/fieldPlus.fir.kt index e0b0a52ecc2..7ec20a52a1f 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 e59ff0887e9..1c01fc7674d 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/kt32358_2.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/kt32358_2.fir.kt index 1ca5c52cac0..95a8dd74db7 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 f3e92e052df..869bc94e263 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 7fd08a927d0..0707da7903b 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 168d317f4f4..b317ea2382e 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 d33da59cc71..2f7d91038e7 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 9ae054e7a89..a39f757f3df 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 5f6a3ef3f84..096f65c3ec1 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 91cd9cd460a..da00f4a1c6d 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 1c48328167c..d18854ef874 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 0e7ba8e3c8d..c5ae40d008b 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 b9bd9023c2f..9d6fac8fde0 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 deleted file mode 100644 index fc422b57203..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -fun x(): Boolean { return true } - -fun y(): Boolean { return false } - -public fun foo(p: String?): Int { - do { - if (y()) break - // We do not always reach this statement - p!!.length - } while (!x()) - // Here we have do while loop but p is still nullable due to break before - return p.length -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt index bb247bf53d4..7547c07aa97 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileEarlyBreak.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun x(): Boolean { return true } fun y(): Boolean { return false } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt deleted file mode 100644 index 67cac1f788a..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun bar(): Boolean { return true } - -fun foo(s: String?): Int { - do { - if (bar()) break - } while (s!!.length > 0) - // This call is unsafe due to break - return s.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt index 705c0b7bedf..a4408991e01 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileInConditionWithBreak.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun bar(): Boolean { return true } fun foo(s: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt deleted file mode 100644 index 1b666f7e37e..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun x(): Boolean { return true } - -public fun foo(p: String?): Int { - // See KT-6283 - do { - if (p != null) break - } while (!x()) - // p can be null despite of the break - return p.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt index 2fef8ba84eb..5d03080c6a3 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNotNullBreak.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun x(): Boolean { return true } public fun foo(p: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt deleted file mode 100644 index 5bda17d85b3..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun bar(): Boolean { return true } - -fun foo(s: String?): Int { - do { - if (bar()) break - } while (s==null) - // This call is unsafe due to break - return s.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt index 96fc41f637f..11f9189c434 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileNullWithBreak.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun bar(): Boolean { return true } fun foo(s: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisBreakInsideDoWhile.fir.kt index ee74f603b96..d3e04db1587 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 deleted file mode 100644 index 0f01873f47a..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -public fun foo(x: String?, y: String?): Int { - while (true) { - x ?: if (y == null) break - // y is nullable if x != null - y.length - } - // y is null because of the break - return y.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt index b8b04d502f4..ef2399abbe4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL public fun foo(x: String?, y: String?): Int { while (true) { x ?: if (y == null) break diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt deleted file mode 100644 index 0b4a792714c..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -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 can be null because of the break - return y.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt index 45024dd6817..4f8680f4d5f 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/elvisLeftBreakInsideWhileTrue.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL public fun foo(x: String?, y: String?): Int { while (true) { (if (x != null) break else y) ?: y!! diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/ifBreakAssignInsideDoWhile.fir.kt index 98b61acb518..03a54081ba0 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 ec66a50a872..39c51610e2c 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 8234f7efc5a..1540c954cf6 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 9b7d6777452..e7e1e9e1731 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 de8e7ba820a..4a5f10d0dc9 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 47c7213a4ff..29f7fd721fe 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 ce14ee4a22e..4a2ea8d5de4 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 deleted file mode 100644 index 6eaa9dce0c5..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -fun bar(): Boolean { return true } - -fun foo(s: String?): Int { - while (s==null) { - if (bar()) break - } - // Call is unsafe due to break - return s.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt index 156e85dcf9b..97882971faa 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileNullWithBreak.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun bar(): Boolean { return true } fun foo(s: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt deleted file mode 100644 index 292c3289fc8..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun x(): Boolean { return true } - -public fun foo(p: String?): Int { - while(x()) { - p!!.length - if (x()) break - } - // p is nullable because it's possible loop body is not executed at all - return p.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt index a0c7777ef01..6d3f8951a25 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileSimple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun x(): Boolean { return true } public fun foo(p: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt deleted file mode 100644 index a8e4f6eaaa4..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun x(): Boolean { return true } - -public fun foo(p: String?): Int { - // Like whileTrue but 2 == 2 is in use - while(2 == 2) { - p!!.length - if (x()) break - } - // Smart cast should not work in this case, see KT-6284 - return p.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt index dc7d8aeae2b..87ac7643d51 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrivial.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun x(): Boolean { return true } public fun foo(p: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueBreakReturn.fir.kt index f17eb58eed8..ff719629287 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 deleted file mode 100644 index 13bf41a0571..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun x(): Boolean { return true } - -public fun foo(p: String?): Int { - while(true) { - if (x()) break - // We do not always reach this statement - p!!.length - } - // Here we have while (true) loop but p is nullable due to break before - return p.length -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt index 3a9b8232955..33e76cdf465 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/whileTrueEarlyBreak.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun x(): Boolean { return true } public fun foo(p: String?): Int { diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.fir.kt index bd00cf67aa3..304eee4bd4f 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 bc203cb2564..f324ac77928 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 a7c686d1143..5f824e2341b 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 bdd8e40e512..e8928c7d8f1 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 220b5a5acdb..a51ccd9e472 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 3283419eeea..6cbdc76ca22 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/var.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/var.fir.kt index 8b43b66f59c..8b8e840c20a 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 a09a86e9b36..0e78b7fcbc0 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 626a304de1b..3cfad929905 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 6e579a9c4ed..544417a42a3 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 b8eb112e3b9..86be7d57101 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 deleted file mode 100644 index f48d7247887..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.fir.kt +++ /dev/null @@ -1,43 +0,0 @@ -// See KT-11007: Wrong smart cast to not-null type after safe calls in if / when expression - -val String.copy: String - get() = this - -fun foo() { - val s: String? = null - val ss = if (true) { - s?.length - } else { - s?.length - } - ss.hashCode() // Smart-cast to Int, should be unsafe call - val sss = if (true) { - s?.copy - } - else { - s?.copy - } - sss.length -} - -class My { - val String.copy2: String - get() = this - - fun foo() { - val s: String? = null - val ss = if (true) { - s?.length - } else { - s?.length - } - ss.hashCode() - val sss = if (true) { - s?.copy2 - } - else { - s?.copy2 - } - sss.length - } -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.kt index d588ecf52fe..c33faf712f4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/insideIfExpr.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // See KT-11007: Wrong smart cast to not-null type after safe calls in if / when expression val String.copy: String diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt deleted file mode 100644 index 89fa1a6820f..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// See KT-10056 -class Foo(val bar: String) - -fun test(foo: Foo?) { - foo?.bar.let { - // Error, foo?.bar is nullable - it.length - // Error, foo is nullable - foo.bar.length - // Correct - foo?.bar?.length - } -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.kt index 647485c1a2c..016bff46fe1 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiver.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // See KT-10056 class Foo(val bar: String) diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverInLongChain.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverInLongChain.fir.kt index eac3fe6a690..9ecefd65b5b 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 deleted file mode 100644 index 6c6b3d7b15e..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: Foo.java -public class Foo { - public String bar; - - private Foo(String bar) { - this.bar = bar; - } - - public static Foo create(String bar) { - return new Foo(bar); - } -} - -// FILE: Test.kt -fun test() { - val foo = Foo.create(null) - foo?.bar.let { - // Error, foo?.bar is nullable - it.length - // Foo is nullable but flexible, so call is considered safe here - foo.bar.length - // Correct - foo?.bar?.length - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.kt index 4935db0141e..090d64852d7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/safecalls/nullableReceiverWithFlexible.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: Foo.java public class Foo { public String bar; diff --git a/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/safecalls/safeAccessReceiverNotNull.fir.kt index 0aba569f424..35f672f1bd2 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 f46376751e0..291021474ab 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 0a7578ac04c..92db14d822a 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 956fddab24d..7a4517c38a5 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 deleted file mode 100644 index 5d103f9d0d6..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// See KT-27260 - -class A(val x: String?) { - fun foo(other: A) { - when { - x == null && other.x == null -> "1" - x.length > 0 -> "2" - } - } -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.kt b/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.kt index b28bd82c100..cf397f1798a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION // See KT-27260 diff --git a/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.fir.kt index ac6ba703d48..472d38cca3b 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 fe3bf6d9c91..1c423e36f0d 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 8ec130dfe67..bf4e3e6e11e 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 0c7204ecaa3..07ee21341b6 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 8d988515094..6885f08f2de 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 e2f610bd2ea..0b14f9a664a 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 2e72334ca0b..53cdd54a5e3 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/postfixNullableIncrement.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.fir.kt deleted file mode 100644 index 596ca003a75..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Int?.inc(): Int? { return this } - -public fun box(arg: Int?) : Int? { - var i : Int? = arg - var j = i++ - j.toInt() - return i -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.kt index 452815a072d..7aaa63c9b65 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/postfixNullableIncrement.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL operator fun Int?.inc(): Int? { return this } public fun box(arg: Int?) : Int? { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt deleted file mode 100644 index 1a85571d761..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -class MyClass - -// Correct at compile time but wrong at run-time -operator fun MyClass?.inc(): MyClass? { return null } - -public fun box() { - var i : MyClass? - i = MyClass() - // type of j should be MyClass? - var j = ++i - // j is null so call should be unsafe - j.hashCode() -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.kt index ed45c89bd94..b6f51d75cd6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableClassIncrement.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class MyClass // Correct at compile time but wrong at run-time diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt deleted file mode 100644 index 9288f78fe11..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -operator fun Int?.inc(): Int? { return this } - -public fun box(arg: Int?) : Int? { - var i = arg - var j = ++i - j.toInt() - return ++j -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.kt index 21b83aab131..fe55de23b34 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/prefixNullableIncrement.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL operator fun Int?.inc(): Int? { return this } public fun box(arg: Int?) : Int? { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt deleted file mode 100644 index 55e0426d009..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +SoundSmartCastsAfterTry - -fun bar(arg: Any?) = arg - -fun foo() { - var s: String? - s = null - try { - s = "Test" - } catch (ex: Exception) {} - bar(s) - if (s != null) { } - s.hashCode() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.kt index 5cabdad83b5..52b65bd4b48 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +SoundSmartCastsAfterTry fun bar(arg: Any?) = arg diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt deleted file mode 100644 index 07519649c8c..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// !LANGUAGE: +SoundSmartCastsAfterTry - -fun foo() { - var s: String? - s = "Test" - try { - s = null - } catch (ex: Exception) {} - s.hashCode() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.kt index 48f791d2f26..9d7e6105dd7 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +SoundSmartCastsAfterTry fun foo() { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt deleted file mode 100644 index 52ed2372cd6..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// !LANGUAGE: +SoundSmartCastsAfterTry - -fun bar() {} - -fun foo() { - var s: String? - s = "Test" - try { - s = null - } - catch (ex: Exception) {} - finally { - bar() - } - s.hashCode() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.kt index 108b479a032..3c6b160ac90 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +SoundSmartCastsAfterTry fun bar() {} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryUnsound.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryUnsound.fir.kt index faa6fb418dd..f5822f0adb9 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/varNull.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/varNull.fir.kt index 050f108d5fc..73fbbe41bbd 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 deleted file mode 100644 index d939f5286e1..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// FILE: KotlinFile.kt -fun foo(javaClass: JavaClass) { - javaClass.getSomething().length - javaClass.something.length -} - -// FILE: JavaClass.java -import org.jetbrains.annotations.*; - -public class JavaClass { - @Nullable - public String getSomething() { return null; } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt index dfe10b33f48..af23b4eec37 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/TypeAnnotation.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { javaClass.getSomething().length diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt deleted file mode 100644 index 62dbadb3447..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: KotlinFile.kt -fun foo(javaInterface: JavaInterface) { - val value = javaInterface.compute { "" } - value.length -} - -// FILE: JavaInterface.java -import org.jetbrains.annotations.*; - -public interface JavaInterface { - @Nullable - String compute(@NotNull Provider provider); -} - -// FILE: Provider.java -public interface Provider { - public T compute(); -} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt index 1b2ae16b243..339a2552a67 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/ReturnTypeAnnotation.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: KotlinFile.kt fun foo(javaInterface: JavaInterface) { val value = javaInterface.compute { "" } diff --git a/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.fir.kt b/compiler/testData/diagnostics/tests/targetedBuiltIns/forEachRemainingNullability.fir.kt index 225842d3c4c..77dc6f828de 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/when/withSubjectVariable/capturingInInitializer.fir.kt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/capturingInInitializer.fir.kt index ff3ca7cb0a5..2f683f0339d 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 22d8bec9894..e5605332055 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 c68e4f16a15..e9f408fbd5c 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 7d77791f6e6..b9ec0d859bc 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 5b942185d8c..a3f8b51349c 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/nullabilitySmartcastWhenNullability.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.fir.kt index 4afb690ba1c..b155a85fe99 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 cd49f2c178e..2d4b9aefc56 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 31e6a20b5c8..e26d902954e 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 d4cd0aca299..cc764056435 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 deleted file mode 100644 index 934c889f46f..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -val foo = iterator { - yield(0) - val nullable: String? = null - nullable.length - nullable.get(2) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.kt index b4e2ed48a6e..800637930e3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kt36947.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL val foo = iterator { yield(0) val nullable: String? = null 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 f03df720e81..61e34280411 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/smartcasts/letChangesToNotNull.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.fir.kt deleted file mode 100644 index ca9ee064daa..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -// KT-9051: Allow smart cast for captured variables if they are not modified - -fun foo(y: String?) { - var x: String? = null - y?.let { x = it } - x.length // Smart cast is not possible -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.kt index 4d1925cb2ff..f8351d3c9c1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNotNull.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // KT-9051: Allow smart cast for captured variables if they are not modified fun foo(y: String?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/smartcasts/letChangesToNullComplex.fir.kt index 71076c521c4..f2e8cb736fe 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 8e41c4cccbe..8de02b914d9 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 6198ffd2694..641f7d94e6d 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 1e3d0b9beea..6f8a3939007 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 e4d02ce214a..5e7436f0400 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 252ab90a563..5da0dd0a0d6 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 5d3b627ae11..7aa8bdbce75 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 3458df14c11..7627cccf623 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/notLinked/contracts/analysis/common/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.fir.kt index c5adafadcdf..7e8619e31bd 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 15ee30d4812..79675c1390b 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 f621ad1346d..b307dd1035e 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 6241d48e330..43e98cfd178 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 04eeb256a6f..b2bafefdab4 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 1e92240aca7..1e60fb25615 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 b2153d58533..c69828fe00a 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 86c1ce2fec9..3e5cb46bcbf 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 ff2c8a47167..d8c134af56f 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 214075f51f4..f7cb961a66f 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 b6f2561540f..898e0aa9c0d 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 615f0914cd7..e34ca6410b2 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 f7efa9bf4b1..7266c75c17d 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 0a18e90197d..280bc9152a5 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() } @@ -362,15 +362,15 @@ fun case_21() { 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().equals(null) + a().propT + a().propAny + a().propNullableT + a().propNullableAny + a().funT() + a().funAny() + a().funNullableT() + a().funNullableAny() } } @@ -398,13 +398,13 @@ fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = if (a !== null is Boolean && b !== null !is Boolean) { a(?")!>b) a(b) - ?")!>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 @@ -443,13 +443,13 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) { 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 4ee80f19c8e..50ea24660e2 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 01ed2fc397b..ac6cd9a935d 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 6ef6de25fb7..48f60a6a8c8 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 6d4234beba6..79e1fcb4671 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 b6b5c5a1f8e..83f18f2d875 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 bfd8574ab45..29281311324 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 1fe7ee1eb71..44ea11ab5d3 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 15eda2907a9..05f3312dcc5 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 5ebd0bf5fd1..71d43d415ad 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 28e4a41a952..19ec9118af8 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 81536473ecf..9a5d4c663f4 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 08cad2f0ca1..4da5f9b1b57 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 @@ -55,7 +55,7 @@ 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 @@ -76,7 +76,7 @@ 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 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 de66e6e0583..4f19703d7e7 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 7a6af78a908..1f32dd0cb51 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 83a0c6a30f8..dbef0bc6f61 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 c2ae00182c8..eb64aabd76c 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 7c82b872312..74c65c8446c 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 ceaacb181be..14cb2e392c8 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 a9ffdf256fe..c427c09fcf6 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 bba69fbb6fd..f994dc91d35 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 c21d640524a..5857d42bc0e 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 a3e18e78507..d2fa24869ce 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 213579890a6..1b2f19114f8 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 90152bf3f53..ab7a6254b79 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 35387be3f9a..3e56c9a480a 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 6d4234beba6..79e1fcb4671 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 16badd42e67..487cce29809 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 61dded58f92..1ef6103365a 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 6907969c88f..e26b99a1e6c 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,11 +10,11 @@ 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) } @@ -28,11 +28,11 @@ fun case_1(x: T) { 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,13 +42,13 @@ 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) } @@ -59,14 +59,14 @@ fun case_2(x: T?, y: Nothing?) { x.apply { funT() } 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 447f74470d2..09d9d05c8b6 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 462d5c8da62..51074a4fb91 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 6e1c672f4d2..8a24df69d6c 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 972c726a167..fc921ac860d 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 @@ -68,18 +68,18 @@ fun case_3(b: Boolean) { if (false || false || false || false || y !== null) { val z = ?")!>y() - ?>?")!>y.equals(null) + ?>?")!>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 } } } @@ -88,13 +88,13 @@ fun case_3(b: Boolean) { 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) + ?")!>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() } @@ -275,13 +275,13 @@ fun case_11(b: Boolean) { if (y === null && true) else { val z = ?")!>y() - ?>?")!>y.equals(null) + ?>?")!>y.equals(null) ?>?")!>y.propT - ?>?")!>y.propAny + ?>?")!>y.propAny ?>?")!>y.propNullableT ?>?")!>y.propNullableAny ?>?")!>y.funT() - ?>?")!>y.funAny() + ?>?")!>y.funAny() ?>?")!>y.funNullableT() ?>?")!>y.funNullableAny() @@ -299,13 +299,13 @@ fun case_12(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { } else { val x = a(b) - ?")!>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() 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 2fddb835ba8..22bca72ead5 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 2fddb835ba8..22bca72ead5 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 2fddb835ba8..22bca72ead5 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 61de817a017..a2070fc7221 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 0e315921960..f27996473ae 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 31947eda671..45d1ac8ac5d 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 68193e742cb..532eb88281a 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 76fd6697ca9..e94d4d0792b 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 b36b084f65c..002be3a9d40 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/59.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt index beab8636a9b..d33a0d0e271 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 19514767c5f..7a2c794098a 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() } @@ -423,13 +423,13 @@ fun case_21() { fun case_22(a: (() -> Unit)?) { if (a != implicitNullableNothingProperty) { 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() } @@ -441,13 +441,13 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { 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() } @@ -458,22 +458,22 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) = if (a !== z && b !== z) { 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() } else z @@ -492,14 +492,14 @@ fun case_25(b: Boolean, z: Nothing?) { 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() } @@ -514,13 +514,13 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) { 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 @@ -578,14 +578,14 @@ fun case_29(x: Boolean) { 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() } @@ -598,13 +598,13 @@ fun case_30(a: ((Float) -> Int?)?, b: Float?) { 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() } @@ -656,13 +656,13 @@ fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { } 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() } @@ -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 f973a6f5b29..005379fe2c6 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 a47421beaf7..1b28a337f52 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 3aee4686e01..a56cc5ccb1d 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 b4ad1ffb4be..491a877b8cd 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 516e0537601..7b7ff033335 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() } @@ -407,13 +407,13 @@ fun case_22(a: (() -> Unit)?) { var y = null if (a != null || y != 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() } @@ -425,13 +425,13 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) { 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() } @@ -442,22 +442,22 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) { fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = if (a !== null && b !== null || implicitNullableNothingProperty != a && nullableNothingProperty !== b) { 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() } else null