Hi everyone,
for today a very simple question: why does Cthulhu seemingly shows
this question is so basic that I feel like I must be missing something.
julia> function overwrite!(arr)
arr[1] = zero(eltype(arr))
return arr
end
overwrite! (generic function with 1 method)
This function is obviously not type unstable, but Cthulhu reports that setindex!
returns Any
.
julia> @descend overwrite!(zeros(3))
overwrite!(arr) @ Main REPL[3]:1
1 function overwrite!(arr::Vector{Float64})::Vector{Float64}
2 arr::Vector{Float64}[1] = zero(eltype(arr::Vector{Float64})::Type{Float64})::Float64
3 return arr::Vector{Float64}
4 end
Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native, [j]ump to source always.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
• eltype(arr::Vector{Float64})
zero(eltype(arr::Vector{Float64})::Type{Float64})
%3 = setindex!(::Vector{Float64},::Float64,::Int64)::Any
↩
overwrite!(arr) @ Main REPL[3]:1
1 function overwrite!(arr::Vector{Float64})::Vector{Float64}
2 arr::Vector{Float64}[1] = zero(eltype(arr::Vector{Float64})::Type{Float64})::Float64
3 return arr::Vector{Float64}
4 end
Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native, [j]ump to source always.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
• eltype(arr::Vector{Float64})
zero(eltype(arr::Vector{Float64})::Type{Float64})
%3 = setindex!(::Vector{Float64},::Float64,::Int64)::Any
↩
@code_warntype
doesnt show anything (as expected)
Is this expected, or a bug?