Program: 11044
Project: 11044
Buggy source:
@Override public Object visitInFixSetExpression(@NotNull cqlParser.InFixSetExpressionContext ctx){
  String operator=ctx.getChild(1).getText();
  Expression left=parseExpression(ctx.expression(0));
  Expression right=parseExpression(ctx.expression(1));
  if (left.getResultType() instanceof ListType && right.getResultType() instanceof ListType) {
    ListType leftListType=(ListType)left.getResultType();
    ListType rightListType=(ListType)right.getResultType();
    if (!(leftListType.isCompatibleWith(rightListType) || rightListType.isCompatibleWith(leftListType))) {
      Set<DataType> elementTypes=new HashSet<DataType>();
      if (leftListType.getElementType() instanceof ChoiceType) {
        for (        DataType choice : ((ChoiceType)leftListType.getElementType()).getTypes()) {
          elementTypes.add(choice);
        }
      }
 else {
        elementTypes.add(leftListType.getElementType());
      }
      if (rightListType.getElementType() instanceof ChoiceType) {
        for (        DataType choice : ((ChoiceType)rightListType.getElementType()).getTypes()) {
          elementTypes.add(choice);
        }
      }
 else {
        elementTypes.add(rightListType.getElementType());
      }
      if (elementTypes.size() > 1) {
        ListType targetType=new ListType(new ChoiceType(elementTypes));
        left=of.createAs().withOperand(left).withAsTypeSpecifier(libraryBuilder.dataTypeToTypeSpecifier(targetType));
        left.setResultType(targetType);
        right=of.createAs().withOperand(right).withAsTypeSpecifier(libraryBuilder.dataTypeToTypeSpecifier(targetType));
        right.setResultType(targetType);
      }
    }
  }
switch (operator) {
case "String_Node_Str":
case "String_Node_Str":
    Union union=of.createUnion().withOperand(left,right);
  libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",union);
return union;
case "String_Node_Str":
Intersect intersect=of.createIntersect().withOperand(left,right);
libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",intersect);
return intersect;
case "String_Node_Str":
Except except=of.createExcept().withOperand(left,right);
libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",except);
return except;
}
return of.createNull();
}

Fixed version (ground truth):
@Override public Object visitInFixSetExpression(@NotNull cqlParser.InFixSetExpressionContext ctx){
  String operator=ctx.getChild(1).getText();
  Expression left=parseExpression(ctx.expression(0));
  Expression right=parseExpression(ctx.expression(1));
  if (left.getResultType() instanceof ListType && right.getResultType() instanceof ListType) {
    ListType leftListType=(ListType)left.getResultType();
    ListType rightListType=(ListType)right.getResultType();
    if (!(leftListType.isSuperTypeOf(rightListType) || rightListType.isSuperTypeOf(leftListType)) && !(leftListType.isCompatibleWith(rightListType) || rightListType.isCompatibleWith(leftListType))) {
      Set<DataType> elementTypes=new HashSet<DataType>();
      if (leftListType.getElementType() instanceof ChoiceType) {
        for (        DataType choice : ((ChoiceType)leftListType.getElementType()).getTypes()) {
          elementTypes.add(choice);
        }
      }
 else {
        elementTypes.add(leftListType.getElementType());
      }
      if (rightListType.getElementType() instanceof ChoiceType) {
        for (        DataType choice : ((ChoiceType)rightListType.getElementType()).getTypes()) {
          elementTypes.add(choice);
        }
      }
 else {
        elementTypes.add(rightListType.getElementType());
      }
      if (elementTypes.size() > 1) {
        ListType targetType=new ListType(new ChoiceType(elementTypes));
        left=of.createAs().withOperand(left).withAsTypeSpecifier(libraryBuilder.dataTypeToTypeSpecifier(targetType));
        left.setResultType(targetType);
        right=of.createAs().withOperand(right).withAsTypeSpecifier(libraryBuilder.dataTypeToTypeSpecifier(targetType));
        right.setResultType(targetType);
      }
    }
  }
switch (operator) {
case "String_Node_Str":
case "String_Node_Str":
    Union union=of.createUnion().withOperand(left,right);
  libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",union);
return union;
case "String_Node_Str":
Intersect intersect=of.createIntersect().withOperand(left,right);
libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",intersect);
return intersect;
case "String_Node_Str":
Except except=of.createExcept().withOperand(left,right);
libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",except);
return except;
}
return of.createNull();
}