Branch: Tag:

2022-03-01

2022-03-01 14:23:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix matching against mixed.

8160:       /* 'mixed' matches anything */    -  if((a->type == T_ZERO || a->type == T_MIXED) && -  !(flags & (A_EXACT|B_EXACT)) && +  if(((a->type == T_MIXED) || +  ((a->type == T_ZERO) && !(flags & (A_EXACT|B_EXACT)))) &&    (b->type != T_VOID))    { - #if 1 +     ret = NULL;    switch(b->type)    {
8183:    ret = low_match_types(multiset_type_string, b, flags);    break;    } + #if 0 +  if (a->type == T_ZERO) {    if (ret) free_type(ret); -  +  ret = a; +  add_ref(ret); +  } else if (!ret) { +  ret = b; +  add_ref(ret); +  } + #else +  if (ret) free_type(ret); +  ret = a; +  add_ref(ret);   #endif -  add_ref(a); -  return a; +  return ret;    }    -  if((b->type == T_ZERO || b->type == T_MIXED) && -  !(flags & (A_EXACT|B_EXACT)) && +  if(((b->type == T_MIXED) || +  ((b->type == T_ZERO) && !(flags & (A_EXACT|B_EXACT)))) &&    (a->type != T_VOID))    { - #if 1 +     ret = NULL;    switch(a->type)    {
8212:    ret = low_match_types(a, multiset_type_string, flags);    break;    } + #if 0 +  if (b->type == T_ZERO) {    if (ret) free_type(ret); -  +  ret = b; +  add_ref(ret); +  } else if (!ret) { +  ret = a; +  add_ref(ret); +  } + #else +  if (ret) free_type(ret); +  ret = a; +  add_ref(ret);   #endif -  add_ref(a); -  return a; +  return ret;    }       /* Special cases (tm) */