public static VarType getCommonSupertype(VarType type1, VarType type2) {
    if (type1.getType() == CodeConstants.TYPE_BOOLEAN && type2.getType() == CodeConstants.TYPE_BOOLEAN) { // special case booleans
      return type1.isFalseBoolean() ? type1 : type2;
    }

    if (type1.isSuperset(type2)) {
      return type1;
    }
    else if (type2.isSuperset(type1)) {
      return type2;
    }
    else if (type1.getTypeFamily() == type2.getTypeFamily()) {
      switch (type1.getTypeFamily()) {
        case CodeConstants.TYPE_FAMILY_INTEGER -> {
          if ((type1.getType() == CodeConstants.TYPE_SHORTCHAR && type2.getType() == CodeConstants.TYPE_BYTE)
              || (type1.getType() == CodeConstants.TYPE_BYTE && type2.getType() == CodeConstants.TYPE_SHORTCHAR)) {
            return VARTYPE_SHORT;
          }
          else {
            return VARTYPE_INT;
          }
        }
        case CodeConstants.TYPE_FAMILY_OBJECT -> {
          return VARTYPE_OBJECT;
        }
      }
    }

    return null;
  }
public static VarType getCommonSupertype(VarType type1, VarType type2)