Branch: Tag:

2020-01-23

2020-01-23 15:32:18 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved type checking.

Fixed issue where constant expressions after evaluation sometimes
got a partially weaker type. Eg: The expression

({ 0, 1, 2, 3 })

gets the type array(int(4bit)) from evaluating the type, but
the type array(4: int) from generating a type from the value.
The code generator now adds a soft-cast to the original type,
causing the resulting type to be array(4: int(4bit)).

Fixes testsuite failures for undumped pikes from eg SSL.Context.

4607:    pop_stack();    return n;    } -  if (n->token == F_SOFT_CAST) { -  new = mksoftcastnode(n->type, mksvaluenode(Pike_sp-1)); -  } else { +     new = mksvaluenode(Pike_sp-1); -  if (n->type && (!new->type || ((n->type != new->type) && -  pike_types_le(n->type,new->type)))) { -  if (new->type) -  free_type(new->type); -  copy_pike_type(new->type, n->type); +  if (n->type && (!new->type || !pike_types_le(new->type, n->type))) { +  new = mksoftcastnode(n->type, new);    } -  } +     free_node(n);    n = new;    pop_stack();