File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 363363
364364function check_nothing_equality (x:: EXPR , env:: ExternalEnv )
365365 if isbinarycall (x) && length (x. args) == 3
366- if valof (x. args[1 ]) == " ==" && valof (x. args[3 ]) == " nothing" && refof (x. args[3 ]) === getsymbols (env)[:Core ][:nothing ]
366+ if valof (x. args[1 ]) == " ==" && (
367+ (valof (x. args[2 ]) == " nothing" && refof (x. args[2 ]) === getsymbols (env)[:Core ][:nothing ]) ||
368+ (valof (x. args[3 ]) == " nothing" && refof (x. args[3 ]) === getsymbols (env)[:Core ][:nothing ])
369+ )
367370 seterror! (x. args[1 ], NothingEquality)
368- elseif valof (x. args[1 ]) == " !=" && valof (x. args[3 ]) == " nothing" && refof (x. args[3 ]) === getsymbols (env)[:Core ][:nothing ]
371+ elseif valof (x. args[1 ]) == " !=" && (
372+ (valof (x. args[2 ]) == " nothing" && refof (x. args[2 ]) === getsymbols (env)[:Core ][:nothing ]) ||
373+ (valof (x. args[3 ]) == " nothing" && refof (x. args[3 ]) === getsymbols (env)[:Core ][:nothing ])
374+ )
369375 seterror! (x. args[1 ], NothingNotEq)
370376 end
371377 end
Original file line number Diff line number Diff line change @@ -300,9 +300,12 @@ f(arg) = arg
300300 @test errorof (cst[4 ][2 ][3 ]) === nothing
301301 end
302302
303- let cst = parse_and_pass ( " a == nothing" )
303+ for cst in parse_and_pass .([ " a == nothing" , " nothing == a " ] )
304304 @test errorof (cst[1 ][2 ]) === StaticLint. NothingEquality
305305 end
306+ for cst in parse_and_pass .([" a != nothing" , " nothing != a" ])
307+ @test errorof (cst[1 ][2 ]) === StaticLint. NothingNotEq
308+ end
306309
307310 let cst = parse_and_pass ("""
308311 struct Graph
You can’t perform that action at this time.
0 commit comments