Here is the best I’ve been able to cut it down to:
__precompile__()
module InfBug
immutable A1 end
immutable A2 end
immutable A3 end
immutable A4 end
immutable A5 end
immutable A6 end
immutable A7 end
# Note: one less in the Union, and it doesn't fail
const Ugh = Union{A1, A2, A3, A4, A5, A6, A7}
import Base: convert
immutable Foo
a::Vector{UInt64}
end
convert(::Type{Vector{Foo}}, av::Vector{Any}) = Foo[Foo(vec) for vec in av]
immutable Bar
a::Ugh
b::Vector{UInt64}
end
function convert(::Type{Vector{Bar}}, a::Vector{Ugh},
b::Vector{Vector{UInt64}}=Vector{Vector{UInt64}}())
(isempty(b)
? Vector{Bar}([Bar(i, Vector{UInt64}()) for i in a])
: Vector{Bar}([Bar(i[1], i[2]) for i in zip(a, b)]))
end
end # module
I wasn’t able to get it any smaller than this, it is sensitive to the number of types in the Union, if I comment out one of the convert definitions it also doesn’t fail.
This happens in the call to write_dependency_list at /julia/julia-linux/src/dump.c:1308 [inlined]
during precompilation.
I patched the function in inference.jl to give better information when the assertion fails, this is what it showed:
limit_type_depth: Base.Generator{Base.Iterators.Zip2{Array{Union{InfBug.A1, InfBug.A2, InfBug.A3, InfBug.A4, InfBug.A5, InfBug.A6, InfBug.A7}, 1}, Array{Array{UInt64, 1}, 1}}, InfBug.##2#4} <: Base.Generator{Base.Iterators.Zip2{Array{Any, 1}, Array{Array{UInt64, 1}, 1}}, InfBug.##2#4}
WARNING: An error occurred during inference. Type inference is now partially disabled.
I think that maybe @jeff.bezanson may need to take a look at this.