# Why is Traceur Warning: is assigned as Union{Nothing, Tuple{Int64, Int64}}?

Hello, I am optimizing my code. I have made all the types stable according to @code_warntype, but @trace is still giving me this warning throughout my code

Warning: is assigned as Union{Nothing, Tuple{Int64, Int64}}

The warnings are on all lines referencing graph[n].from e.g.

``````...
for f in graph[n].from
...
if f == fmax
....
``````

Here is the definition of my graph structure

``````struct Node
id::Int
phoneme::Int
from::Array{Int,1}
end

struct Graph
nodes::Array{Node,1}
start::Int
finish::Int
end
``````

Here is the full code with the warning lines marked with >>>

``````>>>for t in 2:duration
total_total::Float64 = 0.0
>>>  for n in 1:node_count(graph)
if n != graph.start
# compute logsumexp([alpha(t-1,f) for f in graph[n].from])
tl = total_likelihood(t,n,graph,alphas,scores)
if tl > -Inf64
# alphas[t,n] =  max + log(sum(e.(xs -. max))) + scores[t,phoneme+1]
>>>                 alphas[t,n] = tl
@fastmath total_total += exp(tl)
end
end
end

#@assert total_total >= 0.0
#@assert total_total <= 1.0

>>> alphas[t,graph.start] = log(1.0 - total_total)
``````

What does this warning mean? Is it a problem? How do I fix it?

Thanks
Peter

1 Like

This is likely not a problem, due to union splitting. An iterator usually returns a `Tuple` or `nothing`, so this is a common type union seen in for loops. I’m unsure what’s happening in `total_likelihood` though, so I’m uncertain if the `alphas` line is an issue.

1 Like

Many thanks Jishnu