internal static TypeErrors Merge(this TypeErrors first, TypeErrors other) { if (first == null) { return(other); } if (other == null) { return(first); } if (first == other) { return(first); } if (first.Type == other.Type) { if (first.Errors.Count == 0) { return(other); } if (other.Errors.Count == 0) { return(first); } var errors = new MergedErrors(first.Errors, other.Errors); return(new TypeErrors(first.Type, errors)); } return(new TypeErrors(null, new[] { first, other })); }
internal TypeErrors(Type type, IReadOnlyList <Error> errors) { this.Type = type; this.Errors = errors; this.AllErrors = MergedErrors.MergeAll(this, errors); }