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:
Arne Welzel 2024-11-06 12:25:19 +01:00
parent e4dbba20a4
commit 189565d131
4 changed files with 27 additions and 3 deletions

View file

@ -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