[Git][ghc/ghc][wip/expand-do] 31 commits: rnImports: var shouldn't import NoFldSelectors
Apoorv Ingle (@ani)
gitlab at gitlab.haskell.org
Mon Jul 17 18:17:35 UTC 2023
Apoorv Ingle pushed to branch wip/expand-do at Glasgow Haskell Compiler / GHC
Commits:
c7bbad9a by sheaf at 2023-07-17T02:48:19-04:00
rnImports: var shouldn't import NoFldSelectors
In an import declaration such as
import M ( var )
the import of the variable "var" should **not** bring into scope record
fields named "var" which are defined with NoFieldSelectors.
Doing so can cause spurious "unused import" warnings, as reported in
ticket #23557.
Fixes #23557
- - - - -
1af2e773 by sheaf at 2023-07-17T02:48:19-04:00
Suggest similar names in imports
This commit adds similar name suggestions when importing. For example
module A where { spelling = 'o' }
module B where { import B ( speling ) }
will give rise to the error message:
Module ‘A’ does not export ‘speling’.
Suggested fix: Perhaps use ‘spelling’
This also provides hints when users try to import record fields defined
with NoFieldSelectors.
- - - - -
654fdb98 by Alan Zimmerman at 2023-07-17T02:48:55-04:00
EPA: Store leading AnnSemi for decllist in al_rest
This simplifies the markAnnListA implementation in ExactPrint
- - - - -
68da029c by Apoorv Ingle at 2023-07-17T13:17:18-05:00
Fixes #18324 #23147
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
- - - - -
045558ac by Apoorv Ingle at 2023-07-17T13:17:18-05:00
- 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
- - - - -
566b1640 by Apoorv Ingle at 2023-07-17T13:17:18-05:00
generate incomplete uni patterns warnings if the origin context is a generated do expansion
- - - - -
67ed415a by Apoorv Ingle at 2023-07-17T13:17:18-05:00
use the correct bind operator for qualified rebindable rec do expansions
- - - - -
84aa67eb by Apoorv Ingle at 2023-07-17T13:17:18-05:00
trying out changes to heralds
- - - - -
f3cda4d9 by Apoorv Ingle at 2023-07-17T13:17:18-05:00
add location information for last statements
- - - - -
111ebde8 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
do not pop context while checking the second argument to expanded (>>)
- - - - -
314f31e7 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
adjusting the generated spans for proper error messages
- - - - -
20983da6 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
change the addHeadCtxt to include the first statement of the do block for more precise error messages
- - - - -
f0ede291 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
- don't add any ctxt in addExprCtxt for `XExpr(ExpandedStmt{})` as it is not very useful, the statement ctxt is already added by `tcExpr` and `addHeadCtxt`
- - - - -
a415cac3 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
- addStmtCtxt to add the right statement context in the error contexts
- expansion stmt to span over bind/>>= application and pattern rather than only the arguments
- - - - -
d7b33b6f by Apoorv Ingle at 2023-07-17T13:17:19-05:00
add stmt context in tcApp rather other places
- - - - -
82eabd93 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
add the correct expression context in tcApp
- - - - -
47368958 by Apoorv Ingle at 2023-07-17T13:17:19-05:00
disable expansion if applicative do is enabled
- - - - -
598b000f by Apoorv Ingle at 2023-07-17T13:17:19-05:00
handle a special in desugaring when a do block has only one statment, the ds location should be set to that of the last statement
- - - - -
6f31c23a by Apoorv Ingle at 2023-07-17T13:17:19-05:00
do not add argument context if it is a do statement
- - - - -
f9a8dda2 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
remove applicative do expansion
- - - - -
21f16f38 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
add context of first do statement in addArgCtxt, somehow it goes missing
- - - - -
c196f1e6 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
add the argument location in error ctxt if it is the first argument of a >> or a >>=
- - - - -
8173aafa by Apoorv Ingle at 2023-07-17T13:17:20-05:00
- make the ExpandedStmt generated expression location-less
- Introduce ExpansionStmt for proper `hsSplitApps`
- Introduce `VAExpansionStmt` that is just like `VAExpansion` but for statements
- - - - -
791e4d93 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
some cleanup needed
- - - - -
a5f58560 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
- VAExpansionStmt doesn't need srcloc
- fix the ppr function for XExprs
- - - - -
12419b76 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
- Blame the binding body but keep the error context about the statement in addArgCtxt
- - - - -
334a4f1c by Apoorv Ingle at 2023-07-17T13:17:20-05:00
- fix the location displayed for the errors that crop up during type checking LetStmt
- - - - -
2eda971b by Apoorv Ingle at 2023-07-17T13:17:20-05:00
Add the statement context in addHeadCtxt
- - - - -
3aeaa3f3 by Apoorv Ingle at 2023-07-17T13:17:20-05:00
make sure user >> and generated >> have appropriate error messages
- - - - -
9c2243e8 by Apoorv Ingle at 2023-07-17T13:17:21-05:00
- aligning expand stmt context pushing on error stack.
- - - - -
86a23730 by Apoorv Ingle at 2023-07-17T13:17:21-05:00
- handing type checking expanded let statements in do block
- handling type checking last statements in do block
- - - - -
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/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.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
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9550f631dca4fd38643124de63cbbce820508788...86a237307a8801d46651f1c72363ff92a364b772
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9550f631dca4fd38643124de63cbbce820508788...86a237307a8801d46651f1c72363ff92a364b772
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/20230717/baa2abc8/attachment-0001.html>
More information about the ghc-commits
mailing list