public static DfaValue boxUnbox(DfaValue value, @NotNull DfType type) {
    if (TypeConstraint.fromDfType(type).isPrimitiveWrapper()) {
      if (value.getDfType() instanceof DfPrimitiveType) {
        return value.getFactory().getWrapperFactory().createWrapper(type.meet(DfTypes.NOT_NULL_OBJECT), SpecialField.UNBOX, value);
      }
    }
    if (type instanceof DfPrimitiveType primitiveType) {
      if (value.getDfType() instanceof DfPrimitiveType valueType) {
        PsiPrimitiveType psiType = primitiveType.getPsiType();
        if (!valueType.getPsiType().equals(psiType)) {
          return value.getFactory().fromDfType(valueType.castTo(psiType));
        }
      }
      if (value instanceof DfaWrappedValue || TypeConstraint.fromDfType(value.getDfType()).isPrimitiveWrapper()) {
        return SpecialField.UNBOX.createValue(value.getFactory(), value);
      }
      if (value.getDfType() instanceof DfReferenceType) {
        return value.getFactory().fromDfType(type);
      }
    }
    return value;
  }
public static DfaValue boxUnbox(DfaValue value, @NotNull DfType type)