Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
keyboardDrummer committed Jan 24, 2025
1 parent 03cfb52 commit a86946a
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 126 deletions.
8 changes: 4 additions & 4 deletions Source/DafnyCore/AST/Grammar/ParseErrors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ state properties of the otherwise uninterpreted or abstract type.
".TrimStart(), range =>
range.Prev.val == "," ? [
OneAction("remove comma", range.Prev, ""),
OneAction("insert '=='", range, "==" + range.PrintOriginal()),
OneAction("insert '0'", range, "0" + range.PrintOriginal()),
OneAction("insert '00'", range, "00" + range.PrintOriginal()),
OneAction("insert '!new'", range, "!new" + range.PrintOriginal())
OneAction("insert '=='", range, "==" + range.PrintOriginal()),
OneAction("insert '0'", range, "0" + range.PrintOriginal()),
OneAction("insert '00'", range, "00" + range.PrintOriginal()),
OneAction("insert '!new'", range, "!new" + range.PrintOriginal())
]
: [
OneAction("insert '=='", range, "==" + range.PrintOriginal()),
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/AST/Grammar/Printer/Printer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ internal void PrintFormals(List<Formal> ff, ICallable/*?*/ context, string name
wr.Write("[");
PrintFormal(ff[0], false);
wr.Write("]");
ff = [..ff.Skip(1)];
ff = [.. ff.Skip(1)];
}
wr.Write("(");
string sep = "";
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/AST/TypeDeclarations/ArrayClassDecl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ArrayClassDecl : ClassDecl {
public ArrayClassDecl(int dims, ModuleDefinition module, Attributes attrs)
: base(SourceOrigin.NoToken, new Name(SystemModuleManager.ArrayClassName(dims)), module,
[
..new TypeParameter[]
.. new TypeParameter[]
{ new TypeParameter(SourceOrigin.NoToken, new Name("arg"), TypeParameter.TPVarianceSyntax.NonVariant_Strict) }
],
[], attrs, false, null) {
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/AST/Types/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ AutoInitInfo CharacteristicToAutoInitInfo(TypeParameter.TypeParameterCharacteris
// This requires more recursion and bookkeeping than we care to try out
return AutoInitInfo.MaybeEmpty;
}
coDatatypesBeingVisited = [..coDatatypesBeingVisited];
coDatatypesBeingVisited = [.. coDatatypesBeingVisited];
} else {
coDatatypesBeingVisited = [];
}
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ string FormatDefaultTypeParameterValue(TopLevelDecl tp) {
}

private readonly Dictionary<ModuleDefinition, Import> ModuleImports = new();
private readonly List<Import> ImportsNotFromDafnyModules = [..StandardImports];
private readonly List<Import> ImportsNotFromDafnyModules = [.. StandardImports];
private string ModuleName;
private ModuleDefinition CurrentModule;
private ConcreteSyntaxTree RootImportWriter;
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/DafnyOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public DafnyOptions(DafnyOptions src, bool useNullWriters = false) : this(
src.Input, src.OutputWriter, src.ErrorWriter) {
src.CopyTo(this, useNullWriters);
CliRootSourceUris = new List<Uri>(src.CliRootSourceUris);
ProverOptions = [..src.ProverOptions];
ProverOptions = [.. src.ProverOptions];
Options = new Options(
src.Options.OptionArguments.ToDictionary(kv => kv.Key, kv => kv.Value),
src.Options.Arguments.ToDictionary(kv => kv.Key, kv => kv.Value));
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/Generic/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static List<A> Snoc<A>(List<A> xs, A x) {
}

public static List<A> Concat<A>(List<A> xs, List<A> ys) {
List<A> cpy = [..xs];
List<A> cpy = [.. xs];
cpy.AddRange(ys);
return cpy;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/Pipeline/Compilation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public void CancelPendingUpdates() {
}
// TODO: end position doesn't take into account trailing trivia: https://github.com/dafny-lang/dafny/issues/3415
return new TextEditContainer([
new() {NewText = result, Range = new Range(new Position(0,0), lastToken.GetLspPosition())}
new() { NewText = result, Range = new Range(new Position(0, 0), lastToken.GetLspPosition()) }
]);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ public void PartiallySolveTypeConstraints(bool allowDecisions) {
ProcessOneSubtypingConstraintAndItsSubs(c, processed, fullStrength, ref anyNewConstraints);
}

allTypeConstraints = [..AllTypeConstraints]; // copy the list
allTypeConstraints = [.. AllTypeConstraints]; // copy the list
foreach (var c in allTypeConstraints) {
var super = c.Super.NormalizeExpand() as TypeProxy;
if (AssignKnownEnd(super, true, fullStrength)) {
Expand Down
4 changes: 2 additions & 2 deletions Source/DafnyCore/Rewriters/RefinementTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,9 @@ public bool CheckIsRefinement(ModuleDecl derived, AbstractModuleDecl original) {
if (derivedPointer == original.OriginalSignature.ModuleDef) {
HashSet<string> exports;
if (derived is AliasModuleDecl) {
exports = [..((AliasModuleDecl)derived).Exports.ConvertAll(t => t.val)];
exports = [.. ((AliasModuleDecl)derived).Exports.ConvertAll(t => t.val)];
} else if (derived is AbstractModuleDecl) {
exports = [..((AbstractModuleDecl)derived).Exports.ConvertAll(t => t.val)];
exports = [.. ((AbstractModuleDecl)derived).Exports.ConvertAll(t => t.val)];
} else {
Error(ErrorId.ref_base_module_must_be_abstract_or_alias, derived, "a module ({0}) can only be refined by an alias module or a module facade", original.Name);
return false;
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/Triggers/ExprSubstituter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override Expression Substitute(Expression expr) {
newBounds = [];
} else if (newBounds == e.Bounds) {
// create a new list with the same elements, since the .Add operations below would otherwise add elements to the original e.Bounds
newBounds = [..newBounds];
newBounds = [.. newBounds];
}

// conjoin all the new equalities to the range of the quantifier
Expand Down
4 changes: 2 additions & 2 deletions Source/DafnyCore/Triggers/TriggerAnnotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ internal TriggerAnnotation(bool isTriggerKiller,
IEnumerable<TriggerTerm> privateTerms = null) {
this.IsTriggerKiller = isTriggerKiller;
this.Variables = new HashSet<IVariable>(variables);
this.PrivateTerms = [..privateTerms ?? []];
this.ExportedTerms = [..allTerms == null ? [] : allTerms.Except(this.PrivateTerms)];
this.PrivateTerms = [.. privateTerms ?? []];
this.ExportedTerms = [.. allTerms == null ? [] : allTerms.Except(this.PrivateTerms)];
}

public override string ToString() {
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/Triggers/TriggerTermSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static TriggerTermSet Empty() {
/// </summary>
private TriggerTermSet CopyWithAdd(TriggerTerm term, IEnumerable<BoundVar> relevantVariables) {
var copy = new TriggerTermSet();
copy.Terms = [..Terms];
copy.Terms = [.. Terms];
copy.variables = new HashSet<BoundVar>(variables);
copy.termOwningAUniqueVar = new Dictionary<BoundVar, TriggerTerm>(termOwningAUniqueVar);
copy.uniqueVarsOwnedByATerm = new Dictionary<TriggerTerm, ISet<BoundVar>>(uniqueVarsOwnedByATerm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,7 @@ public static bool RewriteInExpr(Expression s, bool aggressive) {
private static readonly Dictionary<string, string> NullaryAttributesToTranslate;

private static readonly HashSet<string> NullaryAttributesToCopy = [
..new[] {
.. new[] {
"focus",
"isolate",
"ignore",
Expand All @@ -1977,13 +1977,13 @@ public static bool RewriteInExpr(Expression s, bool aggressive) {
];

private static readonly HashSet<string> BooleanAttributesToCopy = [
..new[] {
.. new[] {
"verify"
}
];

private static readonly HashSet<string> IntegerAttributesToCopy = [
..new[] {
.. new[] {
"subsumption",
"testInline",
"timeLimit",
Expand All @@ -1995,7 +1995,7 @@ public static bool RewriteInExpr(Expression s, bool aggressive) {
];

private static readonly HashSet<string> StringAttributesToCopy = [
..new[] {
.. new[] {
"captureState",
"isolate",
"error"
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyCore/Verifier/BoogieGenerator.LetExpr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public LetSuchThatExprInfo(IOrigin tok, int uniqueLetId,
UsesHeap = usesHeap;
UsesOldHeap = usesOldHeap;
// we convert the set of heap-at variables to a list here, once and for all; the order itself is not material, what matters is that we always use the same order
UsesHeapAt = [..usesHeapAt];
UsesHeapAt = [.. usesHeapAt];
ThisType = thisType;
}

Expand Down
4 changes: 2 additions & 2 deletions Source/DafnyCore/Verifier/ProofObligationDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,8 @@ public override Expression GetAssertedExpr(DafnyOptions options) {
: new UnaryOpExpr(sequence.Origin, UnaryOpExpr.Opcode.Cardinality, sequence);
return new ChainingExpression(sequence.Origin, [
new LiteralExpr(sequence.Origin, 0),
index,
bound
index,
bound
], [
BinaryExpr.Opcode.Le,
upperExcluded ? BinaryExpr.Opcode.Lt : BinaryExpr.Opcode.Le
Expand Down
3 changes: 2 additions & 1 deletion Source/DafnyDriver/Commands/GenerateTestsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ internal static void PostProcess(DafnyOptions dafnyOptions, TestGenerationOption
"Print the Boogie code used during test generation.") {
ArgumentHelpName = "filename"
};
public static readonly Option<string> ExpectedCoverageReport = new(["--expected-coverage-report", "--coverage-report"
public static readonly Option<string> ExpectedCoverageReport = new(["--expected-coverage-report",
"--coverage-report"
],
"Emit expected test coverage report to a given directory.") {
ArgumentHelpName = "directory"
Expand Down
2 changes: 1 addition & 1 deletion Source/DafnyLanguageServer/MarkupTestFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static void GetPositionsAndRanges(string input, out string output, out IL
GetIndexAndSpans(input, out output, out var positionIndices, out var spans);
var buffer = new TextBuffer(output);
positions = positionIndices.Select(index => buffer.FromIndex(index)).ToList();
ranges = [..spans.Select(span => new Range(buffer.FromIndex(span.Span.Start), buffer.FromIndex(span.Span.End)))];
ranges = [.. spans.Select(span => new Range(buffer.FromIndex(span.Span.Start), buffer.FromIndex(span.Span.End)))];
}

public static void GetPositionAndRanges(string input, out string output, out Position cursorPosition, out ImmutableArray<Range> ranges) {
Expand Down
Loading

0 comments on commit a86946a

Please sign in to comment.