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 empty PVL enums causing verification failure #1248

Open
wants to merge 1 commit into
base: dev
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
14 changes: 8 additions & 6 deletions src/rewrite/vct/rewrite/EnumToDomain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ case class EnumToDomain[Pre <: Generation]() extends CoercingRewriter[Pre] {
)))

// toIntRange
aDTDeclarations.declare(new ADTAxiom(forall[Post](
T(enum),
e =>
(const(0) <= InlinePattern(toInt(e))) &&
(toInt(e) < const(enum.constants.length)),
)))
if (enum.constants.nonEmpty) {
aDTDeclarations.declare(new ADTAxiom(forall[Post](
T(enum),
e =>
(const(0) <= InlinePattern(toInt(e))) &&
(toInt(e) < const(enum.constants.length)),
)))
}
}._1,
Seq(),
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class Test {
enum AB { A, B }
"""

vercors should verify using silicon in "pvl/enum empty" pvl """
enum Empty { }
"""

vercors should verify using silicon in "pvl/enum return" pvl """
enum AB { A, B }

Expand Down
Loading