Matching pattern uses Unbox as outermost expression #5751
Labels
incompleteness
Things that Dafny should be able to prove, but can't
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
part: verifier
Translation from Dafny to Boogie (translator)
Dafny version
4.8.0
Code to produce this issue
Command to run and resulting output
What happened?
One expects a
assert
to verify given an immediately precedingassume
of the same condition. The reason this doesn't happen here is that the matching pattern,o.owner
, is translated into Boogie as{ $Unbox(read($Heap, o#1, _module.Thing.owner)): ref }
The outermost
$Unbox
expression makes this matching pattern more restrictive than necessary or expected. If it instead is translated as just{ read($Heap, o#1, _module.Thing.owner) }
then the
assert
in the example goes through.I think the fix is to always remove any outermost
$Unbox
in a matching-pattern term, be it an automatically computed matching pattern or a manually supplied matching pattern. (It's conceivable that we should also look for and remove any outermost$Box
application, but I'm not sure if that can ever occur.)What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered: