Branch: Tag:

1999-11-26

1999-11-26 01:31:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>

match_types() now promotes function(...:void) to function(...:zero)
if the other function does not return void.
This allows eg the construct map(({}), destruct) to work again.

Rev: src/pike_types.c:1.81

5:   \*/   /**/   #include "global.h" - RCSID("$Id: pike_types.c,v 1.80 1999/11/26 01:08:02 grubba Exp $"); + RCSID("$Id: pike_types.c,v 1.81 1999/11/26 01:31:08 grubba Exp $");   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"
1593:    if(!(flags & NO_MAX_ARGS))    max_correct_args=0x7fffffff;    /* check the returntype */ -  if(!low_match_types(a,b,flags)) return 0; +  if ((EXTRACT_UCHAR(b) == T_VOID) && (EXTRACT_UCHAR(a) != T_VOID)) { +  /* Promote b to a function returning zero. */ +  if (!low_match_types(a, tZero, flags)) return 0; +  } else if ((EXTRACT_UCHAR(a) == T_VOID) && (EXTRACT_UCHAR(b) != T_VOID)) { +  /* Promote a to a function returning zero. */ +  if(!low_match_types(tZero,b,flags)) return 0; +  } else if(!low_match_types(a,b,flags)) return 0;    break;       case T_MAPPING:
1933:    /*    * function(:int) <= function(int:int)    * function(int|string:int) <= function(int:int) +  * function(:int) <= function(:void)    * function(string:int) != function(int:int)    * function(int:int) != function(:int)    */