Skip to content

Commit f7008ed

Browse files
committed
fix: also check_nothing_equality against Base.nothing
1 parent 3fd3cfd commit f7008ed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/linting/checks.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,15 @@ end
431431

432432
function check_nothing_equality(x::EXPR, env::ExternalEnv)
433433
if isbinarycall(x) && length(x.args) == 3
434+
nothings = (getsymbols(env)[:Core][:nothing], getsymbols(env)[:Base][:nothing])
434435
if valof(x.args[1]) == "==" && (
435-
(valof(x.args[2]) == "nothing" && refof(x.args[2]) === getsymbols(env)[:Core][:nothing]) ||
436-
(valof(x.args[3]) == "nothing" && refof(x.args[3]) === getsymbols(env)[:Core][:nothing])
436+
(valof(x.args[2]) == "nothing" && refof(x.args[2]) in nothings) ||
437+
(valof(x.args[3]) == "nothing" && refof(x.args[3]) in nothings)
437438
)
438439
seterror!(x.args[1], NothingEquality)
439440
elseif valof(x.args[1]) == "!=" && (
440-
(valof(x.args[2]) == "nothing" && refof(x.args[2]) === getsymbols(env)[:Core][:nothing]) ||
441-
(valof(x.args[3]) == "nothing" && refof(x.args[3]) === getsymbols(env)[:Core][:nothing])
441+
(valof(x.args[2]) == "nothing" && refof(x.args[2]) in nothings) ||
442+
(valof(x.args[3]) == "nothing" && refof(x.args[3]) in nothings)
442443
)
443444
seterror!(x.args[1], NothingNotEq)
444445
end

0 commit comments

Comments
 (0)