Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix project file override #4357

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/DafnyDriver/Commands/CommandRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async Task CommandHandler(InvocationContext context) {
object value;
if (option.Arity.MaximumNumberOfValues <= 1) {
// If multiple values aren't allowed, CLI options take precedence over project file options
value = result == null && hasProjectFileValue
value = (result == null || Equals(result.Token, null)) && hasProjectFileValue
? projectFileValue
: GetValueForOption(context.ParseResult, option);
} else {
Expand Down
3 changes: 3 additions & 0 deletions Test/cli/projectFile/projectFile.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// Test option override behavior
// RUN: %baredafny resolve --show-snippets:false --use-basename-for-filename "%S/dfyconfig.toml" --warn-shadowing=false >> "%t"

// Test option with default override behavior
// RUN: ! %baredafny resolve --show-snippets:false --use-basename-for-filename "%S/dfyconfig.toml" --function-syntax=3 >> "%t"

// Multiple project files are not allowed
// RUN: ! %baredafny resolve --show-snippets:false --use-basename-for-filename "%S/dfyconfig.toml" "%S/broken/dfyconfig.toml"

Expand Down
2 changes: 2 additions & 0 deletions Test/cli/projectFile/projectFile.dfy.expect
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ input.dfy(6,8): Warning: Shadowed local-variable name: x
Dafny program verifier did not attempt verification

Dafny program verifier did not attempt verification
input.dfy(10,0): Error: a function cannot be declared 'ghost' (it is 'ghost' by default when using --function-syntax:3)
1 parse errors detected in input.dfy
Warning: only Dafny project files named dfyconfig.toml are recognised by the Dafny IDE.
Warning: option 'does-not-exist' that was specified in the project file, is not a valid Dafny option.

Expand Down
6 changes: 5 additions & 1 deletion Test/cli/projectFile/src/input.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ method Foo() {
if (true) {
var x := 4;
}
}
}

ghost function Bar(): int {
3
}
1 change: 1 addition & 0 deletions docs/dev/news/4357.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow function-syntax and other options with a custom default to be overridden in `dfyconfig.toml`
Loading