PmCheck: Pick up `EvVar`s bound in `HsWrapper`s for long-distance info
`HsWrapper`s introduce evidence bindings through `WpEvLam` which the pattern-match coverage checker should be made aware of. Failing to do so caused #18049, where the resulting impreciseness of imcompleteness warnings seemingly contradicted with `-Winaccessible-code`. The solution is simple: Collect all the evidence binders of an `HsWrapper` and add it to the ambient `Deltas` before desugaring the wrapped expression. But that means we pick up many more evidence bindings, even when they wrap around code without a single pattern match to check! That regressed `T3064` by over 300%, so now we are adding long-distance info lazily through judicious use of `unsafeInterleaveIO`. Fixes #18049.
Showing
- compiler/GHC/HsToCore/Binds.hs 13 additions, 14 deletionscompiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs 3 additions, 2 deletionscompiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/PmCheck.hs 26 additions, 15 deletionscompiler/GHC/HsToCore/PmCheck.hs
- compiler/GHC/Tc/Types/Evidence.hs 22 additions, 1 deletioncompiler/GHC/Tc/Types/Evidence.hs
- testsuite/tests/pmcheck/should_compile/T18049.hs 29 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/T18049.hs
- testsuite/tests/pmcheck/should_compile/all.T 2 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/all.T
Loading
Please register or sign in to comment