[Git][ghc/ghc][master] Rewrite partitionByWorkerSize to avoid pattern match checker bug
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Oct 7 17:21:43 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
e68f9aaf by Matthew Pickering at 2024-10-07T13:20:42-04:00
Rewrite partitionByWorkerSize to avoid pattern match checker bug
With `-g3` the pattern match checker would warn about these incomplete
patterns. This affects the debug_info builds on CI.
```
Pattern match(es) are non-exhaustive
In an equation for ‘go’:
Patterns of type ‘[a]’, ‘[a]’, ‘[SpecFailWarning]’ not matched:
(_:_) _ _
|
2514 | go [] small warnings = (small, warnings)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```
Workaround for #25338
- - - - -
1 changed file:
- compiler/GHC/Core/Opt/SpecConstr.hs
Changes:
=====================================
compiler/GHC/Core/Opt/SpecConstr.hs
=====================================
@@ -2512,13 +2512,11 @@ callsToNewPats env fn spec_info@(SI { si_specs = done_specs }) bndr_occs calls
partitionByWorkerSize worker_size pats = go pats [] []
where
go [] small warnings = (small, warnings)
- go (p:ps) small warnings
- | WorkerSmallEnough <- worker_size p
- = go ps (p:small) warnings
- | WorkerTooLarge <- worker_size p
- = go ps small warnings
- | WorkerTooLargeForced name <- worker_size p
- = go ps small (SpecFailForcedArgCount name : warnings)
+ go (p:ps) small warnings =
+ case worker_size p of
+ WorkerSmallEnough -> go ps (p:small) warnings
+ WorkerTooLarge -> go ps small warnings
+ WorkerTooLargeForced name -> go ps small (SpecFailForcedArgCount name : warnings)
trim_pats :: ScEnv -> Id -> SpecInfo -> [CallPat] -> (Bool, [CallPat])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e68f9aaff05d3fe88a449ce2a907572738ffca55
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e68f9aaff05d3fe88a449ce2a907572738ffca55
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241007/b5baf915/attachment-0001.html>
More information about the ghc-commits
mailing list