mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
types: Fix table() resulting in table_type->IsSet() == true
typename(table()) apparently always resulted in a set[] type being rendered. Make the yield type of an unspecified table ANY so that type->IsSet() ends up false. While at it, also render unspecified types as table(), set() and vector() rather than vector of void, set[] or table[] of any which IMO should help to figure out what's going.
This commit is contained in:
parent
e4dbba20a4
commit
189565d131
4 changed files with 27 additions and 3 deletions
17
src/Type.cc
17
src/Type.cc
|
@ -320,11 +320,19 @@ int IndexType::MatchesIndex(detail::ListExpr* const index) const {
|
|||
|
||||
void IndexType::DoDescribe(ODesc* d) const {
|
||||
Type::DoDescribe(d);
|
||||
if ( ! d->IsBinary() )
|
||||
d->Add("[");
|
||||
|
||||
const auto& its = GetIndexTypes();
|
||||
|
||||
// Deal with unspecified table/set.
|
||||
if ( its.empty() ) {
|
||||
if ( ! d->IsBinary() )
|
||||
d->Add("()");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! d->IsBinary() )
|
||||
d->Add("[");
|
||||
|
||||
for ( auto i = 0u; i < its.size(); ++i ) {
|
||||
if ( ! d->IsBinary() && i > 0 )
|
||||
d->Add(",");
|
||||
|
@ -1763,6 +1771,11 @@ int VectorType::MatchesIndex(detail::ListExpr* const index) const {
|
|||
bool VectorType::IsUnspecifiedVector() const { return yield_type->Tag() == TYPE_VOID; }
|
||||
|
||||
void VectorType::DoDescribe(ODesc* d) const {
|
||||
if ( IsUnspecifiedVector() && d->IsReadable() ) {
|
||||
d->Add("vector()");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( d->IsReadable() )
|
||||
d->AddSP("vector of");
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue