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

Try to treat general map comprehension as the common case #340

Merged
merged 1 commit into from
Aug 6, 2019

Conversation

RustanLeino
Copy link
Collaborator

If a general map comprehension has the form map x | R(x) :: x := T(x), then
translate it (in the verifier) in the same way as the common map x | R(x) :: T(x).

Fixes #336

If a general map comprehension has the form `map x | R(x) :: x := T(x)`, then
translate it (in the verifier) in the same way as the common `map x | R(x) :: T(x)`.

Fixes dafny-lang#336
@@ -10224,6 +10224,31 @@ public MapComprehension(IToken tok, bool finite, List<BoundVar> bvars, Expressio
TermLeft = termLeft;
}

/// <summary>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious, what tool processes these xml tags?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we have a comment why being a general map comprehension is significant? (Maybe just a copy of the detail of the PR, if that's the only significance.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These xml tags are used by the IDE (at least in Visual Studio, and I'm guessing also in Rider, but I haven't thought about it) to display hover text as information about the method.

The general map comprehensions were needed in some example where it was impossible to create the desired map with the simpler (and far more common) map comprehension. I think this is the example:

map x | x in S :: f(x) := g(x)

// RUN: %dafny "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

lemma TestMap(a: map<int, (int,int)>) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice.

@RustanLeino RustanLeino merged commit 1cee786 into dafny-lang:master Aug 6, 2019
@RustanLeino RustanLeino deleted the issue-336 branch August 10, 2019 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map created with comprehension shorthand vs full comprehension
2 participants