Skip to content

Commit ef96bc5

Browse files
authored
Avoid error on methods(Vararg) (#4)
1 parent cf4058c commit ef96bc5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/visit.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ end
8787

8888
function _visit(@nospecialize(operation), @nospecialize(f::Callable), visited::IdSet{Any}, print::Bool)
8989
f visited && return nothing
90+
f === Vararg && return nothing # methods(Varargs) errors due to Type{Vararg}
9091
push!(visited, f)
9192
print && println("Callable ", f)
9293
if operation(f)

test/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ end
5050
@test Base mods
5151
@test Base.Checked mods
5252
@test length(mods) == length(unique(mods))
53+
54+
# methods(Vararg) throws an error
55+
nitems = Ref(0)
56+
visit(Vararg) do item
57+
nitems[] += 1
58+
true
59+
end
60+
@test nitems[] == 0
5361
end
5462

5563
@testset "Backedges" begin

0 commit comments

Comments
 (0)