Type inference infinite loop?


julia> versioninfo()
Julia Version 0.6.0-dev.1529
Commit 9ae5e06* (2016-12-08 23:28 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin15.6.0)
  CPU: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, ivybridge)

the following works as expected

julia> begin
           foo(args...) = bar(((),), (), args...)
           bar(scals, mats, lastarg::SparseMatrixCSC) = (scals..., ()), (mats..., lastarg)
           bar(scals, mats, nextarg, remargs...) = bar((Base.front(scals)..., (last(scals)..., nextarg)), mats, remargs...)
           # bar(scals, mats, nextarg::SparseMatrixCSC, remargs...) = bar((scals..., ()), (mats..., nextarg), remargs...)
bar (generic function with 2 methods)

julia> foo(1.0, speye(2))

	[1, 1]  =  1.0
	[2, 2]  =  1.0,))

but the same with the additional bar definition uncommented hangs indefinitely, and on interrupt the trace points to inference. Note that replacing the body of the commented bar definition with e.g. println("narwhal") works fine as well.

Bug, or my error? Thanks!

Now Type inference infinite loop? · Issue #19570 · JuliaLang/julia · GitHub