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: Dafny server API for counterexamples #5847

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Dargones
Copy link
Collaborator

Description

Fixes dafny-lang/ide-vscode#492

The language sever currently crushes when asking to display counterexamples. This is because #5013 changed the way counterexamples are represented but the IDE still expects the old representation. This PR fixes this. The IDE will now display any constraints that equate some literal to a variable/field/function application, etc. Here are some examples:

Screenshot 2024-10-21 at 4 39 26 PM

How has this been tested?

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@Dargones Dargones added the part: counterexamples Counterexample generation label Oct 21, 2024
Copy link
Member

@keyboardDrummer keyboardDrummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update some of the counterexample LSP tests as well, so they look at the newly introduced field? Letting all the tests look at Variables instead of Assumptions would be OK.

@@ -4,12 +4,14 @@
namespace Microsoft.Dafny.LanguageServer.Handlers.Custom {
public class CounterExampleItem {
public Position Position { get; }
public IDictionary<string, string> Variables { get; }

public string Assumption { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you intend the Assumption field to be used by the IDE? Otherwise better not to have it and reduce bandwidth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: counterexamples Counterexample generation
Projects
None yet
2 participants