Branch: Tag:

2022-03-17

2022-03-17 12:48:59 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Handle some T_OR nodes in fix_overloaded_type().

Fixes the returned type for indices() and values() in some now
common cases.

Fixes some testsuite failures.

3866:    t = t->cdr;    }    -  /* FIXME: Ought to handle or-nodes here. */ +  /* FIXME: Ought to handle or-nodes generically here. */ +  while (t && (t->type == T_OR)) { +  /* Handle some common cases. */ +  if ((t->car == zero_type_string) || (t->car == void_type_string)) { +  t = t->cdr; +  } else if ((t->cdr == zero_type_string) || (t->cdr == void_type_string)) { +  t = t->car; +  } else { +  break; +  } +  }    if(t && (t->type == T_OBJECT))    {    struct program *p = id_to_program(CDR_TO_INT(t));