示例#1
0
        private static string ConvertToErrorType(DafnyError err)
        {
            // the COLORs below indicate what I see on my machine
            switch (err.Category)
            {
            case ErrorCategory.ProcessError:
            case ErrorCategory.ParseError:
                return("syntax error"); // COLOR: red

            case ErrorCategory.ResolveError:
                return("compiler error"); // COLOR: blue

            case ErrorCategory.ParseWarning:
            case ErrorCategory.ResolveWarning:
                return("compiler warning"); // COLOR: blue

            case ErrorCategory.InternalError:
            case ErrorCategory.VerificationError:
                return("error"); // COLOR: red

            case ErrorCategory.AuxInformation:
                return("other error"); // COLOR: purple red

            default:
                Contract.Assert(false);
                throw new InvalidOperationException();
            }
        }
示例#2
0
 public DafnyErrorStateResolverTag(DafnyError error, ITrackingSpan span, int id, string description)
 {
     Error       = error;
     Span        = span;
     Id          = id;
     Description = description;
 }
示例#3
0
        private static string ConvertToErrorType(DafnyError err)
        {
            string ty; // the COLORs below indicate what I see on my machine

            switch (err.Category)
            {
            default: // unexpected category
            case ErrorCategory.ParseError:
            case ErrorCategory.ParseWarning:
                ty = "syntax error"; break; // COLOR: red

            case ErrorCategory.ResolveError:
                ty = "compiler error"; break; // COLOR: blue

            case ErrorCategory.VerificationError:
                ty = "error"; break; // COLOR: red

            case ErrorCategory.AuxInformation:
                ty = "other error"; break; // COLOR: purple red

            case ErrorCategory.InternalError:
                ty = "error"; break; // COLOR: red
            }
            return(ty);
        }
示例#4
0
        internal void AddError(DafnyError error, string unitId, string requestId)
        {
            ErrorContainer entry;

            if (_verificationErrors.TryGetValue(unitId, out entry))
            {
                lock (entry)
                {
                    if (entry.RequestId == null || new DateTime(long.Parse(entry.RequestId)) < new DateTime(long.Parse(requestId)))
                    {
                        entry.Errors.Clear();
                        entry.RequestId = requestId;
                    }
                }
                entry.Errors.Push(error);
                UpdateErrorList(Snapshot);
            }
            else if (unitId == "$$program_tactics$$") //These kinds of errors happen outside normal flow
            {
                entry = new ErrorContainer()
                {
                    RequestId = requestId
                };
                entry.Errors.Push(error);
                _verificationErrors.TryAdd(unitId, entry);
            }
        }
示例#5
0
        List <DafnyError> _resolutionErrors = new List <DafnyError>(); // if nonempty, then _snapshot is the snapshot from which the errors were produced

        internal void AddError(DafnyError error, string unitId, string requestId)
        {
            ErrorContainer entry;

            if (_verificationErrors.TryGetValue(unitId, out entry))
            {
                lock (entry)
                {
                    if (entry.RequestId == null || new DateTime(long.Parse(entry.RequestId)) < new DateTime(long.Parse(requestId)))
                    {
                        entry.Errors.Clear();
                        entry.RequestId = requestId;
                    }
                }
                entry.Errors.Push(error);
                UpdateErrorList(Snapshot);
            }
        }
示例#6
0
 public DafnyErrorResolverTag(DafnyError error)
     : base(ConvertToErrorType(error), error.Message)
 {
     Error = error;
 }