Desugar RecordUpd in `tcExpr`
This patch typechecks record updates by desugaring them inside the typechecker using the HsExpansion mechanism, and then typechecking this desugared result. Example: data T p q = T1 { x :: Int, y :: Bool, z :: Char } | T2 { v :: Char } | T3 { x :: Int } | T4 { p :: Float, y :: Bool, x :: Int } | T5 The record update `e { x=e1, y=e2 }` desugars as follows e { x=e1, y=e2 } ===> let { x' = e1; y' = e2 } in case e of T1 _ _ z -> T1 x' y' z T4 p _ _ -> T4 p y' x' The desugared expression is put into an HsExpansion, and we typecheck that. The full details are given in Note [Record Updates] in GHC.Tc.Gen.Expr. Fixes #2595 #3632 #10808 #10856 #16501 #18311 #18802 #21158 #21289 Updates haddock submodule
Showing
- compiler/GHC/Core/Coercion.hs 0 additions, 24 deletionscompiler/GHC/Core/Coercion.hs
- compiler/GHC/Hs/Expr.hs 4 additions, 16 deletionscompiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs 0 additions, 1 deletioncompiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Syn/Type.hs 1 addition, 5 deletionscompiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Utils.hs 5 additions, 2 deletionscompiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Expr.hs 1 addition, 259 deletionscompiler/GHC/HsToCore/Expr.hs
- compiler/GHC/Rename/Expr.hs 40 additions, 4 deletionscompiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Utils.hs 27 additions, 5 deletionscompiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Errors/Types.hs 4 additions, 3 deletionscompiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Expr.hs 559 additions, 361 deletionscompiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Types/Evidence.hs 0 additions, 3 deletionscompiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs 8 additions, 1 deletioncompiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Zonk.hs 0 additions, 36 deletionscompiler/GHC/Tc/Utils/Zonk.hs
- compiler/GHC/Types/SrcLoc.hs 5 additions, 1 deletioncompiler/GHC/Types/SrcLoc.hs
- compiler/GHC/Unit/Module/ModIface.hs 3 additions, 3 deletionscompiler/GHC/Unit/Module/ModIface.hs
- docs/users_guide/9.6.1-notes.rst 52 additions, 0 deletionsdocs/users_guide/9.6.1-notes.rst
- testsuite/tests/patsyn/should_fail/all.T 0 additions, 1 deletiontestsuite/tests/patsyn/should_fail/all.T
- testsuite/tests/patsyn/should_fail/records-exquant.stderr 0 additions, 5 deletionstestsuite/tests/patsyn/should_fail/records-exquant.stderr
- testsuite/tests/patsyn/should_fail/records-no-uni-update.stderr 5 additions, 3 deletions...ite/tests/patsyn/should_fail/records-no-uni-update.stderr
- testsuite/tests/patsyn/should_fail/records-poly-update.stderr 0 additions, 6 deletions...suite/tests/patsyn/should_fail/records-poly-update.stderr
Loading
Please register or sign in to comment