Open lgeissbauer-btig opened 1 year ago
by=v -> typeof(v) == Transition ? (v::Transition).utc_datetime : v
@aviatesk why isn't it clear that the v
after the ?
is typeof(v) == Transition
That form isn't inferrable. Use v isa Transition
instead.
@aviatesk why can't JET infere that timezone.cutoff !== nothing
. How to fix it?
═════ 1 possible error found ═════
┌ @ REPL[31]:12 ZonedDateTime(zdt.utc_datetime, tz, zone)
│┌ @ C:\.julia\packages\TimeZones\V28u7\src\types\zoneddatetime.jl:19 utc_datetime TimeZones.:>= timezone.cutoff
││┌ @ operators.jl:429 y <= x
│││┌ @ operators.jl:405 x < y
││││┌ @ operators.jl:356 isless(x, y)
│││││ no matching method found `isless(::Nothing, ::DateTime)`: isless(x::Nothing, y::DateTime)
││││└────
Maybe the timezone.cutoff
field is mutable? Then extract it into a local object.
is not mutable
struct VariableTimeZone <: TimeZone
name::String
transitions::Vector{Transition}
cutoff::Union{DateTime,Nothing}
function VariableTimeZone(name::AbstractString, transitions::Vector{Transition}, cutoff::Union{DateTime,Nothing}=nothing)
new(name, transitions, cutoff)
end
end
From JET.jl