Closed
Description
julia> x = 1.0
# foo() = [x, 1.0, 2.0, 3.0, ...]
julia> @eval foo() = [x, $([Float64(i) for i=1:1000]...)]
foo (generic function with 1 method)
julia> foo()
Internal error: stack overflow in type inference of foo().
This might be caused by recursion over very long tuples or argument lists.
The problematic inference stack looks (roughly) like this:
1. Base.vect(::Any, ::Float64 (1000 times)...)
2. Base.promote_typeof(::Any, ::Float64, ::Float64, ::Float64, ::Float64 (1000 times)...)
3. Base.promote_typeof(::Any, ::Float64 (999 times)...)
4. Base.promote_typeof(::Any, ::Float64 (998 times)...)
5. Base.promote_typeof(::Any, ::Float64 (997 times)...)
etc... (996 more times)
Code like this can apparently end up generated by MTK (SymbolicUtils.Code.create_array
), which is where I encountered this.