Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signature fails on method with Vararg #28

Open
BioTurboNick opened this issue Nov 27, 2021 · 3 comments
Open

signature fails on method with Vararg #28

BioTurboNick opened this issue Nov 27, 2021 · 3 comments
Labels
bug Something isn't working signature relating to the signature function to get def from methods

Comments

@BioTurboNick
Copy link

julia> signature(methods(read)[12]) # read(filename::AbstractString, args...) in Base at io.jl:460
ERROR: DomainError with (Vararg{Any}, Core.TypeofVararg):
not a valid type-param
Stacktrace:
  [1] name_of_type
    @ C:\Users\nicho\.julia\packages\ExprTools\4kw5E\src\method.jl:146 [inlined]
  [2] (::ExprTools.var"#13#14")(name::Symbol, type::Core.TypeofVararg)
    @ ExprTools C:\Users\nicho\.julia\packages\ExprTools\4kw5E\src\method.jl:186
  [3] (::Base.var"#4#5"{ExprTools.var"#13#14"})(a::Tuple{Symbol, Core.TypeofVararg})
    @ Base .\generator.jl:36
  [4] iterate
    @ .\generator.jl:47 [inlined]
  [5] collect_to!(dest::Vector{Expr}, itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{Symbol}, Core.SimpleVector}}, Base.var"#4#5"{ExprTools.var"#13#14"}}, offs::Int64, st::Tuple{Int64, Int64})
    @ Base .\array.jl:842
  [6] collect_to_with_first!
    @ .\array.jl:820 [inlined]
  [7] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{Symbol}, Core.SimpleVector}}, Base.var"#4#5"{ExprTools.var"#13#14"}})
    @ Base .\array.jl:794
  [8] map
    @ .\abstractarray.jl:2981 [inlined]
  [9] arguments(m::Method, sig::Type)
    @ ExprTools C:\Users\nicho\.julia\packages\ExprTools\4kw5E\src\method.jl:184
 [10] signature(m::Method; extra_hygiene::Bool)
    @ ExprTools C:\Users\nicho\.julia\packages\ExprTools\4kw5E\src\method.jl:45
 [11] signature(m::Method)
    @ ExprTools C:\Users\nicho\.julia\packages\ExprTools\4kw5E\src\method.jl:40
 [12] top-level scope
    @ REPL[11]:1
@nickrobinson251 nickrobinson251 added bug Something isn't working signature relating to the signature function to get def from methods labels Nov 29, 2021
@nickrobinson251
Copy link
Contributor

which Julia version is this using?
Core.TypeofVararg in the stacktrace suggests this is post-JuliaLang/julia#38136 which i think is in v1.7+
Looks like we need a name_of_type(::TypeofVararg) method (and maybe other changes) to support this

@BioTurboNick
Copy link
Author

Ah okay. Yeah, I was using a master source build because my usage of opaque closures segfaulted on 1.7-rc3.

@nickrobinson251
Copy link
Contributor

Might be as simple as defining

if isdefined(Core, :TypeofVararg)
    name_of_type(x::Core.TypeofVararg) = x
end

🤞

I'm sure a PR would be welcome if you're happy to investigate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working signature relating to the signature function to get def from methods
Projects
None yet
Development

No branches or pull requests

2 participants