You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It turns out that the failure in errorshow.jl has to do with handling
Varargs. Due to JuliaLang/julia#30995, there is
a check in prepare_call in construct.jl that will punt if any of the args
is a Vararg. But that is the problem, there is not an easy way to test the
different forms of Vararg that come through.
The test is currently elseif any(x->isa(x, Type) && x <: Vararg, allargs)
however, one form of that comes through is x = Vararg{AbstractString,N} where {N}
and isa(x, Type) tests true but x <: Vararg is false. typeof(x) returns
a UnionALL. Another arg that comes through is Vararg{AbstractString,N}, that
is, there is no where clause?! I don't understand how that is possible.
I could not construct a test to get these two, and only these two, using type checking.
For the purposes of testing, I used the brute force approach of elseif any(x->isa(x, Type) && occursin("Vararg", string(x)), allargs) The unit
tests for JuliaInterpreter run OK with this and the following MWE passes, but there should
be a better way to do that, so I did not prepare a PR.
using JuliaInterpreter
include("utils.jl")
module m
method_c1(x::Float64, s::AbstractString...) = true
buf = IOBuffer()
me = Base.MethodError(method_c1,(1, 1, ""))
end
ex = quote
Base.show_method_candidates(buf, me)
end
# TypeError: in Type, in parameter, expected Type, got Vararg{AbstractString,N} where N
frame = JuliaInterpreter.prepare_thunk(m, ex)
JuliaInterpreter.finish_and_return!(frame)
The text was updated successfully, but these errors were encountered:
It turns out that the failure in errorshow.jl has to do with handling
Varargs. Due to JuliaLang/julia#30995, there is
a check in prepare_call in construct.jl that will punt if any of the args
is a Vararg. But that is the problem, there is not an easy way to test the
different forms of Vararg that come through.
The test is currently
elseif any(x->isa(x, Type) && x <: Vararg, allargs)
however, one form of that comes through is
x = Vararg{AbstractString,N} where {N}
and
isa(x, Type)
tests true butx <: Vararg
is false.typeof(x)
returnsa
UnionALL
. Another arg that comes through isVararg{AbstractString,N}
, thatis, there is no where clause?! I don't understand how that is possible.
I could not construct a test to get these two, and only these two, using type checking.
For the purposes of testing, I used the brute force approach of
elseif any(x->isa(x, Type) && occursin("Vararg", string(x)), allargs)
The unittests for JuliaInterpreter run OK with this and the following MWE passes, but there should
be a better way to do that, so I did not prepare a PR.
The text was updated successfully, but these errors were encountered: