Changeset 407

Show
Ignore:
Timestamp:
03/04/10 02:16:15 (2 years ago)
Author:
walter
Message:

fix problem with function partial ordering

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/func.c

    r406 r407  
    20032003     */ 
    20042004    match = (MATCH) tf->callMatch(f->needThis() && !f->isCtorDeclaration() ? p->ethis : NULL, arguments); 
    2005     //printf("test: match = %d\n", match); 
     2005    //printf("test1: match = %d\n", match); 
    20062006    if (match != MATCHnomatch) 
    20072007    { 
     
    21652165#if LOG_LEASTAS 
    21662166    printf("%s.leastAsSpecialized(%s)\n", toChars(), g->toChars()); 
     2167    printf("%s, %s\n", type->toChars(), g->type->toChars()); 
    21672168#endif 
    21682169 
     
    22102211    } 
    22112212 
    2212     MATCH m = (MATCH) tg->callMatch(NULL, &args); 
     2213    MATCH m = (MATCH) tg->callMatch(NULL, &args, 1); 
    22132214    if (m) 
    22142215    { 
  • trunk/src/mtype.c

    r402 r407  
    48584858 * 'args' are being matched to function 'this' 
    48594859 * Determine match level. 
     4860 * Input: 
     4861 *  flag    1   performing a partial ordering match 
    48604862 * Returns: 
    48614863 *  MATCHxxxx 
    48624864 */ 
    48634865 
    4864 int TypeFunction::callMatch(Expression *ethis, Expressions *args
     4866int TypeFunction::callMatch(Expression *ethis, Expressions *args, int flag
    48654867{ 
    48664868    //printf("TypeFunction::callMatch() %s\n", toChars()); 
     
    49384940    else 
    49394941    { 
    4940         m = arg->implicitConvTo(p->type); 
     4942        //printf("%s of type %s implicitConvTo %s\n", arg->toChars(), arg->type->toChars(), p->type->toChars()); 
     4943        if (flag) 
     4944        // for partial ordering, value is an irrelevant mockup, just look at the type 
     4945        m = arg->type->implicitConvTo(p->type); 
     4946        else 
     4947        m = arg->implicitConvTo(p->type); 
     4948        //printf("match %d\n", m); 
    49414949        if (p->type->isWild()) 
    49424950        { 
  • trunk/src/mtype.h

    r402 r407  
    563563    bool parameterEscapes(Parameter *p); 
    564564 
    565     int callMatch(Expression *ethis, Expressions *toargs); 
     565    int callMatch(Expression *ethis, Expressions *toargs, int flag = 0); 
    566566    type *toCtype(); 
    567567    enum RET retStyle();