summaryrefslogtreecommitdiff
path: root/Source/DafnyExtension
diff options
context:
space:
mode:
authorGravatar leino <unknown>2014-09-29 14:12:15 -0700
committerGravatar leino <unknown>2014-09-29 14:12:15 -0700
commit51d67784f9b26a670f6a9f908f7dc1e474b6850c (patch)
treee8d54408be84975ee840e653d87d322f06092b22 /Source/DafnyExtension
parent2a48cd240863649a0b0cd43ff44d2e6679d39349 (diff)
parent4a8ec31bbffa4b1d79255895dd3b9e24539cbba5 (diff)
Merge
Diffstat (limited to 'Source/DafnyExtension')
-rw-r--r--Source/DafnyExtension/DafnyDriver.cs6
-rw-r--r--Source/DafnyExtension/ProgressMargin.cs14
-rw-r--r--Source/DafnyExtension/ResolverTagger.cs12
3 files changed, 16 insertions, 16 deletions
diff --git a/Source/DafnyExtension/DafnyDriver.cs b/Source/DafnyExtension/DafnyDriver.cs
index 8c0f3235..3d4e7916 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
@@ -248,7 +248,7 @@ namespace DafnyLanguage
translator.UniqueIdPrefix = uniqueIdPrefix;
Bpl.Program boogieProgram = translator.Translate(dafnyProgram);
- resolver.ReInitializeVerificationErrors(requestId, boogieProgram.TopLevelDeclarations);
+ resolver.ReInitializeVerificationErrors(requestId, boogieProgram.Implementations);
// TODO(wuestholz): Maybe we should use a fixed program ID to limit the memory overhead due to the program cache in Boogie.
PipelineOutcome oc = BoogiePipeline(boogieProgram, 1 < Dafny.DafnyOptions.Clo.VerifySnapshots ? uniqueIdPrefix : null, requestId, er);
diff --git a/Source/DafnyExtension/ProgressMargin.cs b/Source/DafnyExtension/ProgressMargin.cs
index ae46befe..b4e58d3d 100644
--- a/Source/DafnyExtension/ProgressMargin.cs
+++ b/Source/DafnyExtension/ProgressMargin.cs
@@ -327,8 +327,7 @@ namespace DafnyLanguage
var logFileName = System.IO.Path.Combine(logDirName, System.IO.Path.GetFileName(System.IO.Path.ChangeExtension(program.FullName, string.Format("{0}.v{1}{2}", _created.Ticks, _version, System.IO.Path.GetExtension(program.FullName)))));
using (var writer = new StreamWriter(logFileName))
{
- var pr = new Dafny.Printer(writer);
- pr.PrintProgram(program);
+ snapshot.Write(writer);
}
_version++;
}
@@ -340,10 +339,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 +352,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..1fdd3827 100644
--- a/Source/DafnyExtension/ResolverTagger.cs
+++ b/Source/DafnyExtension/ResolverTagger.cs
@@ -154,9 +154,9 @@ namespace DafnyLanguage
string MostRecentRequestId;
- internal void ReInitializeVerificationErrors(string mostRecentRequestId, List<Microsoft.Boogie.Declaration> units)
+ internal void ReInitializeVerificationErrors(string mostRecentRequestId, IEnumerable<Microsoft.Boogie.Implementation> implementations)
{
- var implNames = units.OfType<Microsoft.Boogie.Implementation>().Select(impl => impl.Name);
+ var implNames = implementations.Select(impl => impl.Name);
lock (this)
{
MostRecentRequestId = mostRecentRequestId;
@@ -327,7 +327,7 @@ namespace DafnyLanguage
}
catch (Exception e)
{
- newErrors = new List<DafnyError> { new DafnyError(filename, 0, 0, ErrorCategory.InternalError, "internal Dafny error: " + e.Message, snapshot) };
+ newErrors = new List<DafnyError> { new DafnyError(filename, 0, 0, ErrorCategory.InternalError, "internal Dafny error: " + e.Message, snapshot, false) };
program = null;
}
@@ -499,7 +499,7 @@ namespace DafnyLanguage
{
using (var rd = new StringReader(ModelText))
{
- var models = Microsoft.Boogie.Model.ParseModels(rd, null).ToArray();
+ var models = Microsoft.Boogie.Model.ParseModels(rd).ToArray();
Contract.Assert(models.Length == 1);
_model = models[0];
}
@@ -575,13 +575,13 @@ namespace DafnyLanguage
/// <summary>
/// "line" and "col" are expected to be 0-based
/// </summary>
- 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);