Skip to content

Commit af7cb7c

Browse files
timholyericphanson
authored andcommitted
Fix a handful of invalidations in expression-checking (JuliaLang#138)
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.
1 parent aefe755 commit af7cb7c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Curl/utils.jl

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ jl_malloc(n::Integer) = ccall(:jl_malloc, Ptr{Cvoid}, (Csize_t,), n)
1414
function check(ex::Expr, lock::Bool)
1515
ex.head == :call ||
1616
error("@check: not a call: $ex")
17-
if ex.args[1] == :ccall
18-
ex.args[2] isa QuoteNode ||
17+
arg1 = ex.args[1] :: Symbol
18+
if arg1 == :ccall
19+
arg2 = ex.args[2]
20+
arg2 isa QuoteNode ||
1921
error("@check: ccallee must be a symbol")
20-
f = ex.args[2].value :: Symbol
22+
f = arg2.value :: Symbol
2123
else
22-
f = ex.args[1] :: Symbol
24+
f = arg1
2325
end
2426
prefix = "$f: "
2527
ex = esc(ex)

0 commit comments

Comments
 (0)