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

**URL:** <https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322>\
**Category:** Performance\
**Created:** [June 6, 2022, 4:25pm UTC](https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322 "2022-06-06T16:25:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.wolf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter.wolf/32/6018_2.png) [@peter.wolf](https://discourse.julialang.org/u/peter.wolf)\
**Post date:** [June 6, 2022, 4:25pm UTC](https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322/1 "2022-06-06T16:25:57Z")

</div>

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.

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

```

Here is the definition of my graph structure

```julia
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 \>\>\>

```julia
>>>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

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [June 7, 2022, 12:30pm UTC](https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322/2 "2022-06-07T12:30:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![peter.wolf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter.wolf/32/6018_2.png) [@peter.wolf](https://discourse.julialang.org/u/peter.wolf)\
**Post date:** [June 7, 2022, 2:41pm UTC](https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322/3 "2022-06-07T14:41:17Z")

</div>

Many thanks Jishnu
