Program: 51272
Project: 51272
Buggy source:
/** 
 * Returns whether we can convert an argument of a given category to a given parameter category.
 * @param from actual argument category
 * @param to   formal parameter category
 * @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).
 * @return whether can convert from 'from' to 'to'
 */
public static boolean canConvert(int from,int to,int[] conversionCount){
  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:
switch (to) {
case Category.Value:
return true;
default :
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:
conversionCount[0]++;
return true;
case Category.Value:
case Category.String:
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.DateTime | Category.Constant:
return to == Category.Value || to == Category.DateTime;
case Category.DateTime:
return to == Category.Value || to == (Category.DateTime | 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:
if (Category.isScalar(to)) {
return true;
}
 else if (to == Category.Member) {
conversionCount[0]+=2;
return true;
}
 else {
return false;
}
case Category.Empty:
return false;
default :
throw Util.newInternal("String_Node_Str" + from);
}
}

Fixed version (ground truth):
/** 
 * Returns whether we can convert an argument of a given category to a given parameter category.
 * @param from actual argument category
 * @param to   formal parameter category
 * @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).
 * @return whether can convert from 'from' to 'to'
 */
public static boolean canConvert(int from,int to,int[] conversionCount){
  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:
switch (to) {
case Category.Value:
return true;
default :
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:
conversionCount[0]++;
return true;
case Category.Value:
case Category.String:
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.DateTime | Category.Constant:
return to == Category.Value || to == Category.DateTime;
case Category.DateTime:
return to == Category.Value || to == (Category.DateTime | Category.Constant);
case Category.Tuple:
switch (to) {
case Category.Value:
case Category.Numeric:
conversionCount[0]++;
return true;
default :
return false;
}
case Category.Value:
return false;
case Category.Symbol:
return false;
case Category.Null:
if (Category.isScalar(to)) {
return true;
}
 else if (to == Category.Member) {
conversionCount[0]+=2;
return true;
}
 else {
return false;
}
case Category.Empty:
return false;
default :
throw Util.newInternal("String_Node_Str" + from);
}
}