Skip to content

Commit

Permalink
Adjust to upcoming Base Vararg change
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno authored and simeonschaub committed Dec 17, 2020
1 parent fc3b614 commit 2b3b88b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function parametric_type_to_expr(t::Type)
t isa Core.TypeofBottom && return t
t isa UnionAll && (t = t.body)
t = t::DataType
if t <: Vararg
if Base.isvarargtype(t)
return Expr(:(...), t.parameters[1])
end
if t.hasfreetypevars
Expand Down
14 changes: 9 additions & 5 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,16 @@ end
is_leaf(frame::Frame) = frame.callee === nothing

function is_vararg_type(x)
if isa(x, Type)
(x <: Vararg && !(x <: Union{})) && return true
if isa(x, UnionAll)
x = Base.unwrap_unionall(x)
if isa(Vararg, Type)
if isa(x, Type)
(x <: Vararg && !(x <: Union{})) && return true
if isa(x, UnionAll)
x = Base.unwrap_unionall(x)
end
return isa(x, DataType) && nameof(x) == :Vararg
end
return isa(x, DataType) && nameof(x) == :Vararg
else
return isa(x, typeof(Vararg))
end
return false
end
Expand Down

0 comments on commit 2b3b88b

Please sign in to comment.