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 363
363
364
364
function check_nothing_equality (x:: EXPR , env:: ExternalEnv )
365
365
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
+ )
367
370
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
+ )
369
375
seterror! (x. args[1 ], NothingNotEq)
370
376
end
371
377
end
Original file line number Diff line number Diff line change @@ -300,9 +300,12 @@ f(arg) = arg
300
300
@test errorof (cst[4 ][2 ][3 ]) === nothing
301
301
end
302
302
303
- let cst = parse_and_pass ( " a == nothing" )
303
+ for cst in parse_and_pass .([ " a == nothing" , " nothing == a " ] )
304
304
@test errorof (cst[1 ][2 ]) === StaticLint. NothingEquality
305
305
end
306
+ for cst in parse_and_pass .([" a != nothing" , " nothing != a" ])
307
+ @test errorof (cst[1 ][2 ]) === StaticLint. NothingNotEq
308
+ end
306
309
307
310
let cst = parse_and_pass ("""
308
311
struct Graph
You can’t perform that action at this time.
0 commit comments