Skip to content

Commit

Permalink
heapster-saw: Avoid -Woverlapping-patterns warning caught by GHC 9.6
Browse files Browse the repository at this point in the history
`parseNamedShapeFromRustDecl` will produce an `-Woverlapping-patterns` warning
with GHC 9.6 (but not in GHCi, see
https://gitlab.haskell.org/ghc/ghc/-/issues/23915), but we can refactor the
code slightly to avoid this issue.
  • Loading branch information
RyanGlScott committed Nov 20, 2023
1 parent 1a7c37f commit d9f88e0
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions heapster-saw/src/Verifier/SAW/Heapster/RustTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,10 +1587,7 @@ parseSome3FunPermFromRust _ _ str =
parseNamedShapeFromRustDecl :: (Fail.MonadFail m, 1 <= w, KnownNat w) =>
PermEnv -> prx w -> String ->
m (SomePartialNamedShape w)
parseNamedShapeFromRustDecl env w str
| Right item <- parse @(Item Span) (inputStreamFromString str) =
runLiftRustConvM (mkRustConvInfo env) $ rsConvert w item
| Left err <- parse @(Item Span) (inputStreamFromString str) =
fail ("Error parsing top-level item: " ++ show err)
parseNamedShapeFromRustDecl _ _ str =
fail ("Malformed Rust type: " ++ str)
parseNamedShapeFromRustDecl env w str =
case parse @(Item Span) (inputStreamFromString str) of
Right item -> runLiftRustConvM (mkRustConvInfo env) $ rsConvert w item
Left err -> fail ("Error parsing top-level item: " ++ show err)

0 comments on commit d9f88e0

Please sign in to comment.