[Git][ghc/ghc][wip/expand-do] 5 commits: Fixes #18324 #23147 #20020

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Tue Jul 25 22:08:38 UTC 2023



Apoorv Ingle pushed to branch wip/expand-do at Glasgow Haskell Compiler / GHC


Commits:
b4ace9bb by Apoorv Ingle at 2023-07-25T12:36:55-05:00
Fixes #18324 #23147 #20020
Expands do notation before typechecking using `HsExpansion`
- Adds testcases T18324, T18324b, DoubleMatch
Expands
- Do statements
- Monadic do statements
- monadic fix blocks
- make sure fail is used for pattern match failures in bind statments
- Makes sure unused binds generate warnings
- runs the pattern match check in generated lambda exprs to avoid getting suprious pattern match failures. c.f. pmcheck/should_compile/DoubleMatch.hs
- PopSrcSpan in HsExpr to pop error context
- Discards default monad fail alternatives that are spuriously generated
- Make sure we check for generated loc span for checking if the (>>) is user written or expanded for /do/ purposes

- Add PopSrcSpan (XXExprGhcRn) in appropriate places while expanding statements
- correct source spans displayed for warnDiscardedDoBindings
- use `mkExpandStmt` to store original stmts along with expanded expr for using the right context for error message printing
- improves error messages for applicative do
- remove special case from isMatchContextPmChecked (long distance info is now properly propogated)
- set correct src spans to statement expansions
- Match ctxt while type checking HsLam is different if the lambda match is due to an expression generated from a do block
- call tcExpr and not tcApp in PopSrcSpan so make sure impredicativity works fine
- look into XExprs in tcInferAppHead_maybe for infering the type to make T18324 typecheck and run

- make the ExpandedStmt generated expression location-less
- Introduce ExpansionStmt for proper `hsSplitApps`
- Introduce `VAExpansionStmt` that is just like `VAExpansion` but for statements
- Aligning expand stmt context pushing on error stack.
- Pop error context while checking do expansion generated GRHSs inside HsLam so that we do not print the previous statement error context
- makes template haskell happy
- some fix for let expansions

- accepting new test output for some tests: Typeable1, hpc_fork, tough, tough2 etc.

preserve the expansion stmts right until desugaring

- - - - -
b6df469e by Apoorv Ingle at 2023-07-25T12:39:37-05:00
some fixes after rebasing and doc changes

- - - - -
879ca05f by Apoorv Ingle at 2023-07-25T13:26:25-05:00
Fixes #22788 #15598 #22086. Added testcases for each

- - - - -
78a54d25 by Apoorv Ingle at 2023-07-25T15:23:14-05:00
fix the body statement error context

- - - - -
ae14cf96 by Apoorv Ingle at 2023-07-25T17:04:35-05:00
fix warnings for non-exhausitive patterns location blame and discarded values in do block statements

- - - - -


30 changed files:

- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Constructor.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Zonk/Type.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/edfcfc2b8f952f4c5ef6dd13eac8ca299bedc8be...ae14cf9631538c2c89bc0d4cf96ee6e09e0c1a82

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/edfcfc2b8f952f4c5ef6dd13eac8ca299bedc8be...ae14cf9631538c2c89bc0d4cf96ee6e09e0c1a82
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/20230725/ca31fc17/attachment.html>


More information about the ghc-commits mailing list