예제 #1
0
        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 }));
        }
예제 #2
0
 internal TypeErrors(Type type, IReadOnlyList <Error> errors)
 {
     this.Type      = type;
     this.Errors    = errors;
     this.AllErrors = MergedErrors.MergeAll(this, errors);
 }