Fix indexing of set/table types with a vector

Previous behavor:

  internal error: bad index type in CompositeHash::ComputeSingletonHash
  Aborted (core dumped)
This commit is contained in:
Jon Siwek 2021-04-14 21:58:14 -07:00
parent fc3438bda5
commit 735ac0b4fa
3 changed files with 45 additions and 2 deletions

View file

@ -22,12 +22,13 @@ CompositeHash::CompositeHash(TypeListPtr composite_type)
{
singleton_tag = TYPE_INTERNAL_ERROR;
// If the only element is a record, don't treat it as a
// If the only element is a record or vector, don't treat it as a
// singleton, since it needs to be evaluated specially.
if ( type->GetTypes().size() == 1 )
{
if ( type->GetTypes()[0]->Tag() == TYPE_RECORD )
if ( type->GetTypes()[0]->Tag() == TYPE_RECORD ||
type->GetTypes()[0]->Tag() == TYPE_VECTOR)
{
is_complex_type = true;
is_singleton = false;