Branch: Tag:

2022-06-02

2022-06-02 09:10:04 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: No more implicit nullable for function args.

Fixes multiple warnings from eg check_variant_overload().

5539:    fprintf(stderr, " (%d))\n\n", bvoidable);   #endif    -  /* FIXME: Use implicit nullable only for legacy types. */ +  /* FIXME: Use implicit nullable for legacy types? */    /* NOTE: Intentional use of PT_BINOP_OR below!    * Note that for function types a larger type for    * the arguments implies that the function type
5552:    * than function(zero:mixed).    */    tmp = low_type_binop(PT_BINOP_OR, ai->car, bi->car, remap, -  avoidable | PT_FLAG_CMP_NULLABLE, -  bvoidable | PT_FLAG_CMP_NULLABLE, -  remap_flags); +  avoidable, bvoidable, remap_flags);       /* Advance to the next argument. */    if (ai->type == T_FUNCTION) {
5616:    while (nargs--) {    push_reverse_type(T_FUNCTION);    } +     return pop_unfinished_type();    }    }
5662:    /* Common case */    tmp = NULL;    } else { -  /* FIXME: Use implicit nullable only for legacy types. +  /* FIXME: Use implicit nullable for legacy types?    * FIXME: What about PT_FLAG_CMP_VOID_IS_NULL?    */    tmp = low_type_binop(PT_BINOP_MINUS, bi->car, ai->car, remap, -  bvoidable | PT_FLAG_CMP_NULLABLE | PT_FLAG_CMP_INSEPARABLE, -  avoidable | PT_FLAG_CMP_NULLABLE | PT_FLAG_CMP_INSEPARABLE, +  bvoidable | PT_FLAG_CMP_INSEPARABLE, +  avoidable | PT_FLAG_CMP_INSEPARABLE,    remap_flags ^ PT_FLAG_REMAP_SWAP_MARKERS);    if (tmp) {    /* No or not full overlap. */
5691:    free_type(tmp);       tmp = low_type_binop(PT_BINOP_MINUS, ai->car, bi->car, remap, -  avoidable | PT_FLAG_CMP_NULLABLE | PT_FLAG_CMP_INSEPARABLE, -  bvoidable | PT_FLAG_CMP_NULLABLE | PT_FLAG_CMP_INSEPARABLE, +  avoidable | PT_FLAG_CMP_INSEPARABLE, +  bvoidable | PT_FLAG_CMP_INSEPARABLE,    remap_flags);       if (tmp == ai->car) {
5747:    if (tmp) {    /* Not full overlap for the return value. */    push_finished_type(tmp); -  push_finished_type(a->car); +  push_remap_markers(ai->car, remap, remap_flags);    push_type(T_MANY);    free_type(tmp);    } else {
5763:       if (tmp) {    push_finished_type(tmp); -  push_finished_type(a->car); +  push_remap_markers(a->car, remap, remap_flags);    push_type(PIKE_T_FUNCTION);    free_type(tmp);    } else {
5774:    while (peek_stack_mark() > 1) {    push_type(T_OR);    } +     return pop_unfinished_type();       default: