Default constructor does not show up from methodswith

can’t really describe it in more detail than what is in the title, here is an example:

struct A end

struct B
    a::A
end

println("finds constructor with A param:")
B |> methods |> println
println("does not findconstructor with A:")
A |> methodswith |> println
finds constructor with A param:
# 2 methods for type constructor:
[1] B(a::A) in Main at In[1]:4
[2] B(a) in Main at In[1]:4
does not find constructor with A:
Method[]

I can replicate this with 1.6 and master, but could not find an open issue (#33866 is related, but does not mention this explicitly). I think the problem is this line in InteractiveUtils._methodswith, since constructors are not considered to be Functions.

Please check open issues and consider opening a new one (and link it here) so this will not be forgotten.

Thanks, just did it:

1 Like