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

Non-exhaustive pattern matches in heapster-saw #1632

Closed
brianhuffman opened this issue Apr 21, 2022 · 2 comments
Closed

Non-exhaustive pattern matches in heapster-saw #1632

brianhuffman opened this issue Apr 21, 2022 · 2 comments
Assignees
Labels
tech debt Issues that document or involve technical debt

Comments

@brianhuffman
Copy link
Contributor

We should fix this warning:

heapster-saw       > [ 6 of 19] Compiling Verifier.SAW.Heapster.Permissions
heapster-saw       >
heapster-saw       > /Users/huffman/Work/saw-script/heapster-saw/src/Verifier/SAW/Heapster/Permissions.hs:4810:5: warning: [-Wincomplete-patterns]
heapster-saw       >     Pattern match(es) are non-exhaustive
heapster-saw       >     In an equation for ‘go’:
heapster-saw       >         Patterns not matched:
heapster-saw       >             (PExpr_Var _) []
heapster-saw       >             (PExpr_Var _) (_:_)
heapster-saw       >             (PExpr_BV _ _) []
heapster-saw       >             (PExpr_BV _ _) (_:_)
heapster-saw       >      |
heapster-saw       > 4810 |     go off borrows
heapster-saw       >      |     ^^^^^^^^^^^^^^...

go off borrows
| bvLeq end off
= True
| Just i <- findIndex (permForOff off) borrows
= go (bvAdd off (bvRangeLength (borrows!!i))) (deleteNth i borrows)

For any "impossible" cases, we should add calls to panic. I also see that the same file contains many uses of the error function; those should be replaced by panic as appropriate.

@brianhuffman brianhuffman added the tech debt Issues that document or involve technical debt label Apr 21, 2022
@eddywestbrook
Copy link
Contributor

Yes, I have noticed this non-exhaustive case as well, and have fixed it in the branch I am currently working on. I can change the error calls to panic in a later change, after this one that I'm currently working on.

@RyanGlScott
Copy link
Contributor

This warning appears to have been fixed in the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Issues that document or involve technical debt
Projects
None yet
Development

No branches or pull requests

3 participants