Skip to content

Commit 5b43e94

Browse files
committed
heapster-saw: Avoid -Woverlapping-patterns warning caught by GHC 9.6
`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.
1 parent 1ccaf49 commit 5b43e94

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

heapster-saw/src/Verifier/SAW/Heapster/RustTypes.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,10 +1587,7 @@ parseSome3FunPermFromRust _ _ str =
15871587
parseNamedShapeFromRustDecl :: (Fail.MonadFail m, 1 <= w, KnownNat w) =>
15881588
PermEnv -> prx w -> String ->
15891589
m (SomePartialNamedShape w)
1590-
parseNamedShapeFromRustDecl env w str
1591-
| Right item <- parse @(Item Span) (inputStreamFromString str) =
1592-
runLiftRustConvM (mkRustConvInfo env) $ rsConvert w item
1593-
| Left err <- parse @(Item Span) (inputStreamFromString str) =
1594-
fail ("Error parsing top-level item: " ++ show err)
1595-
parseNamedShapeFromRustDecl _ _ str =
1596-
fail ("Malformed Rust type: " ++ str)
1590+
parseNamedShapeFromRustDecl env w str =
1591+
case parse @(Item Span) (inputStreamFromString str) of
1592+
Right item -> runLiftRustConvM (mkRustConvInfo env) $ rsConvert w item
1593+
Left err -> fail ("Error parsing top-level item: " ++ show err)

0 commit comments

Comments
 (0)