diff --git a/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.fir.kt index dfa99aefcaf..603e4a09686 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.fir.kt @@ -72,3 +72,27 @@ fun incompatibleEnumComparisonSmartCast(c: Any?, e: Any?) { c == e } } + +fun incompatibleIdentityRegardlessNullability(a: Int?, b: String?) { + a == b + a === b +} + +fun incompatibleIdentityRegardlessNullabilitySmartCast(a: Any?, b: Any?) { + if (a is Int? && b is String?) { + a == b + a === b + } +} + +fun incompatibleIdentityRegardlessNullabilityWithValueClasses(c: C?, d: D?) { + c == d + c === d +} + +fun incompatibleIdentityRegardlessNullabilityWithValueClassesSmartCast(c: Any?, d: Any?) { + if (c is C? && d is D?) { + c == d + c === d + } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.kt b/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.kt index 563ceff1f78..642896c4767 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/equalityCompatibilityCommonCases.kt @@ -72,3 +72,27 @@ fun incompatibleEnumComparisonSmartCast(c: Any?, e: Any?) { c == e } } + +fun incompatibleIdentityRegardlessNullability(a: Int?, b: String?) { + a == b + a === b +} + +fun incompatibleIdentityRegardlessNullabilitySmartCast(a: Any?, b: Any?) { + if (a is Int? && b is String?) { + a == b + a === b + } +} + +fun incompatibleIdentityRegardlessNullabilityWithValueClasses(c: C?, d: D?) { + c == d + c === d +} + +fun incompatibleIdentityRegardlessNullabilityWithValueClassesSmartCast(c: Any?, d: Any?) { + if (c is C? && d is D?) { + c == d + c === d + } +}