Ticket #1144: tt1144.patch

File tt1144.patch, 1.4 KB (added by whiteknight, 12 years ago)

patch to fix this issue

  • src/multidispatch.c

     
    633633            continue; 
    634634 
    635635        /* promote primitives to their PMC equivalents, as PCC will autobox 
    636          * the distance penalty makes primitive variants look cheaper */ 
     636         * them. If it's a direct autobox, int->Integer, str->String, or 
     637         * num->Num, the distance is 1 and we move to the next arg. If it's 
     638         * autoboxing to "any" PMC type, we increment the distance and continue 
     639         * weighing other things. A direct autobox should be cheaper than an 
     640         * autobox plus type conversion or implicit type acceptance. */ 
    637641        switch (type_call) { 
    638642          case enum_type_INTVAL: 
    639643            if (type_sig == enum_class_Integer) { dist++; continue; } 
     644            if (type_sig == enum_type_PMC) dist++; 
    640645            break; 
    641646          case enum_type_FLOATVAL: 
    642647            if (type_sig == enum_class_Float)   { dist++; continue; } 
     648            if (type_sig == enum_type_PMC) dist++; 
    643649            break; 
    644650          case enum_type_STRING: 
    645651            if (type_sig == enum_class_String)  { dist++; continue; } 
     652            if (type_sig == enum_type_PMC) dist++; 
    646653            break; 
    647654          default: 
    648655            break;