diff --git a/base/inference.jl b/base/inference.jl index b951af1fd9f81..b265ac7e6fc2d 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -1078,7 +1078,7 @@ function abstract_eval(e::ANY, vtypes, sv::StaticVarInfo) elseif is(e.head,:new) t = abstract_eval(e.args[1], vtypes, sv) if isType(t) - t = t.parameters[1] + t = limit_type_depth(t.parameters[1], 0, true, Any[]) else t = Any end diff --git a/test/core.jl b/test/core.jl index 42890cc308bc4..b4d2ce82203f0 100644 --- a/test/core.jl +++ b/test/core.jl @@ -3499,3 +3499,10 @@ let finalize(obj) @test finalized == 1 end + +# non-terminating inference, issue #14009 +type A14009{T} +end +A14009{T}(a::T) = A14009{T}() +f14009(a) = ? ? f14009(A14009(a)) : a +code_typed(f14009, (Int,))