Skip to content

Commit

Permalink
Recognize parametric types
Browse files Browse the repository at this point in the history
  • Loading branch information
projekter committed May 1, 2024
1 parent 5ec358a commit 9e0bb67
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,19 @@ function initmeta(m::Module)
nothing
end

struct TypeParams{T<:Tuple} end

function signature!(tv::Vector{Any}, expr::Expr)
is_macrocall = isexpr(expr, :macrocall)
if is_macrocall || isexpr(expr, :call)
sig = :(Union{Tuple{}})
first_arg = is_macrocall ? 3 : 2 # skip function arguments
if isexpr(expr.args[1], :curly)
push!((sig.args[end]::Expr).args, :($TypeParams{Tuple{$((expr.args[1]::Expr).args[2:end]...)}}))
if isempty(tv)
append!(tv, mapany(tvar, (expr.args[1]::Expr).args[2:end]))
end
end
for arg in expr.args[first_arg:end]
isexpr(arg, :parameters) && continue
if isexpr(arg, :kw) # optional arg
Expand Down

0 comments on commit 9e0bb67

Please sign in to comment.