Skip to content

Commit

Permalink
Fix: No more crashing on hovering bodies of nested match statements (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelMayer authored Jul 1, 2022
1 parent 52405d1 commit 5487792
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Upcoming

- fix: Hovering over variables and methods inside cases of nested match statements work again (https://github.com/dafny-lang/dafny/pull/2334)
- fix: Fix bug in translation of two-state predicates with heap labels. (https://github.com/dafny-lang/dafny/pull/2300)
- fix: Check that arguments of 'unchanged' satisfy enclosing reads clause. (https://github.com/dafny-lang/dafny/pull/2302)
- fix: Caching in the language server does not prevent gutter icons from being updated correctly. (https://github.com/dafny-lang/dafny/pull/2312)
Expand Down
2 changes: 1 addition & 1 deletion Source/Dafny/Resolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11964,7 +11964,7 @@ public RBranchStmt(IToken tok, int branchid, List<ExtendedPattern> patterns, Lis
}

public RBranchStmt(int branchid, NestedMatchCaseStmt x, Attributes attrs = null) : base(x.Tok, branchid, new List<ExtendedPattern>()) {
this.Body = x.Body.ConvertAll((new Cloner()).CloneStmt);
this.Body = new List<Statement>(x.Body); // Resolving the body will insert new elements.
this.Attributes = attrs;
this.Patterns.Add(x.Pat);
}
Expand Down
11 changes: 11 additions & 0 deletions Source/DafnyLanguageServer.Test/Lookup/HoverTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,5 +427,16 @@ function ToRelativeIndependent(): (p: Position)
}
");
}

[TestMethod]
public async Task HoveringVariablesInsideNestedMatchStmtWorks() {
await AssertHover(@"
lemma dummy(e: int) {
match e {
case _ => var xx := 1;
^[```dafny\nghost xx: int\n```]
}
}");
}
}
}

0 comments on commit 5487792

Please sign in to comment.