Branch: Tag:

2021-01-10

2021-01-10 16:25:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Some tuning of handling of zero and mixed.

4959:    return NULL;       case TWOT(T_ZERO, T_INT): +  if (!(bflags & PT_FLAG_CMP_NULLABLE)) {    a = int0_type_string; -  +  }    break;       case TWOT(T_INT, T_ZERO): -  +  if (!(aflags & PT_FLAG_CMP_NULLABLE)) {    b = int0_type_string; -  +  }    break;       /* T_TYPE and T_PROGRAM are essentially the same thing. */
5067:    a = b;    goto recur;    } +  +  if (b->type == T_MIXED) { +  /* NB: a being void has been handled above. */ +  if (op == PT_BINOP_MINUS) return NULL; +  return remap_markers(a, NULL, remap, remap_flags); +  } +  if (a->type == T_MIXED) { +  type_stack_mark(); +  push_remap_markers(b, NULL, remap, +  remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); +  if (op == PT_BINOP_MINUS) { +  push_type(T_NOT); +  } +  return pop_unfinished_type(); +  } +     if ((a->type == T_ZERO) && (bflags & PT_FLAG_CMP_NULLABLE)) {    b = a;    goto recur;
5084:    goto recur;    }    -  if (b->type == T_MIXED) { -  /* NB: a being void has been handled above. */ -  if (op == PT_BINOP_MINUS) return NULL; -  return remap_markers(a, NULL, remap, remap_flags); -  } -  if (a->type == T_MIXED) { -  type_stack_mark(); -  push_remap_markers(b, NULL, remap, -  remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS); -  if (op == PT_BINOP_MINUS) { -  push_type(T_NOT); -  } -  return pop_unfinished_type(); -  } -  +     if (((a->type & PIKE_T_MASK) == PIKE_T_OPERATOR) ||    ((b->type & PIKE_T_MASK) == PIKE_T_OPERATOR)) {    type_stack_mark();