diff --git a/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt b/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt index 64f4440b089..727a3c0f878 100644 --- a/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt +++ b/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt @@ -8,7 +8,7 @@ FILE: main.kt ^ R|/x|.R|kotlin/Any.toString|() } ) - R|/MyFunction|( = MyFunction@fun (x: R|ft!|): R|ft?| { + R|/MyFunction|( = MyFunction@fun (x: R|ft!|): R|kotlin/Any?| { ^ String() } ) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt index 9edad117219..9f79646b701 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt @@ -50,7 +50,12 @@ abstract class AbstractConeSubstitutor : ConeSubstitutor() { is ConeClassErrorType -> return null is ConeClassLikeType -> this.substituteArguments() is ConeLookupTagBasedType -> return null - is ConeFlexibleType -> this.substituteBounds() + is ConeFlexibleType -> this.substituteBounds()?.let { + // TODO: may be (?) it's worth adding regular type comparison via AbstractTypeChecker + // However, the simplified check here should be enough for typical flexible types + if (it.lowerBound == it.upperBound) it.lowerBound + else it + } is ConeCapturedType -> return null is ConeDefinitelyNotNullType -> this.substituteOriginal() is ConeIntersectionType -> this.substituteIntersectedTypes() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt index 197f9d17952..3dbfcd0cc8f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.fir.kt @@ -53,7 +53,7 @@ public class JavaClassCase3{ // TESTCASE NUMBER: 3 fun case3() { val x = JavaClassCase3.id(null) // Nothing! - x + x val a = if (x) { "NOK" } else "NOK"