UnionType::kMaxTypeCode is 127, so we intend to have codes from 0 to 127. If there is code preventing things from going up to and including 127 it's a bug.
On Sun, Jun 20, 2021 at 3:06 PM Ying Zhou <yzhou7...@gmail.com> wrote: > > Moreover it seems that negative type_codes are banned due to type.cc:622 > <http://type.cc:622/> . Moreover in type_test.cc <http://type_test.cc/> and > array_union_test.cc <http://array_union_test.cc/> type_codes are always > nonnegative. However maybe negative type_codes should be allowed since > type_codes are of type int8_t. Is this also intended? > > > On Jun 20, 2021, at 4:01 PM, Ying Zhou <yzhou7...@gmail.com> wrote: > > > > Hi, > > > > Due to the following in builder_union.cc <http://builder_union.cc/> (Line > > 67-70) > > > > type_id_to_children_.resize(union_type.max_type_code() + 1, nullptr); > > DCHECK_LT( > > type_id_to_children_.size(), > > > > static_cast<decltype(type_id_to_children_)::size_type>(UnionType::kMaxTypeCode)); > > > > and type.cc <http://type.cc/> (Line 640-644) > > uint8_t UnionType::max_type_code() const { > > return type_codes_.size() == 0 > > ? 0 > > : *std::max_element(type_codes_.begin(), type_codes_.end()); > > } > > > > In practice type codes of the union type must always be below or equal to > > 125. Is this intended behavior? > > >