Program: 51397
Project: 51397
Buggy source:
/** 
 * Returns whether we can convert an argument to a parameter tyoe.
 * @param fromExp argument type
 * @param to   parameter type
 * @param conversionCount in/out count of number of conversions performed;is incremented if the conversion is non-trivial (for example, converting a member to a level).
 */
public static boolean canConvert(Exp fromExp,int to,int[] conversionCount){
  int from=fromExp.getCategory();
  if (from == to) {
    return true;
  }
switch (from) {
case Category.Array:
    return false;
case Category.Dimension:
switch (to) {
case Category.Member:
case Category.Tuple:
    conversionCount[0]++;
  return true;
case Category.Hierarchy:
case Category.Level:
conversionCount[0]+=2;
return true;
default :
return false;
}
case Category.Hierarchy:
switch (to) {
case Category.Dimension:
case Category.Member:
case Category.Tuple:
conversionCount[0]++;
return true;
default :
return false;
}
case Category.Level:
switch (to) {
case Category.Dimension:
conversionCount[0]+=2;
return true;
case Category.Hierarchy:
conversionCount[0]++;
return true;
default :
return false;
}
case Category.Logical:
return false;
case Category.Member:
switch (to) {
case Category.Dimension:
case Category.Hierarchy:
case Category.Level:
case Category.Tuple:
conversionCount[0]++;
return true;
case (Category.Numeric | Category.Expression):
conversionCount[0]++;
return true;
case Category.Value:
case (Category.String | Category.Expression):
conversionCount[0]+=2;
return true;
default :
return false;
}
case Category.Numeric | Category.Constant:
return to == Category.Value || to == Category.Numeric;
case Category.Numeric:
return to == Category.Value || to == Category.Integer || to == (Category.Integer | Category.Constant) || to == (Category.Numeric | Category.Constant);
case Category.Integer:
return to == Category.Value || to == (Category.Integer | Category.Constant) || to == Category.Numeric || to == (Category.Numeric | Category.Constant);
case Category.Set:
return false;
case Category.String | Category.Constant:
return to == Category.Value || to == Category.String;
case Category.String:
return to == Category.Value || to == (Category.String | Category.Constant);
case Category.Tuple:
return to == Category.Value || to == Category.Numeric;
case Category.Value:
return false;
case Category.Symbol:
return false;
case Category.Null:
return to == Category.Numeric || to == Category.Member;
default :
throw newInternal("String_Node_Str" + from);
}
}

Fixed version (ground truth):
/** 
 * Returns whether we can convert an argument to a parameter tyoe.
 * @param fromExp argument type
 * @param to   parameter type
 * @param conversionCount in/out count of number of conversions performed;is incremented if the conversion is non-trivial (for example, converting a member to a level).
 */
public static boolean canConvert(Exp fromExp,int to,int[] conversionCount){
  int from=fromExp.getCategory();
  if (from == to) {
    return true;
  }
switch (from) {
case Category.Array:
    return false;
case Category.Dimension:
switch (to) {
case Category.Member:
case Category.Tuple:
    conversionCount[0]++;
  return true;
case Category.Hierarchy:
case Category.Level:
conversionCount[0]+=2;
return true;
default :
return false;
}
case Category.Hierarchy:
switch (to) {
case Category.Dimension:
case Category.Member:
case Category.Tuple:
conversionCount[0]++;
return true;
default :
return false;
}
case Category.Level:
switch (to) {
case Category.Dimension:
conversionCount[0]+=2;
return true;
case Category.Hierarchy:
conversionCount[0]++;
return true;
default :
return false;
}
case Category.Logical:
return false;
case Category.Member:
switch (to) {
case Category.Dimension:
case Category.Hierarchy:
case Category.Level:
case Category.Tuple:
conversionCount[0]++;
return true;
case (Category.Numeric | Category.Expression):
conversionCount[0]++;
return true;
case Category.Value:
case (Category.String | Category.Expression):
conversionCount[0]+=2;
return true;
default :
return false;
}
case Category.Numeric | Category.Constant:
return to == Category.Value || to == Category.Numeric;
case Category.Numeric:
switch (to) {
case Category.Logical:
conversionCount[0]++;
return true;
default :
return to == Category.Value || to == Category.Integer || to == (Category.Integer | Category.Constant) || to == (Category.Numeric | Category.Constant);
}
case Category.Integer:
return to == Category.Value || to == (Category.Integer | Category.Constant) || to == Category.Numeric || to == (Category.Numeric | Category.Constant);
case Category.Set:
return false;
case Category.String | Category.Constant:
return to == Category.Value || to == Category.String;
case Category.String:
return to == Category.Value || to == (Category.String | Category.Constant);
case Category.Tuple:
return to == Category.Value || to == Category.Numeric;
case Category.Value:
return false;
case Category.Symbol:
return false;
case Category.Null:
return to == Category.Numeric || to == Category.Member;
default :
throw newInternal("String_Node_Str" + from);
}
}