Propagate long-distance information in do-notation
The preceding commit re-enabled pattern-match checking inside record updates. This revealed that #21360 was in fact NOT fixed by e74fc066. This commit makes sure we correctly propagate long-distance information in do blocks, e.g. in ```haskell data T = A { fld :: Int } | B f :: T -> Maybe T f r = do a@A{} <- Just r Just $ case a of { A _ -> A 9 } ``` we need to propagate the fact that "a" is headed by the constructor "A" to see that the case expression "case a of { A _ -> A 9 }" cannot fail. Fixes #21360
Showing
- compiler/GHC/HsToCore/Expr.hs 56 additions, 17 deletionscompiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs 7 additions, 6 deletionscompiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/ListComp.hs 5 additions, 3 deletionscompiler/GHC/HsToCore/ListComp.hs
- compiler/GHC/HsToCore/Match.hs 20 additions, 4 deletionscompiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Pmc.hs 40 additions, 18 deletionscompiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Utils.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Utils.hs
- compiler/Language/Haskell/Syntax/Expr.hs 5 additions, 5 deletionscompiler/Language/Haskell/Syntax/Expr.hs
- testsuite/tests/pmcheck/should_compile/T21360.hs 17 additions, 14 deletionstestsuite/tests/pmcheck/should_compile/T21360.hs
- testsuite/tests/pmcheck/should_compile/T21360b.hs 10 additions, 0 deletionstestsuite/tests/pmcheck/should_compile/T21360b.hs
- testsuite/tests/pmcheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/pmcheck/should_compile/all.T
Loading
Please register or sign in to comment