From 320f89b77ffa4e620b968265558d16847218a9b8 Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Wed, 13 Mar 2019 10:24:39 +0100 Subject: [PATCH] fix vararg unionall handling --- src/construct.jl | 3 ++- test/interpret.jl | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/construct.jl b/src/construct.jl index 47a63727..0be796a8 100644 --- a/src/construct.jl +++ b/src/construct.jl @@ -206,7 +206,8 @@ function prepare_call(@nospecialize(f), allargs; enter_generated = false) # Can happen for thunks created by generated functions if isa(f, Core.Builtin) || isa(f, Core.IntrinsicFunction) return nothing - elseif any(x->isa(x, Type) && x <: Vararg, allargs) + elseif any(x -> isa(x, Type) && + (x <: Vararg || (typeof(x) in (UnionAll, DataType) && nameof(x) == :Vararg)), allargs) return nothing # https://github.com/JuliaLang/julia/issues/30995 end argtypes = Tuple{map(_Typeof,allargs)...} diff --git a/test/interpret.jl b/test/interpret.jl index 40386440..3eb13e6f 100644 --- a/test/interpret.jl +++ b/test/interpret.jl @@ -370,3 +370,11 @@ end end @test @interpret h_gf() == 2 end + +# https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/130 +@testset "vararg handling" begin + method_c1(x::Float64, s::AbstractString...) = true + buf = IOBuffer() + me = Base.MethodError(method_c1,(1, 1, "")) + @test (@interpret Base.show_method_candidates(buf, me)) == nothing +end