diff --git a/src/Tracing.jl b/src/Tracing.jl index e110407c05..fefc4dfb2f 100644 --- a/src/Tracing.jl +++ b/src/Tracing.jl @@ -961,6 +961,7 @@ function make_tracer( return prev end append_path(@nospecialize(path), i) = (path..., i) +append_path(::Nothing, i) = nothing Base.@nospecializeinfer function make_tracer_via_immutable_constructor( seen, @@ -1283,21 +1284,24 @@ Base.@nospecializeinfer function make_tracer( return nothing end if mode == TracedTrack - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if !haskey(seen, prev) return seen[prev] = prev end return prev end if mode == NoStopTracedTrack - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if !haskey(seen, prev) seen[prev] = prev # don't return! end return prev end if mode == TracedSetPath - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if haskey(seen, prev) return seen[prev] end @@ -1361,21 +1365,24 @@ Base.@nospecializeinfer function make_tracer( return nothing end if mode == TracedTrack - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if !haskey(seen, prev) return seen[prev] = prev end return prev end if mode == NoStopTracedTrack - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if !haskey(seen, prev) seen[prev] = prev # don't return! end return prev end if mode == TracedSetPath - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if haskey(seen, prev) return seen[prev] end @@ -1430,21 +1437,24 @@ Base.@nospecializeinfer function make_tracer( throw("Cannot have MissingTracedValue as function call argument.") end if mode == TracedTrack - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if !haskey(seen, prev) return seen[prev] = prev end return prev end if mode == NoStopTracedTrack - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) if !haskey(seen, prev) seen[prev] = prev # don't return! end return prev end if mode == TracedSetPath - TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) + !isnothing(path) && + TracedUtils.set_paths!(prev, (TracedUtils.get_paths(prev)..., path)) haskey(seen, prev) && return seen[prev] res = MissingTracedValue((path,)) seen[res] = res