using Logging, Cthulhu
const glogger = Ref(ConsoleLogger())
function foo(a::Real, b::Real, c::Real, d::Real)
x₁ = b + c + d
e = b + c + d
if e >= 0
x₂ = b + c + d
x₃ = b + c + d
with_logger(() -> @info("x123", x₁, x₂, x₃), glogger[])
end
return x₁, x₂, x₃
end
@descend foo(1, 2, 3, 4)
When I analyze type stability, I find that the types of x2
and x3
cannot be correctly inferred. Does anyone know what is going on please?
3 function foo(a::Int64::Real, b::Int64::Real, c::Int64::Real, d::Int64::Real)::Tuple{Int64, Any, Any}
4 x₁::Int64 = (b::Int64 + c::Int64 + d::Int64)::Int64
5 e::Int64 = (b::Int64 + c::Int64 + d::Int64)::Int64
6 if (e::Int64 >= 0)::Bool
7 x₂ = (b::Int64 + c::Int64 + d::Int64)::Int64
8 x₃ = (b::Int64 + c::Int64 + d::Int64)::Int64
9 with_logger(() -> @info("x123", x₁, x₂, x₃), glogger::Base.RefValue{ConsoleLogger}[]::ConsoleLogger)
10 end
11 return x₁::Int64, x₂::Core.Box, x₃::Core.Box::Any
12 end