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

ensures + fstar! produces code with out instead of user chosen name #832

Closed
W95Psp opened this issue Aug 7, 2024 · 1 comment
Closed
Labels
engine Issue in the engine f* F* backend P1 Max priority workaround This bug has a workaround

Comments

@W95Psp
Copy link
Collaborator

W95Psp commented Aug 7, 2024

trait X {
    fn f() -> u8;
}

#[hax_lib::attributes]
impl X for u8 {
    #[hax_lib::ensures(|result| result == {fstar!("$result")})]
    fn f() -> u8 {
        4
    }
}

Open this code snippet in the playground

Here we get (in F*) the post condition "fun out -> out == result", i.e. the second result doesn't get rewritten.

Workarounds:

  • as @mamonet suggested, just always use out in those context
  • add a let binding
@W95Psp W95Psp added engine Issue in the engine f* F* backend workaround This bug has a workaround labels Aug 7, 2024
@karthikbhargavan karthikbhargavan added the P1 Max priority label Sep 3, 2024
@W95Psp
Copy link
Collaborator Author

W95Psp commented Sep 3, 2024

Seems like #872 fixed this issue as well! Using latest hax on the playground shared above produce the expected code!

@W95Psp W95Psp closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Issue in the engine f* F* backend P1 Max priority workaround This bug has a workaround
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants