Skip to content

Commit

Permalink
Fix a handful of invalidations in expression-checking (#138)
Browse files Browse the repository at this point in the history
ChainRulesCore defines `==(a, b::AbstractThunk)` and its converse,
and this invalidates a couple of poorly-typed Symbol checks.
This more "SSA-like" way of writing the code is easier to infer.
  • Loading branch information
timholy authored Aug 16, 2021
1 parent 3870614 commit 25f7af3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Curl/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ jl_malloc(n::Integer) = ccall(:jl_malloc, Ptr{Cvoid}, (Csize_t,), n)
function check(ex::Expr, lock::Bool)
ex.head == :call ||
error("@check: not a call: $ex")
if ex.args[1] == :ccall
ex.args[2] isa QuoteNode ||
arg1 = ex.args[1] :: Symbol
if arg1 == :ccall
arg2 = ex.args[2]
arg2 isa QuoteNode ||
error("@check: ccallee must be a symbol")
f = ex.args[2].value :: Symbol
f = arg2.value :: Symbol
else
f = ex.args[1] :: Symbol
f = arg1
end
prefix = "$f: "
ex = esc(ex)
Expand Down

0 comments on commit 25f7af3

Please sign in to comment.