Branch: Tag:

2021-02-15

2021-02-15 12:21:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix handling of nullable-void with mixed.

5166:    }       if (a->type != b->type) { -  if ((a->type == T_VOID) && (bflags & PT_FLAG_CMP_VOIDABLE)) { +  if (a->type == T_VOID) { +  if (bflags & PT_FLAG_CMP_VOIDABLE) {    b = a;    goto recur;    } -  if ((b->type == T_VOID) && (aflags & PT_FLAG_CMP_VOIDABLE)) { +  if (aflags & PT_FLAG_CMP_NULLABLE) { +  a = zero_type_string; +  goto recur; +  } +  } +  if (b->type == T_VOID) { +  if (aflags & PT_FLAG_CMP_VOIDABLE) {    a = b;    goto recur;    } -  -  if (((b->type == T_MIXED) && (a->type == T_VOID)) || -  ((a->type == T_MIXED) && (b->type == T_VOID))) { -  switch (op & (PT_BINOP_MINUS | PT_BINOP_INVERSE_MINUS)) { -  case 0: -  return NULL; -  case PT_BINOP_MINUS: -  add_ref(a); -  return a; -  case PT_BINOP_INVERSE_MINUS: -  add_ref(b); -  return b; -  default: -  type_stack_mark(); -  push_finished_type(a); -  push_finished_type(b); -  push_type(T_OR); -  return pop_unfinished_type(); +  if (bflags & PT_FLAG_CMP_NULLABLE) { +  b = zero_type_string; +  goto recur;    }    } -  +  +  if (a->type != T_VOID) {    if (b->type == T_MIXED) {    switch(op & PT_BINOP_B) {    case 0:
5210:    return b;    }    } +  } +  if (b->type != T_VOID) {    if (a->type == T_MIXED) {    switch(op & PT_BINOP_A) {    case 0:
5228:    return a;    }    } +  }       if ((a->type == T_ZERO) && (bflags & PT_FLAG_CMP_NULLABLE)) {    b = a;