# Type inference infinite loop?

**URL:** <https://discourse.julialang.org/t/type-inference-infinite-loop/856>\
**Category:** General Usage\
**Created:** [December 11, 2016, 4:28am UTC](https://discourse.julialang.org/t/type-inference-infinite-loop/856 "2016-12-11T04:28:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sacha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sacha/32/2663_2.png) [@sacha](https://discourse.julialang.org/u/sacha)\
**Post date:** [December 11, 2016, 4:28am UTC](https://discourse.julialang.org/t/type-inference-infinite-loop/856/1 "2016-12-11T04:28:25Z")

</div>

Under

```julia
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
  WORD_SIZE: 64
  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
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...)
       end
bar (generic function with 2 methods)

julia> foo(1.0, speye(2))
(((1.0,),()),(

	[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!

---

<div class="post-metadata">

**Author:** ![sacha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sacha/32/2663_2.png) [@sacha](https://discourse.julialang.org/u/sacha)\
**Post date:** [December 13, 2016, 1:32am UTC](https://discourse.julialang.org/t/type-inference-infinite-loop/856/2 "2016-12-13T01:32:07Z")

</div>

Now [Type inference infinite loop? · Issue #19570 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/19570)
