diff --git a/Source/DafnyCore/JsonDiagnostics.cs b/Source/DafnyCore/JsonDiagnostics.cs index 37c25d806e..b016a27e6d 100644 --- a/Source/DafnyCore/JsonDiagnostics.cs +++ b/Source/DafnyCore/JsonDiagnostics.cs @@ -11,7 +11,7 @@ namespace Microsoft.Dafny; -record DiagnosticMessageData(MessageSource source, ErrorLevel level, Boogie.IToken tok, string? category, string message, List? related) { +public record DiagnosticMessageData(MessageSource source, ErrorLevel level, Boogie.IToken tok, string? category, string message, List? related) { private static JsonObject SerializePosition(Boogie.IToken tok) { return new JsonObject { ["pos"] = tok.pos, @@ -20,7 +20,7 @@ private static JsonObject SerializePosition(Boogie.IToken tok) { }; } - private static JsonObject SerializeRange(Boogie.IToken tok) { + public static JsonObject SerializeRange(Boogie.IToken tok) { var range = new JsonObject { ["start"] = SerializePosition(tok), }; @@ -31,7 +31,7 @@ private static JsonObject SerializeRange(Boogie.IToken tok) { return range; } - private static JsonObject SerializeToken(Boogie.IToken tok) { + public static JsonObject SerializeToken(Boogie.IToken tok) { return new JsonObject { ["filename"] = tok.filename, ["uri"] = ((IOrigin)tok).Uri.AbsoluteUri, diff --git a/Source/DafnyCore/Options/CommonOptionBag.cs b/Source/DafnyCore/Options/CommonOptionBag.cs index 8ade67e6e0..9ace96f1b8 100644 --- a/Source/DafnyCore/Options/CommonOptionBag.cs +++ b/Source/DafnyCore/Options/CommonOptionBag.cs @@ -14,12 +14,12 @@ public class CommonOptionBag { public static void EnsureStaticConstructorHasRun() { } - public enum ProgressLevel { None, Symbol, VerificationJobs } + public enum ProgressLevel { None, Iterations, Symbols, Jobs } public static readonly Option ProgressOption = new("--progress", $"While verifying, output information that helps track progress. " + - $"Use '{ProgressLevel.Symbol}' to show progress across symbols such as methods and functions. " + + $"Use '{ProgressLevel.Symbols}' to show progress across symbols such as methods and functions. " + $"Verification of a symbol is usually split across several jobs. " + - $"Use {ProgressLevel.VerificationJobs} to additionally show progress across jobs."); + $"Use {ProgressLevel.Jobs} to additionally show progress across jobs."); public static readonly Option LogLocation = new("--log-location", "Sets the directory where to store log files") { diff --git a/Source/DafnyDriver/CliCompilation.cs b/Source/DafnyDriver/CliCompilation.cs index 2d9aa90a93..ef8c1770ae 100644 --- a/Source/DafnyDriver/CliCompilation.cs +++ b/Source/DafnyDriver/CliCompilation.cs @@ -186,7 +186,7 @@ public async IAsyncEnumerable VerifyAllLazily(int? randomSeed = canVerifyResult.CompletedParts.Enqueue((boogieUpdate.VerificationTask, completed)); var completedPartsCount = Interlocked.Increment(ref canVerifyResult.CompletedCount); - if (Options.Get(CommonOptionBag.ProgressOption) == CommonOptionBag.ProgressLevel.VerificationJobs) { + if (Options.Get(CommonOptionBag.ProgressOption) == CommonOptionBag.ProgressLevel.Jobs) { var partOrigin = boogieUpdate.VerificationTask.Split.Token; var wellFormedness = boogieUpdate.VerificationTask.Split.Implementation.Name.Contains("CheckWellFormed$"); @@ -267,7 +267,7 @@ string OriginDescription(IImplementationPartOrigin origin, bool outer) { foreach (var canVerify in toAwait) { var results = canVerifyResults[canVerify]; try { - if (Options.Get(CommonOptionBag.ProgressOption) > CommonOptionBag.ProgressLevel.None) { + if (Options.Get(CommonOptionBag.ProgressOption) >= CommonOptionBag.ProgressLevel.Symbols) { await Options.OutputWriter.WriteLineAsync( $"Verified {done}/{canVerifies.ToList().Count} symbols. Waiting for {canVerify.FullDafnyName} to verify."); } diff --git a/Source/DafnyDriver/Commands/MeasureComplexityCommand.cs b/Source/DafnyDriver/Commands/MeasureComplexityCommand.cs index f02d8c7ded..ad882accf0 100644 --- a/Source/DafnyDriver/Commands/MeasureComplexityCommand.cs +++ b/Source/DafnyDriver/Commands/MeasureComplexityCommand.cs @@ -1,14 +1,15 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.CommandLine; using System.Linq; using System.Reactive.Subjects; +using System.Text.Json; +using System.Text.Json.Nodes; using System.Threading; using System.Threading.Tasks; -using DafnyCore; using DafnyDriver.Commands; using Microsoft.Boogie; -using VC; namespace Microsoft.Dafny; @@ -16,7 +17,8 @@ static class MeasureComplexityCommand { public static IEnumerable