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

Resolved a crash that would occur when using a match statement inside… #5672

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion Source/DafnyCore/AST/Substituter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,9 @@ protected virtual Statement SubstStmt(Statement stmt) {
rr.ResolvedStatements.AddRange(revealStmt.ResolvedStatements.ConvertAll(SubstStmt));
rr.OffsetMembers = revealStmt.OffsetMembers.ToList();
r = rr;
} else {
} else if (stmt is NestedMatchStmt nestedMatchStmt) {
r = SubstStmt(nestedMatchStmt.Flattened);
}else {
Contract.Assert(false); throw new cce.UnreachableException(); // unexpected statement
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %verify "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

datatype D = D
function f(d:D):bool {
assert true by {
match d {
case _ => assert true;
}
}
true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Dafny program verifier finished with 1 verified, 0 errors
1 change: 1 addition & 0 deletions docs/dev/news/5671.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resolved a crash that would occur when using a match statement inside an assert by block
Loading