Skip to content

Commit b7527ef

Browse files
author
KDr2
committed
fix vararg type prediction prior v1.7
1 parent ff4f33a commit b7527ef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/tapedfunction.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,14 @@ function run_and_record!(tape::Tape, f, args...)
141141
# detect if there is an vararg for f
142142
if length(v_args) == 1
143143
m = which(f, typeof(real_args))
144-
if !isa(m.sig.types[end], Core.TypeofVararg)
144+
no_vararg = @static if VERSION >= v"1.7"
145+
(m.sig <: Tuple) && hasproperty(m.sig, :types) &&
146+
!isa(m.sig.types[end], Core.TypeofVararg)
147+
else
148+
(m.sig <: Tuple) && hasproperty(m.sig, :types) &&
149+
!(m.sig.types[end] <: Vararg{Any})
150+
end
151+
if no_vararg
145152
v_args = v_args[1]
146153
end
147154
end

0 commit comments

Comments
 (0)