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

Matching on erased #111

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

Matching on erased #111

mtzguido opened this issue Jun 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mtzguido
Copy link
Member

This snippet

```pulse
ghost
fn test (x : erased int)
  requires emp
  ensures  emp
{
  match x {
    0 -> {
     ();
    }
    _ -> {
     ();
    }
  }
}
```

fails with:

* Error 228 at MatchBug.fst(5,12-5,12):
  - Cannot type
      match x with
      | 0 -> 1
      | _ -> 1
    in context [(x: FStar.Ghost.erased Prims.int)]
  - Type of pattern (Prims.int) does not match type of scrutinee (FStar.Ghost.erased Prims.int)
  - See also Pulse.Checker.Match.fst(431,10-431,64)

1 error was reported (see above)

with a bad range, pointing to right after the pulse label. The fix is to do let xx = reveal x; before the match and match on xx, but that's not at all obvious from the error. Further the reveal could be automatic as we are in a ghost context.

@mtzguido mtzguido added the bug Something isn't working label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant