MacroTools.jl icon indicating copy to clipboard operation
MacroTools.jl copied to clipboard

Throw an error when encountering missing values

Open MikeInnes opened this issue 3 years ago • 1 comments

JET.jl rightly notes that this function will error if a missing appears inside an expression, and we try to bind it. This is certainly an edge case (and clearly no-one's hit it so far), but strictly speaking missing is allowed in Exprs, and the internal error isn't ideal if someone does hit it. So I've added an explicit error. In future we could add support (probably by assuming missing == missing for the purposes of this check).

Separately: unfortunately, JET/Julia's inference isn't smart enough to figure out that the missing-boolean error no longer applies. Is there some way to assert that env[name]::!Missing, ie anything other than missing? A type assert would be ok, but I'd be a bit reluctant to do anything more complex that sacrifices readability.

MikeInnes avatar May 12 '22 16:05 MikeInnes

Codecov Report

Merging #183 (6972738) into master (639d1a6) will increase coverage by 0.06%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #183      +/-   ##
==========================================
+ Coverage   74.68%   74.75%   +0.06%     
==========================================
  Files           9        9              
  Lines         403      404       +1     
==========================================
+ Hits          301      302       +1     
  Misses        102      102              
Impacted Files Coverage Δ
src/match/match.jl 94.11% <100.00%> (+0.08%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 639d1a6...6972738. Read the comment docs.

codecov-commenter avatar May 12 '22 16:05 codecov-commenter