@@ -674,6 +674,8 @@ function vector_getranges(varinfo::TypedVarInfo, vns::Vector{<:VarName})
674
674
offsets = cumsum (map (vector_length, metadatas))
675
675
# Extract the ranges from each metadata.
676
676
ranges = Vector {UnitRange{Int}} (undef, length (vns))
677
+ # Need to keep track of which ones we've seen.
678
+ not_seen = fill (true , length (vns))
677
679
for (i, metadata) in enumerate (metadatas)
678
680
vns_metadata = filter (Base. Fix1 (haskey, metadata), vns)
679
681
# If none of the variables exist in the metadata, we return an empty array.
@@ -686,13 +688,14 @@ function vector_getranges(varinfo::TypedVarInfo, vns::Vector{<:VarName})
686
688
# NOTE: There might be duplicates in `vns`, so we need to handle that.
687
689
indices = findall (== (vn), vns)
688
690
for idx in indices
691
+ not_seen[idx] = false
689
692
ranges[idx] = r_vn .+ offset
690
693
end
691
694
end
692
695
end
693
696
# Raise key error if any of the variables were not found.
694
- if any (! isassigned, ranges )
695
- inds = findall (! isassigned, ranges )
697
+ if any (not_seen )
698
+ inds = findall (not_seen )
696
699
# Just use a `convert` to get the same type as the input; don't want to confuse by overly
697
700
# specilizing the types in the error message.
698
701
throw (KeyError (convert (typeof (vns), vns[inds])))
0 commit comments