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

Malformed Boogie for if-then-else with non-reference traits #5570

Open
RustanLeino opened this issue Jun 24, 2024 · 0 comments
Open

Malformed Boogie for if-then-else with non-reference traits #5570

RustanLeino opened this issue Jun 24, 2024 · 0 comments
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label

Comments

@RustanLeino
Copy link
Collaborator

Dafny version

4.6.0

Code to produce this issue

trait Parent { }

class Record extends Parent {}

function Pick(b: bool, r: Record, d: Parent): Parent {
  if b then r else d
}

Command to run and resulting output

% dafny run test.dfy --type-system-refresh --general-traits=datatype
test.dfy(6,4): Error: branches of if-then-else have incompatible types ref and Box
test.dfy(6,4): Error: branches of if-then-else have incompatible types ref and Box
test.dfy(6,4): Error: branches of if-then-else have incompatible types ref and Box
3 type checking errors detected in /tmp/test__module.bpl

*** Encountered internal translation error - re-running Boogie to get better debug information

/tmp/test__module.bpl(3372,53): Error: branches of if-then-else have incompatible types ref and Box
/tmp/test__module.bpl(3382,63): Error: branches of if-then-else have incompatible types ref and Box
/tmp/test__module.bpl(3393,13): Error: branches of if-then-else have incompatible types ref and Box
3 type checking errors detected in /tmp/test__module.bpl

What happened?

The verifier generates malformed Boogie. In particular, one of the branches of the generated Boogie if-then-else expression is missing a $Box conversion.

What type of operating system are you experiencing the problem on?

Mac

@RustanLeino RustanLeino added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Jun 24, 2024
RustanLeino added a commit to RustanLeino/dafny that referenced this issue Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
Projects
None yet
Development

No branches or pull requests

1 participant