[FIR] Ignore nullability in the definition of "identity-less"

The definition of a "builtin" already
ignores nullability.

`Int? === String?` must trigger a
diagnostic by design.
This commit is contained in:
Nikolay Lunyak
2023-04-19 10:27:17 +03:00
committed by Space Team
parent 5ecedcbb16
commit 8d04ab3142
19 changed files with 179 additions and 176 deletions
@@ -54,7 +54,7 @@ fun test() {
x?.<!NONE_APPLICABLE!>equals<!>(1)
if (get() == null) {}
if (get() === null) {}
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>get() === null<!>) {}
if (x != null) {
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
@@ -113,7 +113,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x.hashCode()
}
@@ -123,7 +123,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x.equals("")
}
@@ -133,7 +133,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x<!UNSAFE_CALL!>.<!>toString("")
}
@@ -143,7 +143,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x<!UNSAFE_CALL!>.<!>test()
}
@@ -170,7 +170,7 @@ fun test() {
x?.<!NONE_APPLICABLE!>equals<!>(1)
if (get() == null) {}
if (get() === null) {}
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>get() === null<!>) {}
if (x == null) {
x?.hashCode()
@@ -188,19 +188,19 @@ fun test() {
x.test2()
}
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x?.hashCode()
}
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x?.<!NONE_APPLICABLE!>equals<!>(1)
}
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x?.test2()
}
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x.test2()
}
@@ -247,7 +247,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x.equals("")
}
@@ -257,7 +257,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x.hashCode()
}
""
@@ -266,7 +266,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x.toString()
}
""
@@ -275,7 +275,7 @@ fun test() {
emit(1)
emit(null)
val x = get()
if (x === null) {
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
x<!UNSAFE_CALL!>.<!>test()
}
""
@@ -300,7 +300,7 @@ fun test() {
x?.<!NONE_APPLICABLE!>equals<!>(1)
if (get() == null) {}
if (get() === null) {}
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>get() === null<!>) {}
if (x == null) {
x?.hashCode()