I have an example that is along the lines of
abstract Foo{T}
Base.eltype{T}(::Foo{T})=T
function foo(A::Foo) # assumes eltype(A) is a matrix and eltype(eltype(A))
is a number
ret=Array(Foo{eltype(eltype(T))},0)
push!(ret,anotherfunction(A))
end
This is returning an error like expected Foo{Any}, got Foo{Float64} but
this error only occurs when calling from command line, not line-by-line in
Juno. My feeling is that eltype is being inlined incorrectly, but I have
no idea how to debug it since its inconsistent. I can hack around it by
splitting the command into two but its not ideal:
function foo(AT::Type,A::Foo)
ret=Array(Foo{AT},0)
push!(ret,anotherfunction(A))
end
foo(A::Foo)=foo(eltype(eltype(A)),A)