From fc9efd04b96896b6c4bbb94bdfa494787d23b0a4 Mon Sep 17 00:00:00 2001 From: wuestholz Date: Mon, 22 Sep 2014 17:37:04 +0200 Subject: DafnyExtension: minor change --- Source/DafnyExtension/DafnyDriver.cs | 4 ++-- Source/DafnyExtension/ProgressMargin.cs | 11 ++++++----- Source/DafnyExtension/ResolverTagger.cs | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'Source/DafnyExtension') diff --git a/Source/DafnyExtension/DafnyDriver.cs b/Source/DafnyExtension/DafnyDriver.cs index 8c0f3235..eadf24e3 100644 --- a/Source/DafnyExtension/DafnyDriver.cs +++ b/Source/DafnyExtension/DafnyDriver.cs @@ -114,9 +114,9 @@ namespace DafnyLanguage return true; // success } - void RecordError(string filename, int line, int col, ErrorCategory cat, string msg) + void RecordError(string filename, int line, int col, ErrorCategory cat, string msg, bool isRecycled = false) { - _errors.Add(new DafnyError(filename, line, col, cat, msg, _snapshot, null, System.IO.Path.GetFullPath(this._filename) == filename)); + _errors.Add(new DafnyError(filename, line, col, cat, msg, _snapshot, isRecycled, null, System.IO.Path.GetFullPath(this._filename) == filename)); } class VSErrors : Dafny.Errors diff --git a/Source/DafnyExtension/ProgressMargin.cs b/Source/DafnyExtension/ProgressMargin.cs index c345257e..20cbecd1 100644 --- a/Source/DafnyExtension/ProgressMargin.cs +++ b/Source/DafnyExtension/ProgressMargin.cs @@ -340,10 +340,11 @@ namespace DafnyLanguage if (!_disposed) { errorInfo.BoogieErrorCode = null; - var recycled = errorInfo.OriginalRequestId != requestId ? " (recycled)" : ""; + var isRecycled = false; ITextSnapshot s = null; if (errorInfo.OriginalRequestId != null) { + isRecycled = errorInfo.OriginalRequestId != requestId; RequestIdToSnapshot.TryGetValue(errorInfo.OriginalRequestId, out s); } if (s == null && errorInfo.RequestId != null) @@ -352,22 +353,22 @@ namespace DafnyLanguage } if (s != null) { - errorListHolder.AddError(new DafnyError(errorInfo.Tok.filename, errorInfo.Tok.line - 1, errorInfo.Tok.col - 1, ErrorCategory.VerificationError, errorInfo.FullMsg + recycled, s, errorInfo.Model.ToString(), System.IO.Path.GetFullPath(_document.FilePath) == errorInfo.Tok.filename), errorInfo.ImplementationName, requestId); + errorListHolder.AddError(new DafnyError(errorInfo.Tok.filename, errorInfo.Tok.line - 1, errorInfo.Tok.col - 1, ErrorCategory.VerificationError, errorInfo.FullMsg, s, isRecycled, errorInfo.Model.ToString(), System.IO.Path.GetFullPath(_document.FilePath) == errorInfo.Tok.filename), errorInfo.ImplementationName, requestId); foreach (var aux in errorInfo.Aux) { - errorListHolder.AddError(new DafnyError(aux.Tok.filename, aux.Tok.line - 1, aux.Tok.col - 1, ErrorCategory.AuxInformation, aux.FullMsg, s, null, System.IO.Path.GetFullPath(_document.FilePath) == aux.Tok.filename), errorInfo.ImplementationName, requestId); + errorListHolder.AddError(new DafnyError(aux.Tok.filename, aux.Tok.line - 1, aux.Tok.col - 1, ErrorCategory.AuxInformation, aux.FullMsg, s, isRecycled, null, System.IO.Path.GetFullPath(_document.FilePath) == aux.Tok.filename), errorInfo.ImplementationName, requestId); } } } }); if (!success) { - errorListHolder.AddError(new DafnyError("$$program$$", 0, 0, ErrorCategory.InternalError, "Verification process error", snapshot), "$$program$$", requestId); + errorListHolder.AddError(new DafnyError("$$program$$", 0, 0, ErrorCategory.InternalError, "Verification process error", snapshot, false), "$$program$$", requestId); } } catch (Exception e) { - errorListHolder.AddError(new DafnyError("$$program$$", 0, 0, ErrorCategory.InternalError, "Verification process error: " + e.Message, snapshot), "$$program$$", requestId); + errorListHolder.AddError(new DafnyError("$$program$$", 0, 0, ErrorCategory.InternalError, "Verification process error: " + e.Message, snapshot, false), "$$program$$", requestId); } lock (this) { diff --git a/Source/DafnyExtension/ResolverTagger.cs b/Source/DafnyExtension/ResolverTagger.cs index df7878c4..bbe51665 100644 --- a/Source/DafnyExtension/ResolverTagger.cs +++ b/Source/DafnyExtension/ResolverTagger.cs @@ -327,7 +327,7 @@ namespace DafnyLanguage } catch (Exception e) { - newErrors = new List { new DafnyError(filename, 0, 0, ErrorCategory.InternalError, "internal Dafny error: " + e.Message, snapshot) }; + newErrors = new List { new DafnyError(filename, 0, 0, ErrorCategory.InternalError, "internal Dafny error: " + e.Message, snapshot, false) }; program = null; } @@ -575,13 +575,13 @@ namespace DafnyLanguage /// /// "line" and "col" are expected to be 0-based /// - public DafnyError(string filename, int line, int col, ErrorCategory cat, string msg, ITextSnapshot snapshot, string model = null, bool inCurrentDocument=true) + public DafnyError(string filename, int line, int col, ErrorCategory cat, string msg, ITextSnapshot snapshot, bool isRecycled, string model = null, bool inCurrentDocument = true) { Filename = filename; Line = Math.Max(0, line); Column = Math.Max(0, col); Category = cat; - Message = msg; + Message = msg + ((isRecycled && cat == ErrorCategory.VerificationError) ? " (recycled)" : ""); Snapshot = snapshot; if (inCurrentDocument) { var sLine = snapshot.GetLineFromLineNumber(line); -- cgit v1.2.3