From 57500d982aeb4ec58392c69bc4173437c263cfe8 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Fri, 13 Aug 2021 04:34:38 -0500 Subject: [PATCH] Fix a handful of invalidations in expression-checking 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. --- src/Curl/utils.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Curl/utils.jl b/src/Curl/utils.jl index ccae87f..18b7456 100644 --- a/src/Curl/utils.jl +++ b/src/Curl/utils.jl @@ -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)