Closed
Description
This is the weirdest problem I have ever encountered in several years of using Julia and has taken me several hours to track down to debug and distill a minimal working example:
This came up in the context of an unregistered package of mine for working with strided array views (WIP, https://github.com/Jutho/Strided.jl), and only started to be a problem when I pulled the latest master today (I guess before I was working on master from a few days ago, at most two weeks or so).
module Strided
struct StridedView{T,N,A<:DenseArray{T}} <: DenseArray{T,N}
parent::A
size::NTuple{N,Int}
strides::NTuple{N,Int}
end
function Base.convert(T::Type{<:DenseArray}, a::StridedView)
end
@generated function test1(dims::NTuple{N,Int}) where {N}
loopvars = [gensym() for k = 1:N]
return :()
end
function test2()
end
end
dims=(1,)
Strided.test1(dims) #-> code hangs
The hanging will stop under any of the following modifications:
- remove
function test2() end
such that the generated function is the last in the module. - add
@show "hi $N"
as first line oftest1
, however- the "hi" is important,
@show "$N"
is not sufficient - the display output is important,
t=@elapsed "$N"
is not sufficient but@time "hi $N"
is, in fact with@time
thehi
is not necessary - the macro is important,
println("hi $N")
is not sufficient
- the "hi" is important,
- remove the definition of
Base.convert
- simplify the type definition of
StridedView