[Git][ghc/ghc][wip/case-bndr-unf] 17 commits: NCG: List each destination of a jump table once
by Simon Peyton Jones (@simonpj) 23 Nov '26
by Simon Peyton Jones (@simonpj) 23 Nov '26
23 Nov '26
Simon Peyton Jones pushed to branch wip/case-bndr-unf at Glasgow Haskell Compiler / GHC
Commits:
01a5b0ac by Sylvain Henry at 2026-11-22T16:35:34-05:00
NCG: List each destination of a jump table once
jumpDestsOfInstr listed a block once per jump table entry that named
it. The linear register allocator makes a fixup block per listed
destination, so such a block got several fixup blocks. The patch of
the jump sends every entry to the first one. The other fixup blocks
were dead code, and the CFG had an edge to each of them.
jumpDestsOfInstr now lists each destination once, in every backend.
joinToTargets asserts it in debug builds.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
e4498112 by Andreas Klebinger at 2026-11-22T16:35:34-05:00
x86 ncg: Track the current block in NatM to keep the CFG in sync
The x86 NCG uses a CFG for code layout. When instruction selection
makes new blocks (word2Float#, cmpxchg loops, 64-bit shifts on i386),
it must add them to the CFG. Some sites did not. The CFG went out of
sync, the layout was bad, and the register allocator panicked when it
added fixup blocks (#27694, #27915).
NatM now keeps the current block in its state. Combinators update the
CFG and the current block together. See Note [Updating the CFG during
CodeGen] in GHC.CmmToAsm.Monad.
Other changes:
* -dasm-lint checks that the jumps in the code and the edges in the
CFG agree in both directions. This found a second desync: the CFG
did not follow the jumps that allocMoreStack retargets. The new
addPreentryBlock fixes it.
* The code must be emitted in generation order, because the CFG
records new blocks in that order. A store now generates the code of
its value before the code of its address, in the order it emits
them. Atomic operations take their address from the new
getNonClobberedAmode, so the code of their other operands cannot
clobber it.
Fixes #27694, #27915
Co-authored-by: Sylvain Henry <sylvain(a)haskus.fr>
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
f59fb957 by Sylvain Henry at 2026-11-22T16:35:34-05:00
x86 ncg: Maintain the CFG on i386
The i386 NCG now keeps its CFG in sync with the code (see the previous
commit), so backendMaintainsCfg is now True for i386. i386 gets the
CFG based code layout, dead code elimination and the -dasm-lint check,
like x86-64.
The compiler allocates more on i386: the CFG now goes through the
register allocator, branch shortcutting and optimizeCFG, which i386
skipped before. x86-64 already does this work.
Metric Increase:
CoOpt_Read
ManyAlternatives
T10421
T12425
T12707
T13056
T13253
T13253-spj
T13960
T15164
T15304
T15630
T15630a
T15703
T16577
T17516
T17836
T18140
T18282
T18304
T18698a
T18698b
T18730
T18923
T19695
T20049
T21839c
T24471
T26425
T26989
T5642
T6048
T783
T9233
T9630
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
2091b89a by fendor at 2026-11-22T16:36:17-05:00
`ghc -M`: Add support for link nodes to json output
`LinkNode`s are part of the module graph and indicate that a certain
linking artefact is to be produced from other module graph nodes.
We expose `LinkNode`s in the output of `ghc -M -dep-json`, allowing
consumers to see when a linking artefact is to be produced.
Only the JSON output format of `ghc -M` supports `LinkNode` as it is
unclear how the Makefile output should be retrofitted to express the
dependencies, and whether it would require a feature guard.
Closes #28007
- - - - -
cfd4fb67 by Ryan Scott at 2026-11-22T16:36:59-05:00
GHC.HsToCore.Quote: Quote \cases with the correct type
Previously, `\cases` expressions inside of Template Haskell quotes would
incorrectly use the `Match` type instead of `Clause` for the element type. We
now use `nonEmptyCoreList` when quoting `\cases`, which infers the correct type
automatically. This works because `\cases` has an invariant that the list of
clauses is always non-empty.
Fixes #27826.
- - - - -
06e71ddf by Simon Peyton Jones at 2026-11-22T16:37:40-05:00
Better desugaring for bang patterns
Ticket #27862 showed that we were desugaring bang patterns in a
silly way, which led to bad code. This small fix makes it much
better.
I ended up refactoring `decomposeFirstPat` to be of type
(LPat -> LPat) instead of (Pat -> Pat)
which made it much easier to keep the locations correct.
On the way I also fixed #28137, a missing warning.
See Note [Tidying patterns] which has new (TP1) and (TP2)
and Note [Grouping equations] especially (GE1)
- - - - -
cd6c2a96 by Simon Jakobi at 2026-11-22T16:38:23-05:00
Cmm: drop eliminated blocks from the graph in CBE
Previously, common block elimination only made the eliminated blocks
unreachable. They stayed in the graph until stack layout discarded
them.
Removing these blocks right away reduces the potential for confusion
(e.g. #27368). It does not appear to make any significant difference
to compiler allocations.
Assisted-by: Claude Opus 5.5
- - - - -
c0764c69 by Hannes Siebenhandl at 2026-11-22T16:39:04-05:00
Use Set operations over Foldable operations
Use `O(log n)` operations over `O(n)` for all call-sites of `hsc_all_home_unit_ids`.
- - - - -
242f8daf by Alan Zimmerman at 2026-11-22T16:39:46-05:00
EPA: Use AnnList in DecBrl
Via updating the TTG extension point payload
- - - - -
1e568190 by David Eichmann at 2026-11-22T16:40:28-05:00
Fix race condition in IOManager test
- - - - -
64f821c6 by Simon Peyton Jones at 2026-11-22T16:41:09-05:00
Fix a zonking bug
As #28135 showed, we were failing to zonk some type-variable
binders before doing scoped-sort dependency analysis, resulting
in chaos.
The fix is easy.
- - - - -
ed5124b3 by mangoiv at 2026-11-22T16:41:50-05:00
ci: nightly push can run on any arch
- - - - -
380bbbd7 by Simon Peyton Jones at 2026-11-23T00:09:57+00:00
Make pushCast pure, and move it to Simplify.Utils
pushCast and pushCastMCo were in the SimplM monad, but no longer do
anything monadic. (Historically, pushing a coercion into an argument
used to simplify that argument; but now the coercion is recorded in
the sc_cast field of ApplyToVal.)
This patch makes them pure functions, and moves them, together with
addCastMCo, optOutCoercion and Note [The sc_cast field of ApplyToVal],
from GHC.Core.Opt.Simplify.Iteration to GHC.Core.Opt.Simplify.Utils,
alongside the SimplCont type they manipulate.
No change in behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
24465ef6 by Simon Peyton Jones at 2026-11-23T00:09:58+00:00
Lambda and case binders have vanilla IdInfo (#27965)
Lambda binders, case binders, and case-alternative binders should never
have RULES, a (non-default) inline pragma, or a stable unfolding.
See new Note [Core binder IdInfo invariants] in GHC.Core, which
lays out the invariants.
This patch
* Makes Core Lint check the invariant, using the new predicate
GHC.Types.Id.lamBndrInfoOK.
* Fixes the desugarer, which violated it. For a strict binding
let !x = rhs in body
we generate
let x = rhs in case x of x { DEFAULT -> body }
re-using x (shadowed) as the case binder; see Note [Desugar Strict binds].
But the case binder inherited x's IdInfo, including, say, a NOINLINE
pragma (e.g. `res1` in GHC.Internal.Control.Monad.ST.Lazy.Imp). Now
GHC.HsToCore.Utils.seqVar gives the case binder vanilla IdInfo.
This was not just a matter of taste. For example
h fm s = let {-# NOINLINE res1 #-}
!res1 = fm s
!(f, s') = res1
in (f+1, s')
The NOINLINE case binder becomes a NOINLINE alias `let res3 = res2`,
which is never inlined, and survives (as a silly join point) into the
final code.
* Fixes the Simplifier, which could violate it when duplicating a
StrictBind continuation, which makes a join point
let x = <> in b ==> join j x = b in j <>
If x has such IdInfo, we now use a fresh binder for the join point
let x = <> in b ==> join j x' = let x = x' in b in j <>
See (DSB1) in Note [Duplicating StrictBind].
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
03311d5f by Simon Peyton Jones at 2026-11-23T00:09:58+00:00
Add varIsHNF, and use it in move_transit_vars
`varIsHNF v` is the same as `exprIsHNF (Var v)`, but avoids building the
Var only to take it apart. The (Var v) case of exprIsHNFlike now uses
the shared varIsHNFlike, so the two cannot drift apart.
In GHC.Core.Opt.WorkWrap.Utils.move_transit_vars we had the guard
isUnliftedType var_ty || exprIsHNF (Var var)
but exprIsHNF is already True of variables of (definitely) unlifted type,
so the isUnliftedType test was redundant. Now it is just (varIsHNF var).
Also make `exprIsHNFlike` treat an application with no value arguments, such as
`f @Int`, exactly like the bare variable `f`, by going through varIsHNFlike.
Otherwise no change in behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
b1f5011a by Simon Peyton Jones at 2026-11-23T00:09:58+00:00
Use SimplClo for the argument of ApplyToVal
This patch renames SimplSR to SimplClo (a "closure"), and uses it not
only as the range of the Simplifier's substitution, but also as the
argument of an ApplyToVal continuation. ApplyToVal used to have three
fields
sc_env :: StaticEnv
sc_arg :: CoreExpr
sc_cast :: MOutCoercion
but now has just
sc_dup :: DupFlag
sc_arg :: SimplClo
An un-simplified argument is (ContEx env arg mco), and an already-simplified
one is (DoneEx arg _). See Note [The argument of ApplyToVal] in
GHC.Core.Opt.Simplify.Utils.
The main payoff is that, since the substitution maps an Id to a SimplClo,
beta-reduction can substitute the argument for the lambda binder without
further ado. Accordingly, preInlineUnconditionally is split into
* preInlineLetUnconditionally, for let-bindings
* preInlineBetaUnconditionally, for beta-redexes, which takes a SimplClo
The latter omits some checks that cannot fire for lambda binders.
Other notes
* The new (ContEx env arg mco) form makes it easy to push a cast into an
argument (mkCloCastMCo), whether or not it has been simplified.
See Note [The MOutCoercion field of ContEx].
* `preInlineUnconditionally` gets split into two variants, one for
let-bindings and one for beta-reduction (which takes a `SimplClo`).
There is a little bit of duplication here, but not much.
* Fixes #27962. The simplifier was previously dropping a cast when dealing
with runRW#. The new `SimplClo` makes that bug much harder to allow.
* Fixes #27963. contOutArgs, which supplies the arguments for Plan (BEFORE)
rule matching, ignored the sc_cast field of ApplyToVal. So in
(f |> co) n ==> f (n |> co1) -- co1 in sc_cast
a rule for `f` saw `f n` rather than `f (n |> co1)`, and failed to match
(the rule matcher checks the types of template variables). If f's
unfolding is active, f may then be inlined, and the rule is lost for
good. Now contOutArgs uses simplCloExpr, which includes the pending cast.
Almost no change in behaviour, except for the #27963 bug-fix.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
70923afb by Simon Peyton Jones at 2026-11-23T00:09:58+00:00
Add splitThunkCpr
This commit adds GHC.Core.Opt.WorkWrap.splitThunkCpr, which adds a form
of "thunk splitting" for strict bindings that have CPR information.
See Note [Thunk splitting] in WorkWrap.hs for the details.
It catches a previously-unrecognised optimisation opportunity
(see #28258) but it only helps in fairly obscure cases, so
I don't expect a big impact in practice.
As usually I did lots of refactoring along the way.
LLM disclosure: lots of interaction with Claude, but I wrote all the
code and comments.
- - - - -
119 changed files:
- .gitlab-ci.yml
- + changelog.d/27694
- + changelog.d/T27137
- + changelog.d/T27862
- + changelog.d/T27962
- + changelog.d/T27963
- + changelog.d/T28135
- + changelog.d/make-depends-link-nodes
- compiler/GHC/Cmm/CommonBlockElim.hs
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/CFG.hs
- compiler/GHC/CmmToAsm/Instr.hs
- compiler/GHC/CmmToAsm/LA64/Instr.hs
- compiler/GHC/CmmToAsm/Monad.hs
- compiler/GHC/CmmToAsm/PPC/Instr.hs
- compiler/GHC/CmmToAsm/RV64/Instr.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Parser.y
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Types/Cpr.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Utils/Monad.hs
- + distrib/configure.ac
- docs/users_guide/make-depends-json-schema-1_0.json
- testsuite/tests/ado/T22483.stderr
- + testsuite/tests/codeGen/should_compile/T27694.hs
- + testsuite/tests/codeGen/should_compile/T27694c.hs
- + testsuite/tests/codeGen/should_compile/T27694d.hs
- testsuite/tests/codeGen/should_compile/all.T
- + testsuite/tests/codeGen/should_run/T27694b.hs
- + testsuite/tests/codeGen/should_run/T27694b.stdout
- + testsuite/tests/codeGen/should_run/T27915.hs
- + testsuite/tests/codeGen/should_run/T27915.stdout-ws-32
- + testsuite/tests/codeGen/should_run/T27915.stdout-ws-64
- testsuite/tests/codeGen/should_run/all.T
- + testsuite/tests/deSugar/should_compile/T27862.hs
- + testsuite/tests/deSugar/should_compile/T27862.stderr
- + testsuite/tests/deSugar/should_compile/T27862a.hs
- + testsuite/tests/deSugar/should_compile/T27862a.stderr
- + testsuite/tests/deSugar/should_compile/T27862b.hs
- + testsuite/tests/deSugar/should_compile/T27862b.stderr
- + testsuite/tests/deSugar/should_compile/T27862c.hs
- + testsuite/tests/deSugar/should_compile/T27862c.stderr
- + testsuite/tests/deSugar/should_compile/T27862d.hs
- + testsuite/tests/deSugar/should_compile/T27862d.stderr
- + testsuite/tests/deSugar/should_compile/T28137.hs
- + testsuite/tests/deSugar/should_compile/T28137.stderr
- testsuite/tests/deSugar/should_compile/all.T
- testsuite/tests/deSugar/should_run/dsrun008.stderr
- testsuite/tests/driver/mkdepend/all.T
- + testsuite/tests/driver/mkdepend/mhu04/app/Main.hs
- + testsuite/tests/driver/mkdepend/mhu04/app/Utils.hs
- + testsuite/tests/driver/mkdepend/mhu04/lib/Lib.hs
- + testsuite/tests/driver/mkdepend/mhu04/lib/Lib/Internal.hs
- + testsuite/tests/driver/mkdepend/mhu04/unitApp
- + testsuite/tests/driver/mkdepend/mhu04/unitLib
- + testsuite/tests/driver/mkdepend/mhu05/app/Main.hs
- + testsuite/tests/driver/mkdepend/mhu05/lib/Lib.hs
- + testsuite/tests/driver/mkdepend/mhu05/lib/Lib/Internal.hs
- + testsuite/tests/driver/mkdepend/mhu05/test/Spec.hs
- + testsuite/tests/driver/mkdepend/mhu05/unitApp
- + testsuite/tests/driver/mkdepend/mhu05/unitLib
- + testsuite/tests/driver/mkdepend/mhu05/unitTest
- + testsuite/tests/driver/mkdepend/mkdepend02.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend02/Main.hs
- + testsuite/tests/driver/mkdepend/mkdepend_bkp_01/bkp01.bkp
- + testsuite/tests/driver/mkdepend/mkdepend_mhu04.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu04.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend_mhu05.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu05.dep-makefile
- testsuite/tests/pmcheck/should_compile/T24234.stderr
- testsuite/tests/rts/IOManager.hsc
- testsuite/tests/rts/all.T
- testsuite/tests/simplCore/should_compile/T15445.stderr
- + testsuite/tests/simplCore/should_compile/T27962.hs
- + testsuite/tests/simplCore/should_compile/T27963.hs
- + testsuite/tests/simplCore/should_compile/T27963.stderr
- + testsuite/tests/simplCore/should_compile/T27965.hs
- + testsuite/tests/simplCore/should_compile/T27965a.hs
- + testsuite/tests/simplCore/should_compile/T28158.hs
- + testsuite/tests/simplCore/should_compile/T28158.stderr
- testsuite/tests/simplCore/should_compile/all.T
- + testsuite/tests/th/T27826.hs
- testsuite/tests/th/all.T
- + testsuite/tests/typecheck/should_compile/T28135.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/tcfail203a.stderr
- utils/check-exact/ExactPrint.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bfe578d65058267134b03d49263c43…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bfe578d65058267134b03d49263c43…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/az/epa-tidy-locatedxxx-37] EPA: Replace AnnListLayout / AnnListBrackets with EpLayout
by Alan Zimmerman (@alanz) 22 Nov '26
by Alan Zimmerman (@alanz) 22 Nov '26
22 Nov '26
Alan Zimmerman pushed to branch wip/az/epa-tidy-locatedxxx-37 at Glasgow Haskell Compiler / GHC
Commits:
828122f2 by Alan Zimmerman at 2026-11-22T23:15:41+00:00
EPA: Replace AnnListLayout / AnnListBrackets with EpLayout
We have harmonised the use of `AnnListLayout` and `AnnListBrackets` to
be equivalent to `EpLayout`.
We now take the final step, and remove them completely in favour of
`EpLayout`.
The change looks bigger than it is, because a lot of golden test
output gets updated.
- - - - -
28 changed files:
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess.hs
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
- testsuite/tests/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_compile/T15279.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/parser/should_compile/T20452.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- testsuite/tests/printer/T18791.stderr
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
Changes:
=====================================
compiler/GHC/Parser.y
=====================================
@@ -1529,13 +1529,13 @@ where_type_family :: { Located ((EpToken "where", EpToken ".."),FamilyInfo GhcP
, ClosedTypeFamily (fst $ fst $ unLoc $2) (fmap reverse $ snd $ unLoc $2)) }
ty_fam_inst_eqn_list :: { Located ((AnnList, EpToken ".."),Maybe [LTyFamInstEqn GhcPs]) }
- : '{' ty_fam_inst_eqns '}' { sLL $1 $> ((AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) [], noAnn)
+ : '{' ty_fam_inst_eqns '}' { sLL $1 $> ((AnnList (EpExplicitBraces (epTok $1) (epTok $3)) [], noAnn)
,Just (unLoc $2)) }
| vocurly ty_fam_inst_eqns close { let (L loc _) = $2 in
- L loc ((AnnList (AnnListLayout (glR $1)) ListNone [], noAnn),Just (unLoc $2)) }
- | '{' '..' '}' { sLL $1 $> ((AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) [], epTok $2), Nothing) }
+ L loc ((AnnList (EpVirtualBraces (glR $1)) [], noAnn),Just (unLoc $2)) }
+ | '{' '..' '}' { sLL $1 $> ((AnnList (EpExplicitBraces (epTok $1) (epTok $3)) [], epTok $2), Nothing) }
| vocurly '..' close { let (L loc _) = $2 in
- L loc ((AnnList (AnnListLayout (glR $1)) ListNone [], epTok $2),Nothing) }
+ L loc ((AnnList (EpVirtualBraces (glR $1)) [], epTok $2),Nothing) }
ty_fam_inst_eqns :: { Located [LTyFamInstEqn GhcPs] }
: ty_fam_inst_eqns ';' ty_fam_inst_eqn
@@ -1797,10 +1797,10 @@ cvars1 :: { [RecordPatSynField GhcPs] }
where_decls :: { LocatedA (OrdList (LHsDecl GhcPs), EpToken "where", AnnList) }
: 'where' '{' decls '}' {% amsA' (sLL $1 $> (thdOf3 $ unLoc $3,
epTok $1,
- AnnList AnnListBraces (ListBraces (epTok $2) (epTok $4)) (sndOf3 $ unLoc $3))) }
+ AnnList (EpExplicitBraces (epTok $2) (epTok $4)) (sndOf3 $ unLoc $3))) }
| 'where' vocurly decls close {% amsA' (sLL $1 $3 (thdOf3 $ unLoc $3,
epTok $1,
- AnnList (AnnListLayout (glR $3)) ListNone (sndOf3 $ unLoc $3))) }
+ AnnList (EpVirtualBraces (glR $3)) (sndOf3 $ unLoc $3))) }
pattern_synonym_sig :: { LSig GhcPs }
: 'pattern' con_list '::' sigtype
@@ -1853,10 +1853,10 @@ decllist_cls
:: { Located ( AnnList
, OrdList (LHsDecl GhcPs)
, EpLayout) } -- Reversed
- : '{' decls_cls '}' { sLL $1 $> (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)
+ : '{' decls_cls '}' { sLL $1 $> (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)
,snd $ unLoc $2, epExplicitBraces $1 $3) }
| vocurly decls_cls close { let { L l (anns, decls) = $2 }
- in L l (AnnList (AnnListLayout (glR $1)) ListNone anns, decls, EpVirtualBraces (glR $1)) }
+ in L l (AnnList (EpVirtualBraces (glR $1)) anns, decls, EpVirtualBraces (glR $1)) }
-- Class body
--
@@ -1897,8 +1897,8 @@ decls_inst :: { Located ([EpToken ";"],OrdList (LHsDecl GhcPs)) } -- Reversed
decllist_inst
:: { Located (AnnList, OrdList (LHsDecl GhcPs)) } -- Reversed
- : '{' decls_inst '}' { sLL $1 $> (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2), snd $ unLoc $2) }
- | vocurly decls_inst close { L (gl $2) (AnnList (AnnListLayout (glR $1)) ListNone (fst $ unLoc $2), snd $ unLoc $2) }
+ : '{' decls_inst '}' { sLL $1 $> (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) (fst $ unLoc $2), snd $ unLoc $2) }
+ | vocurly decls_inst close { L (gl $2) (AnnList (EpVirtualBraces (glR $1)) (fst $ unLoc $2), snd $ unLoc $2) }
-- Instance body
--
@@ -1935,9 +1935,9 @@ decls :: { Located (EpaLocation, [EpToken ";"], OrdList (LHsDecl GhcPs)) }
| {- empty -} { noLoc (noAnn, [],nilOL) }
decllist :: { Located (AnnList,Located (OrdList (LHsDecl GhcPs))) }
- : '{' decls '}' { sLL $1 $> (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) (sndOf3 $ unLoc $2)
+ : '{' decls '}' { sLL $1 $> (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) (sndOf3 $ unLoc $2)
,sL1 $2 $ thdOf3 $ unLoc $2) }
- | vocurly decls close { sL1 $2 (AnnList (AnnListLayout (fstOf3 $ unLoc $2)) ListNone (sndOf3 $ unLoc $2)
+ | vocurly decls close { sL1 $2 (AnnList (EpVirtualBraces (fstOf3 $ unLoc $2)) (sndOf3 $ unLoc $2)
,sL1 $2 $ thdOf3 $ unLoc $2) }
-- Binding groups other than those of class and instance declarations
@@ -1945,16 +1945,16 @@ decllist :: { Located (AnnList,Located (OrdList (LHsDecl GhcPs))) }
binds :: { LHsLocalBinds GhcPs }
-- May have implicit parameters
-- No type declarations
- : decllist {% do { let { (AnnList la p s, decls) = unLoc $1 }
+ : decllist {% do { let { (ann, decls) = unLoc $1 }
; val_binds <- cvBindGroup (unLoc $ decls)
; !cs <- getCommentsFor (gl $1)
- ; return (L (EpAnn (glR $1) noAnn cs) $ HsValBinds (AnnList la p s, noEpTok) val_binds)} }
+ ; return (L (EpAnn (glR $1) noAnn cs) $ HsValBinds (ann, noEpTok) val_binds)} }
| '{' dbinds '}' {% amsA' (sLL $1 $>
- $ HsIPBinds (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) [], noEpTok) (IPBinds noExtField (reverse $ unLoc $2))) }
+ $ HsIPBinds (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) [], noEpTok) (IPBinds noExtField (reverse $ unLoc $2))) }
| vocurly dbinds close {% amsA' (sLL $1 $2
- $ HsIPBinds (AnnList (AnnListLayout $ glR $2) ListNone [], noEpTok) (IPBinds noExtField (reverse $ unLoc $2))) }
+ $ HsIPBinds (AnnList (EpVirtualBraces $ glR $2) [], noEpTok) (IPBinds noExtField (reverse $ unLoc $2))) }
wherebinds :: { Maybe (LHsLocalBinds GhcPs) }
@@ -2556,11 +2556,11 @@ gadt_constrlist :: { Located ((EpToken "where", AnnList)
: 'where' '{' gadt_constrs '}' {% checkEmptyGADTs $
L (comb2 $1 $4)
- ((epTok $1, AnnList AnnListBraces (ListBraces (epTok $2) (epTok $4)) [])
+ ((epTok $1, AnnList (EpExplicitBraces (epTok $2) (epTok $4)) [])
, unLoc $3) }
| 'where' vocurly gadt_constrs close {% checkEmptyGADTs $
L (comb2 $1 $3)
- ((epTok $1, AnnList (AnnListLayout $ glR $2) ListNone [])
+ ((epTok $1, AnnList (EpVirtualBraces $ glR $2) [])
, unLoc $3) }
| {- empty -} { noLoc (noAnn,[]) }
@@ -3339,8 +3339,8 @@ acmd :: { LHsCmdTop GhcPs }
return (sL1a cmd $ HsCmdTop noExtField cmd) }
cvtopbody :: { (AnnList,[LHsDecl GhcPs]) }
- : '{' cvtopdecls0 '}' { (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) [],$2) }
- | vocurly cvtopdecls0 close { (AnnList (AnnListLayout (glR $1)) ListNone [],$2) }
+ : '{' cvtopdecls0 '}' { (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) [],$2) }
+ | vocurly cvtopdecls0 close { (AnnList (EpVirtualBraces (glR $1)) [],$2) }
cvtopdecls0 :: { [LHsDecl GhcPs] }
: topdecls_semi { cvTopDecls $1 }
@@ -3568,12 +3568,12 @@ guardquals1 :: { Located [LStmt GhcPs (LHsExpr GhcPs)] }
altslist(PATS) :: { forall b. DisambECP b => PV (LocatedA ([LMatch GhcPs (LocatedA b)], AnnList)) }
: '{' alts(PATS) '}' { $2 >>= \ $2 -> amsA'
(sLL $1 $> (reverse (snd $ unLoc $2),
- (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)))) }
+ (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)))) }
| vocurly alts(PATS) close { $2 >>= \ $2 -> amsA'
(L (getLoc $2) (reverse (snd $ unLoc $2),
- (AnnList (AnnListLayout $ glR $2) ListNone (fst $ unLoc $2)))) }
- | '{' '}' { amsA' (sLL $1 $> ([], (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $2)) []))) }
- | vocurly close { return $ noLocA ([], AnnList (AnnListLayout $ glR $1) ListNone []) }
+ (AnnList (EpVirtualBraces $ glR $2) (fst $ unLoc $2)))) }
+ | '{' '}' { amsA' (sLL $1 $> ([], (AnnList (EpExplicitBraces (epTok $1) (epTok $2)) []))) }
+ | vocurly close { return $ noLocA ([], AnnList (EpVirtualBraces $ glR $1) []) }
alts(PATS) :: { forall b. DisambECP b => PV (Located ([EpToken ";"],[LMatch GhcPs (LocatedA b)])) }
: alts1(PATS) { $1 >>= \ $1 -> return $
@@ -3630,9 +3630,9 @@ gdpats :: { forall b. DisambECP b => PV (Located (NonEmpty (LGRHS GhcPs (Located
-- we don't need it.
ifgdpats :: { Located (AnnList, NonEmpty (LGRHS GhcPs (LHsExpr GhcPs))) }
: '{' gdpats '}' {% runPV $2 >>= \ $2 ->
- return $ sLL $1 $> (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) [], unLoc $2) }
+ return $ sLL $1 $> (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) [], unLoc $2) }
| gdpats close {% runPV $1 >>= \ $1 ->
- return $ sL1 $1 (AnnList (AnnListLayout (startLocSpan $ glR $1)) ListNone [], unLoc $1) }
+ return $ sL1 $1 (AnnList (EpVirtualBraces (startLocSpan $ glR $1)) [], unLoc $1) }
gdpat :: { forall b. DisambECP b => PV (LGRHS GhcPs (LocatedA b)) }
: '|' guardquals '->' exp
@@ -3682,10 +3682,10 @@ apat : aexp {% (checkPattern <=< runPV) (unECP $1) }
stmtlist :: { forall b. DisambECP b => PV (LocatedA (AnnList, Located [LocatedA (Stmt GhcPs (LocatedA b))])) }
: '{' stmts '}' { $2 >>= \ $2 ->
- amsA' (sLL $1 $> (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) (fromOL $ fst $ unLoc $2)
+ amsA' (sLL $1 $> (AnnList (EpExplicitBraces (epTok $1) (epTok $3)) (fromOL $ fst $ unLoc $2)
, sL1 $2 $ reverse $ snd $ unLoc $2))}
| vocurly stmts close { $2 >>= \ $2 ->
- amsA' (L (stmtsLoc $2) (AnnList (AnnListLayout (spanAsAnchor $ stmtsLoc $2)) ListNone (fromOL $ fst $ unLoc $2)
+ amsA' (L (stmtsLoc $2) (AnnList (EpVirtualBraces (spanAsAnchor $ stmtsLoc $2)) (fromOL $ fst $ unLoc $2)
, sL1 $2 $ reverse $ snd $ unLoc $2))}
-- do { ;; s ; s ; ; s ;; }
=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -41,7 +41,7 @@ module GHC.Parser.Annotation (
-- ** Annotation data types used in TTG extension points
- AnnList(..), AnnListBrackets(..), AnnListLayout(..),
+ AnnList(..),
AnnParen(..),
AnnCType(..),AnnWarningTxt(..),AnnOverlap(..),AnnAnnDecl(..),AnnPragSCC(..),
@@ -291,6 +291,7 @@ data EpLayout =
EpNoLayout
deriving instance Data EpLayout
+deriving instance Eq EpLayout
-- | Used in 'GHC.Parser.Haddock' to get layout column. It assumes
-- | there is a RealSrcSpan in it, falling back to zero otherwise
@@ -522,31 +523,12 @@ instance Outputable TrailingAnn where
-- surrounding items such as braces if present, and introductory
-- keywords such as 'where'.
--- AZ: goal: only used when there is layout, so vertical alignment matters
data AnnList
= AnnList {
- al_layout :: !AnnListLayout,
- al_brackets :: !AnnListBrackets,
+ al_layout :: !EpLayout,
al_semis :: [EpToken ";"] -- decls
} deriving (Data,Eq)
-data AnnListBrackets
- = ListBraces (EpToken "{") (EpToken "}")
- | ListNone
- deriving (Data,Eq)
-
--- | How the extent of a list was delimited in the source.
-data AnnListLayout
- = AnnListBraces -- ^ Explicit @{ ; }@ written by the user. The tokens
- -- live in 'al_brackets' and 'al_semis'.
- | AnnListLayout !EpaLocation
- -- ^ The lexer opened an implicit layout context.
- -- The 'EpaLocation' is the @vocurly@ token (or, for
- -- MultiWayIf, the leading @|@), whose start column is
- -- the layout column chosen by 'new_layout_context'.
- | AnnListNoLayout -- ^ Neither: an Empty or compiler-generated list.
- deriving (Data, Eq)
-
-- ---------------------------------------------------------------------
-- Annotations for parenthesised elements, such as tuples, lists
-- ---------------------------------------------------------------------
@@ -1017,10 +999,10 @@ instance NoAnn NoEpAnns where
noAnn = NoEpAnns
instance NoAnn AnnList where
- noAnn = AnnList noAnn ListNone noAnn
+ noAnn = AnnList noAnn noAnn
-instance NoAnn AnnListLayout where
- noAnn = AnnListNoLayout
+instance NoAnn EpLayout where
+ noAnn = EpNoLayout
instance NoAnn NameAnn where
noAnn = NameAnnTrailing []
@@ -1114,17 +1096,13 @@ instance Outputable NameAnn where
= text "NameAnnTrailing" <+> ppr t
instance Outputable AnnList where
- ppr (AnnList l p s)
- = text "AnnList" <+> ppr l <+> ppr p <+> ppr s
-
-instance Outputable AnnListBrackets where
- ppr (ListBraces o c) = text "ListBraces" <+> ppr o <+> ppr c
- ppr ListNone = text "ListNone"
+ ppr (AnnList l s)
+ = text "AnnList" <+> ppr l <+> ppr s
-instance Outputable AnnListLayout where
- ppr AnnListBraces = text "AnnListBraces"
- ppr (AnnListLayout l) = text "AnnListLayout" <+> ppr l
- ppr AnnListNoLayout = text "AnnListNoLayout"
+instance Outputable EpLayout where
+ ppr (EpExplicitBraces o c) = text "EpExplicitBraces" <+> ppr o <+> ppr c
+ ppr (EpVirtualBraces l) = text "EpVirtualBraces" <+> ppr l
+ ppr EpNoLayout = text "EpNoLayout"
instance Outputable AnnCType where
ppr (AnnCType o c l ca)
=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -473,13 +473,13 @@ valid_anchor (EpaSpan (RealSrcSpan r _)) = srcSpanStartLine r >= 0
valid_anchor _ = False
patch_annlist_layout :: AnnList -> AnnList
-patch_annlist_layout (AnnList lo bs s) = AnnList (patch_layout lo) bs s
+patch_annlist_layout (AnnList lo s) = AnnList (patch_layout lo) s
-- If the decl list for where binds is empty, the anchor ends up
-- invalid. Explicitly mark it as not having layout
-patch_layout :: AnnListLayout -> AnnListLayout
-patch_layout lo@(AnnListLayout (EpaSpan (RealSrcSpan _ _)) ) = lo
-patch_layout (AnnListLayout _ ) = AnnListNoLayout
+patch_layout :: EpLayout -> EpLayout
+patch_layout lo@(EpVirtualBraces (EpaSpan (RealSrcSpan _ _)) ) = lo
+patch_layout (EpVirtualBraces _ ) = EpNoLayout
patch_layout lo = lo
-- | The anchor for a stmtlist is based on either the location or
=====================================
testsuite/tests/ghc-api/exactprint/T22919.stderr
=====================================
@@ -70,8 +70,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/ghc-api/exactprint/Test20239.stderr
=====================================
@@ -134,8 +134,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { Test20239.hs:5:34 })))
=====================================
testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
=====================================
@@ -82,8 +82,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
=====================================
@@ -61,9 +61,8 @@
(EpTok
(EpaSpan { T17544.hs:5:12-16 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:6:3 }))
- (ListNone)
[]))
(EpVirtualBraces
(EpaSpan { T17544.hs:6:3 })))
@@ -242,9 +241,8 @@
(EpTok
(EpaSpan { T17544.hs:9:12-16 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:10:3 }))
- (ListNone)
[]))
(EpVirtualBraces
(EpaSpan { T17544.hs:10:3 })))
@@ -424,9 +422,8 @@
(EpTok
(EpaSpan { T17544.hs:13:12-16 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:14:3 }))
- (ListNone)
[]))
(EpVirtualBraces
(EpaSpan { T17544.hs:14:3 })))
@@ -606,9 +603,8 @@
(EpTok
(EpaSpan { T17544.hs:17:12-16 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:18:3 }))
- (ListNone)
[]))
(EpVirtualBraces
(EpaSpan { T17544.hs:18:3 })))
@@ -855,8 +851,7 @@
(EpTok
(EpaSpan { T17544.hs:22:12-16 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T17544.hs:22:18 }))
(EpTok (EpaSpan { T17544.hs:22:30 })))
[]))
@@ -1011,9 +1006,8 @@
(EpTok
(EpaSpan { T17544.hs:23:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:24:3 }))
- (ListNone)
[])))
[]
(L
@@ -1139,9 +1133,8 @@
(EpTok
(EpaSpan { T17544.hs:24:15-19 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:25:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -1257,8 +1250,7 @@
(EpTok
(EpaSpan { T17544.hs:28:12-16 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T17544.hs:28:18 }))
(EpTok (EpaSpan { T17544.hs:28:30 })))
[]))
@@ -1413,9 +1405,8 @@
(EpTok
(EpaSpan { T17544.hs:29:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:30:3 }))
- (ListNone)
[])))
[]
(L
@@ -1541,9 +1532,8 @@
(EpTok
(EpaSpan { T17544.hs:30:15-19 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:31:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -1659,8 +1649,7 @@
(EpTok
(EpaSpan { T17544.hs:34:12-16 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T17544.hs:34:18 }))
(EpTok (EpaSpan { T17544.hs:34:30 })))
[]))
@@ -1815,9 +1804,8 @@
(EpTok
(EpaSpan { T17544.hs:35:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:36:3 }))
- (ListNone)
[])))
[]
(L
@@ -1943,9 +1931,8 @@
(EpTok
(EpaSpan { T17544.hs:36:15-19 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:37:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -2061,8 +2048,7 @@
(EpTok
(EpaSpan { T17544.hs:40:12-16 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T17544.hs:40:18 }))
(EpTok (EpaSpan { T17544.hs:40:30 })))
[]))
@@ -2217,9 +2203,8 @@
(EpTok
(EpaSpan { T17544.hs:41:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:42:3 }))
- (ListNone)
[])))
[]
(L
@@ -2345,9 +2330,8 @@
(EpTok
(EpaSpan { T17544.hs:42:15-19 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:43:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -2463,8 +2447,7 @@
(EpTok
(EpaSpan { T17544.hs:46:12-16 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T17544.hs:46:18 }))
(EpTok (EpaSpan { T17544.hs:46:30 })))
[]))
@@ -2619,9 +2602,8 @@
(EpTok
(EpaSpan { T17544.hs:47:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:48:3 }))
- (ListNone)
[])))
[]
(L
@@ -2747,9 +2729,8 @@
(EpTok
(EpaSpan { T17544.hs:48:15-19 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:49:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -2865,8 +2846,7 @@
(EpTok
(EpaSpan { T17544.hs:52:13-17 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T17544.hs:52:19 }))
(EpTok (EpaSpan { T17544.hs:52:32 })))
[]))
@@ -3021,9 +3001,8 @@
(EpTok
(EpaSpan { T17544.hs:53:18-22 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:54:3 }))
- (ListNone)
[])))
[]
(L
@@ -3149,9 +3128,8 @@
(EpTok
(EpaSpan { T17544.hs:54:16-20 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544.hs:55:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
=====================================
@@ -185,9 +185,8 @@
(EpTok
(EpaSpan { T17544_kw.hs:14:3-7 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544_kw.hs:14:9 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -296,9 +295,8 @@
(EpTok
(EpaSpan { T17544_kw.hs:17:3-7 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544_kw.hs:17:9 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -415,9 +413,8 @@
(EpTok
(EpaSpan { T17544_kw.hs:21:3-7 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T17544_kw.hs:22:5 }))
- (ListNone)
[]))
(EpVirtualBraces
(EpaSpan { T17544_kw.hs:22:5 })))
=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
=====================================
@@ -82,8 +82,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:5:3 })))
@@ -419,8 +418,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:11:11 })))
@@ -590,8 +588,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:14:11 })))
@@ -787,8 +784,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:19:11 })))
@@ -984,8 +980,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:27:11 })))
@@ -1228,8 +1223,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:31:11 })))
@@ -1485,8 +1479,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T24221.hs:36:11 })))
=====================================
testsuite/tests/module/mod185.stderr
=====================================
@@ -97,8 +97,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -120,8 +120,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { DumpParsedAst.hs:7:12 })))
@@ -365,9 +364,8 @@
(EpaSpan { <no location info> })))
(ClosedTypeFamily
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpParsedAst.hs:11:3 }))
- (ListNone)
[])
(Just
[(L
@@ -837,8 +835,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { DumpParsedAst.hs:15:19 })))
@@ -1154,9 +1151,8 @@
(EpaSpan { <no location info> })))
(ClosedTypeFamily
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpParsedAst.hs:19:3 }))
- (ListNone)
[])
(Just
[(L
@@ -1808,9 +1804,8 @@
(EpTok
(EpaSpan { DumpParsedAst.hs:22:62-66 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpParsedAst.hs:23:3 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -2235,8 +2230,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
=====================================
@@ -90,8 +90,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -219,8 +218,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -297,9 +295,8 @@
((,)
(Right
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpParsedAstComments.hs:16:3 }))
- (ListNone)
[]))
(EpaSpan { DumpParsedAstComments.hs:14:7-8 }))
(DoExpr
@@ -373,8 +370,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
=====================================
@@ -30,8 +30,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -184,8 +183,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -318,9 +316,8 @@
(EpaSpan { <no location info> })))
(ClosedTypeFamily
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpRenamedAst.hs:13:3 }))
- (ListNone)
[])
(Just
[(L
@@ -1046,8 +1043,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { <no location info> })))
@@ -1194,9 +1190,8 @@
(EpaSpan { <no location info> })))
(ClosedTypeFamily
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpRenamedAst.hs:26:3 }))
- (ListNone)
[])
(Just
[(L
@@ -2322,8 +2317,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { <no location info> })))
=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -261,8 +261,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -333,9 +332,8 @@
((,)
(Right
(AnnList
- (AnnListLayout
- (EpaSpan { DumpSemis.hs:(11,3)-(12,3) }))
- (ListNone)
+ (EpVirtualBraces
+ (EpaSpan { DumpSemis.hs:(11,3)-(12,3) }))
[]))
(EpaSpan { DumpSemis.hs:10:7-8 }))
(DoExpr
@@ -364,8 +362,7 @@
((,)
(Right
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { DumpSemis.hs:11:6 }))
(EpTok (EpaSpan { DumpSemis.hs:11:15 })))
[(EpTok
@@ -560,8 +557,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -632,8 +628,7 @@
((,)
(Right
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { DumpSemis.hs:16:3 }))
(EpTok (EpaSpan { DumpSemis.hs:19:3 })))
[(EpTok
@@ -818,8 +813,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -890,8 +884,7 @@
((,)
(Right
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { DumpSemis.hs:22:10 }))
(EpTok (EpaSpan { DumpSemis.hs:22:30 })))
[(EpTok
@@ -1032,8 +1025,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1143,8 +1135,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1256,8 +1247,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1366,9 +1356,8 @@
(EpTok
(EpaSpan { DumpSemis.hs:28:40-44 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { DumpSemis.hs:29:3 }))
- (ListNone)
[]))
(EpVirtualBraces
(EpaSpan { DumpSemis.hs:29:3 })))
@@ -1766,8 +1755,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1898,8 +1886,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1981,8 +1968,7 @@
(HsValBinds
((,)
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { DumpSemis.hs:34:13 }))
(EpTok (EpaSpan { DumpSemis.hs:34:31 })))
[(EpTok
@@ -2026,8 +2012,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -2145,8 +2130,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -2282,8 +2266,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -2393,8 +2376,7 @@
((,)
(FromSource)
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { DumpSemis.hs:38:4 }))
(EpTok (EpaSpan { DumpSemis.hs:44:4 })))
[(EpTok
=====================================
testsuite/tests/parser/should_compile/KindSigs.stderr
=====================================
@@ -112,9 +112,8 @@
(EpaSpan { <no location info> })))
(ClosedTypeFamily
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { KindSigs.hs:12:3 }))
- (ListNone)
[])
(Just
[(L
@@ -1003,8 +1002,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1728,8 +1726,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/parser/should_compile/T14189.stderr
=====================================
@@ -54,8 +54,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { <no location info> })))
=====================================
testsuite/tests/parser/should_compile/T15279.stderr
=====================================
@@ -28,7 +28,7 @@
[]
[]))
(EpVirtualBraces
- (1))
+ (EpaSpan { T15279.hs:5:1 }))
(Nothing)
(Nothing))
(Just
@@ -155,8 +155,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -239,8 +238,14 @@
(SourceText 'b')
('b'))))))
[])
- (EmptyLocalBinds
- (NoExtField)))))
+ (L
+ (EpAnn
+ (EpaSpan { <no location info> })
+ []
+ (EpaComments
+ []))
+ (EmptyLocalBinds
+ (NoExtField))))))
,(L
(EpAnn
(EpaSpan { T15279.hs-incl:2:1-13 })
@@ -316,8 +321,14 @@
(SourceText 'c')
('c'))))))
[])
- (EmptyLocalBinds
- (NoExtField)))))
+ (L
+ (EpAnn
+ (EpaSpan { <no location info> })
+ []
+ (EpaComments
+ []))
+ (EmptyLocalBinds
+ (NoExtField))))))
,(L
(EpAnn
(EpaSpan { T15279.hs:7:1-11 })
@@ -390,7 +401,13 @@
(SourceText 'a')
('a'))))))
[])
- (EmptyLocalBinds
- (NoExtField)))))])))))]))
+ (L
+ (EpAnn
+ (EpaSpan { <no location info> })
+ []
+ (EpaComments
+ []))
+ (EmptyLocalBinds
+ (NoExtField))))))])))))]))
=====================================
testsuite/tests/parser/should_compile/T15323.stderr
=====================================
@@ -111,9 +111,8 @@
(EpTok
(EpaSpan { T15323.hs:5:21-25 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T15323.hs:6:5 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
=====================================
testsuite/tests/parser/should_compile/T20452.stderr
=====================================
@@ -130,8 +130,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T20452.hs:5:24 })))
@@ -263,8 +262,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { T20452.hs:6:24 })))
@@ -325,8 +323,7 @@
(EpTok
(EpaSpan { T20452.hs:8:78-82 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T20452.hs:8:84 }))
(EpTok (EpaSpan { T20452.hs:8:85 })))
[]))
@@ -560,8 +557,7 @@
(EpTok
(EpaSpan { T20452.hs:9:78-82 }))
(AnnList
- (AnnListBraces)
- (ListBraces
+ (EpExplicitBraces
(EpTok (EpaSpan { T20452.hs:9:84 }))
(EpTok (EpaSpan { T20452.hs:9:85 })))
[]))
=====================================
testsuite/tests/parser/should_compile/T20718.stderr
=====================================
@@ -104,8 +104,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/parser/should_compile/T20846.stderr
=====================================
@@ -94,8 +94,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
testsuite/tests/printer/T18791.stderr
=====================================
@@ -82,9 +82,8 @@
(EpTok
(EpaSpan { T18791.hs:4:8-12 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { T18791.hs:5:3 }))
- (ListNone)
[])
(EpTok
(EpaSpan { <no location info> })))
=====================================
testsuite/tests/printer/Test20297.stdout
=====================================
@@ -83,8 +83,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -178,8 +177,7 @@
(HsValBinds
((,)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { Test20297.hs:9:3-7 })))
@@ -215,8 +213,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -310,9 +307,8 @@
(HsValBinds
((,)
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test20297.hs:13:9-26 }))
- (ListNone)
[])
(EpTok
(EpaSpan { Test20297.hs:12:3-7 })))
@@ -340,8 +336,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -412,9 +407,8 @@
((,)
(Right
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test20297.hs:13:22-26 }))
- (ListNone)
[]))
(EpaSpan { Test20297.hs:13:19-20 }))
(DoExpr
@@ -490,8 +484,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -563,9 +556,8 @@
(EpTok
(EpaSpan { Test20297.hs:16:5-6 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test20297.hs:16:8 }))
- (ListNone)
[]))
(:|
(L
@@ -784,8 +776,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -873,8 +864,7 @@
(HsValBinds
((,)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])
(EpTok
(EpaSpan { Test20297.ppr.hs:6:3-7 })))
@@ -904,8 +894,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -993,9 +982,8 @@
(HsValBinds
((,)
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test20297.ppr.hs:10:7-24 }))
- (ListNone)
[])
(EpTok
(EpaSpan { Test20297.ppr.hs:9:3-7 })))
@@ -1023,8 +1011,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1095,9 +1082,8 @@
((,)
(Right
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test20297.ppr.hs:10:20-24 }))
- (ListNone)
[]))
(EpaSpan { Test20297.ppr.hs:10:17-18 }))
(DoExpr
@@ -1167,8 +1153,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -1240,9 +1225,8 @@
(EpTok
(EpaSpan { Test20297.ppr.hs:11:5-6 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test20297.ppr.hs:11:8 }))
- (ListNone)
[]))
(:|
(L
=====================================
testsuite/tests/printer/Test24533.stdout
=====================================
@@ -65,8 +65,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])))
[]
(L
@@ -320,8 +319,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(EpNoLayout))
[]
@@ -454,9 +452,8 @@
(EpTok
(EpaSpan { Test24533.hs:14:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test24533.hs:16:3 }))
- (ListNone)
[])))
[]
(L
@@ -538,8 +535,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
@@ -735,8 +731,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[])))
[]
(L
@@ -964,8 +959,7 @@
(EpTok
(EpaSpan { <no location info> }))
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(EpNoLayout))
[]
@@ -1051,9 +1045,8 @@
(EpTok
(EpaSpan { Test24533.ppr.hs:5:17-21 }))
(AnnList
- (AnnListLayout
+ (EpVirtualBraces
(EpaSpan { Test24533.ppr.hs:6:3 }))
- (ListNone)
[])))
[]
(L
@@ -1135,8 +1128,7 @@
((,)
(FromSource)
(AnnList
- (AnnListNoLayout)
- (ListNone)
+ (EpNoLayout)
[]))
(L
(EpAnn
=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -967,23 +967,17 @@ markExternalSourceTextA ann src txt = do
-- ---------------------------------------------------------------------
-markLensBracketsO :: (Monad m, Monoid w)
- => a -> Lens a AnnListBrackets -> EP w m a
-markLensBracketsO a l =
- case view l a of
- ListBraces o c -> do
- o' <- markEpToken o
- return (set l (ListBraces o' c) a)
- ListNone -> return (set l ListNone a)
-
-markLensBracketsC :: (Monad m, Monoid w)
- => a -> Lens a AnnListBrackets -> EP w m a
-markLensBracketsC a l =
- case view l a of
- ListBraces o c -> do
- c' <- markEpToken c
- return (set l (ListBraces o c') a)
- ListNone -> return (set l ListNone a)
+markEpLayoutO :: (Monad m, Monoid w) => EpLayout -> EP w m EpLayout
+markEpLayoutO (EpExplicitBraces o c) = do
+ o' <- markEpToken o
+ return (EpExplicitBraces o' c)
+markEpLayoutO ep = return ep
+
+markEpLayoutC :: (Monad m, Monoid w) => EpLayout -> EP w m EpLayout
+markEpLayoutC (EpExplicitBraces o c) = do
+ c' <- markEpToken c
+ return (EpExplicitBraces o c')
+markEpLayoutC ep = return ep
-- -------------------------------------
@@ -1148,26 +1142,6 @@ limportDeclAnnPackage k annImp = fmap (\new -> annImp { importDeclAnnPackage = n
-- -------------------------------------
--- data AnnList
--- = AnnList {
--- al_layout :: !AnnListLayout,
--- al_brackets :: !AnnListBrackets,
--- al_semis :: [EpToken ";"], -- decls
--- al_trailing :: [TrailingAnn] -- ^ items appearing after the
--- -- list, such as '=>' for a
--- -- context
--- } deriving (Data,Eq)
-
-lal_brackets :: Lens AnnList AnnListBrackets
-lal_brackets k parent = fmap (\new -> parent { al_brackets = new })
- (k (al_brackets parent))
-
-lal_semis :: Lens AnnList [EpToken ";"]
-lal_semis k parent = fmap (\new -> parent { al_semis = new })
- (k (al_semis parent))
-
--- -------------------------------------
-
lfst :: Lens (a,b) a
lfst k parent = fmap (\new -> (new, snd parent))
(k (fst parent))
@@ -1427,12 +1401,6 @@ markLensFun a l f = do
-- -------------------------------------
-markEpAnnAllLT :: (Monad m, Monoid w, KnownSymbol tok)
- => ann -> Lens ann [EpToken tok] -> EP w m ann
-markEpAnnAllLT a l = do
- anns <- mapM markEpToken (view l a)
- return (set l anns a)
-
markEpaLocationAll :: (Monad m, Monoid w)
=> [EpaLocation] -> String -> EP w m [EpaLocation]
markEpaLocationAll locs str = mapM (\l -> printStringAtAA l str) locs
@@ -1468,12 +1436,12 @@ markAnnListA :: (Monad m, Monoid w)
=> AnnList
-> EP w m a
-> EP w m (AnnList, a)
-markAnnListA an action = do
- an0 <- markLensBracketsO an lal_brackets
- an1 <- markEpAnnAllLT an0 lal_semis
+markAnnListA (AnnList la semis) action = do
+ la0 <- markEpLayoutO la
+ semis' <- mapM markEpToken semis
r <- action
- an2 <- markLensBracketsC an1 lal_brackets
- return (an2, r)
+ la1 <- markEpLayoutC la0
+ return ((AnnList la1 semis'), r)
-- ---------------------------------------------------------------------
@@ -2638,7 +2606,7 @@ instance ExactPrint (HsLocalBinds GhcPs) where
w' <- markEpToken w -- 'where'
case al_layout an0 of
- AnnListLayout anc -> do
+ EpVirtualBraces anc -> do
when (not $ isEmptyValBinds valbinds) $ setExtraDP (Just anc)
_ -> return ()
@@ -2649,7 +2617,7 @@ instance ExactPrint (HsLocalBinds GhcPs) where
Nothing -> return an1
Just (ss,dp) -> do
setExtraDPReturn Nothing
- return $ an1 { al_layout = AnnListLayout (EpaDelta ss dp []) }
+ return $ an1 { al_layout = EpVirtualBraces (EpaDelta ss dp []) }
return (HsValBinds (an2, w') valbinds')
exact (HsIPBinds (an,w) bs) = do
=====================================
utils/check-exact/Main.hs
=====================================
@@ -520,8 +520,8 @@ changeLocalDecls libdir (L l p) = do
let oldDecls' = captureLineSpacing oldDecls
let (VbSig o:oldBinds) = map wrapValBind oldDecls'
o' = setEntryDP o (DifferentLine 2 0)
- let (AnnList (AnnListLayout _) a b) = van
- let van' = AnnList (AnnListLayout (EpaDelta noSrcSpan (DifferentLine 1 4) [])) a b
+ let (AnnList _ b) = van
+ let van' = AnnList (EpVirtualBraces (EpaDelta noSrcSpan (DifferentLine 1 4) [])) b
let binds' = L lb (HsValBinds (van',w)
(ValBinds noExtField (VbSig sig':VbBind decl':VbSig o':oldBinds)))
return (L lm (Match an mln pats (GRHSs emptyComments rhs binds')))
@@ -546,7 +546,7 @@ changeLocalDecls2 libdir (L l p) = do
replaceLocalBinds (L lm (Match ma mln pats (GRHSs _ rhs (L _ EmptyLocalBinds{})))) = do
let anc = (EpaDelta noSrcSpan (DifferentLine 1 2) [])
let anc2 = (EpaDelta noSrcSpan (DifferentLine 1 4) [])
- let an = ( AnnList (AnnListLayout anc2) ListNone []
+ let an = ( AnnList (EpVirtualBraces anc2) []
, EpTok (EpaDelta noSrcSpan (SameLine 0) []))
let lb = EpAnn anc noAnn emptyComments
let decls = [VbSig sig', VbBind decl']
=====================================
utils/check-exact/Transform.hs
=====================================
@@ -1021,15 +1021,13 @@ replaceDeclsValbinds w (L l (EmptyLocalBinds _)) new
oldWhereAnnotation :: (AnnList, EpToken "where")
-> WithWhere -> (AnnList, EpToken "where")
-oldWhereAnnotation (an, _w) ww = an'
+oldWhereAnnotation (an, _w) ww = (an, w')
-- TODO: when we set DP (0,0) for the HsValBinds EpEpaLocation,
-- change the AnnList anchor to have the correct DP too
where
- (AnnList ancl p s) = an
- w = case ww of
+ w' = case ww of
WithWhere -> EpTok (EpaDelta noSrcSpan (SameLine 0) [])
WithoutWhere -> noEpTok
- an' = (AnnList ancl p s, w)
newWhereAnnotation :: WithWhere -> (AnnList, EpToken "where")
newWhereAnnotation ww = (an, w)
@@ -1038,7 +1036,7 @@ newWhereAnnotation ww = (an, w)
w = case ww of
WithWhere -> EpTok (EpaDelta noSrcSpan (SameLine 0) [])
WithoutWhere -> noEpTok
- an = AnnList (AnnListLayout anc2) ListNone []
+ an = AnnList (EpVirtualBraces anc2) []
-- ---------------------------------------------------------------------
=====================================
utils/check-exact/Utils.hs
=====================================
@@ -341,10 +341,6 @@ insertTopLevelCppComments (HsModule (XModulePs an lo mdeprec mbDoc) mmn mexports
cs4' = workInComments cs4 these
(xs',rest') = allocPreceding xs rest
-annListBracketsLocs :: AnnListBrackets -> (EpaLocation,EpaLocation)
-annListBracketsLocs (ListBraces o c) = (getEpTokenLoc o, getEpTokenLoc c)
-annListBracketsLocs ListNone = (noAnn, noAnn)
-
data SplitWhere = Before | After
splitOnWhere :: SplitWhere -> EpToken "where" -> [LEpaComment] -> ([LEpaComment], [LEpaComment])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/828122f2b365075d64bb9ec25ffde32…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/828122f2b365075d64bb9ec25ffde32…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc] Pushed new branch wip/az/epa-tidy-locatedxxx-37
by Alan Zimmerman (@alanz) 22 Nov '26
by Alan Zimmerman (@alanz) 22 Nov '26
22 Nov '26
Alan Zimmerman pushed new branch wip/az/epa-tidy-locatedxxx-37 at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/az/epa-tidy-locatedxxx-37
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
22 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
ed5124b3 by mangoiv at 2026-11-22T16:41:50-05:00
ci: nightly push can run on any arch
- - - - -
1 changed file:
- .gitlab-ci.yml
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -1301,10 +1301,8 @@ ghcup-metadata-nightly:
# Update the ghcup metadata with information about this nightly pipeline
ghcup-metadata-nightly-push:
stage: deploy
- image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora43:$DOCKER_REV"
+ image: debian:13
dependencies: null
- tags:
- - x86_64-linux
variables:
BUILD_FLAVOUR: default
GIT_SUBMODULE_STRATEGY: "none"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ed5124b3a6f1bb0ee598fcd98ccba7c…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ed5124b3a6f1bb0ee598fcd98ccba7c…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
22 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
1e568190 by David Eichmann at 2026-11-22T16:40:28-05:00
Fix race condition in IOManager test
- - - - -
2 changed files:
- testsuite/tests/rts/IOManager.hsc
- testsuite/tests/rts/all.T
Changes:
=====================================
testsuite/tests/rts/IOManager.hsc
=====================================
@@ -582,15 +582,15 @@ recvEmptyBufPtcl (EmptyBufPtcl sync) fd = do
-- just do simple blocking read\/write of bytes. So this should just be needed
-- at the far ends of the hops.
--
-data FullBufPtcl = FullBufPtcl !(TVar Bool) !Int -- wait milliseconds
+data FullBufPtcl = FullBufPtcl !(TVar Bool) !Int -- wait microseconds
newFullBufPtcl :: Int -> IO FullBufPtcl
-newFullBufPtcl nhops = FullBufPtcl <$> newTVarIO False <*> pure waitms
+newFullBufPtcl nhops = FullBufPtcl <$> newTVarIO False <*> pure waitus
where
- waitms = nhops * 100 --100ms per hop
+ waitus = nhops * 100 -- 100µs per hop: 'timeout' takes microseconds
sendFullBufPtcl :: FullBufPtcl -> Fd -> Word8 -> IO ()
-sendFullBufPtcl ptcl@(FullBufPtcl sync _waitms) fd x = do
+sendFullBufPtcl ptcl@(FullBufPtcl sync _waitus) fd x = do
res <- writeByteNonBlocking fd x
case res of
Just () ->
@@ -606,20 +606,21 @@ sendFullBufPtcl ptcl@(FullBufPtcl sync _waitms) fd x = do
sendFullBufPtcl ptcl fd x
finishSendFullBufPtcl :: FullBufPtcl -> IO ()
-finishSendFullBufPtcl (FullBufPtcl sync _waitms) =
+finishSendFullBufPtcl (FullBufPtcl sync _waitus) =
atomically $ writeTVar sync True -- release reader to finish
recvFullBufPtcl :: FullBufPtcl -> Fd -> IO (Maybe Word8)
-recvFullBufPtcl (FullBufPtcl sync waitms) fd = do
+recvFullBufPtcl ptcl@(FullBufPtcl sync waitus) fd = do
atomically $ readTVar sync >>= check
res <- readByteNonBlocking fd
case res of
- Nothing -> fail "recvFullBufPtcl: unexpected blocking"
+ -- With copy hops in between, the far end can lag behind the sender.
+ Nothing -> threadWaitRead fd >> recvFullBufPtcl ptcl fd
Just Nothing -> return Nothing
Just (Just x) -> do
traceIO ("recvFullBufPtcl: read byte '" ++ show x
++ "' on fd " ++ show fd ++ ", now waiting")
- _ <- timeout waitms $ atomically $ readTVar sync >>= check . not
+ _ <- timeout waitus $ atomically $ readTVar sync >>= check . not
return (Just x)
=====================================
testsuite/tests/rts/all.T
=====================================
@@ -681,7 +681,7 @@ test('T23400', [], compile_and_run, ['-with-rtsopts -A8k'])
test('IOManager', [js_skip, when(arch('wasm32'), skip), when(opsys('mingw32'), skip),
pre_cmd('$MAKE -s --no-print-directory IOManager.hs'),
when(have_smp(), extra_ways(['threaded2'])),
- all_available_io_managers_except(['winio', 'mio'])],
+ all_available_io_managers_except(['winio'])],
compile_and_run, [''])
test('T24142', [req_target_smp], compile_and_run, ['-threaded -with-rtsopts "-N2"'])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1e5681902f63fe247d58333d29eaa27…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1e5681902f63fe247d58333d29eaa27…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
64f821c6 by Simon Peyton Jones at 2026-11-22T16:41:09-05:00
Fix a zonking bug
As #28135 showed, we were failing to zonk some type-variable
binders before doing scoped-sort dependency analysis, resulting
in chaos.
The fix is easy.
- - - - -
6 changed files:
- + changelog.d/T28135
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/TyCl.hs
- + testsuite/tests/typecheck/should_compile/T28135.hs
- testsuite/tests/typecheck/should_compile/all.T
Changes:
=====================================
changelog.d/T28135
=====================================
@@ -0,0 +1,8 @@
+section: compiler
+issues: #28135
+mrs: !17006
+synopsis:
+ Fix a bug in kind inference in data constructors
+description:
+ This bug affected only data constructors using kind polymorphism,
+ and declared in GADT style.
=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -29,7 +29,6 @@ module GHC.Tc.Gen.HsType (
bindOuterFamEqnTKBndrs_Q_Tv, bindOuterFamEqnTKBndrs,
tcOuterTKBndrs, scopedSortOuter, outerTyVars, outerTyVarBndrs,
- tcGadtConTyVarBndrs,
bindOuterSigTKBndrs_Tv,
tcExplicitTKBndrs,
bindNamedWildCardBinders,
@@ -3545,20 +3544,6 @@ tcOuterTKBndrsX skol_mode skol_info outer_bndrs thing_inside
, hso_bndrs = exp_bndrs }
, thing) }
----------------
-tcGadtConTyVarBndrs :: SkolemInfo
- -> HsOuterSigTyVarBndrs GhcRn
- -> [LHsGadtTelescope GhcRn]
- -> TcM a -> TcM ([TcTyVarBinder], a)
-tcGadtConTyVarBndrs skol_info outer inner thing_inside
- = do { (outer_bndrs, (inner_tvbs, a)) <-
- tcOuterTKBndrs skol_info outer $
- tcExplicitTKBndrs skol_info (gadtTelescopeBndrs inner) $
- thing_inside
- ; outer_bndrs <- scopedSortOuter outer_bndrs
- ; let outer_tvbs = tyVarSpecToBinders (outerTyVarBndrs outer_bndrs)
- ; return (outer_tvbs ++ inner_tvbs, a) }
-
--------------------------------------
-- Explicit tyvar binders
--------------------------------------
=====================================
compiler/GHC/Tc/Solver.hs
=====================================
@@ -187,7 +187,7 @@ pushLevelAndSolveEqualitiesX callsite thing_inside
do { (res, wanted) <- captureConstraints thing_inside
; wanted <- runTcSEqualities (simplifyTopWanteds wanted)
; return (wanted,res) }
- ; traceTc "pushLevelAndSolveEqualities }" (vcat [ text "Residual:" <+> ppr wanted
+ ; traceTc "pushLevelAndSolveEqualitiesX }" (vcat [ text "Residual:" <+> ppr wanted
, text "Level:" <+> ppr tclvl ])
; return (tclvl, wanted, res) }
=====================================
compiler/GHC/Tc/TyCl.hs
=====================================
@@ -4185,12 +4185,16 @@ tcConDecl new_or_data dd_info rep_tycon tc_bndrs _res_kind tag_map
, con_cxts = cxts, con_g_args = hs_args
, con_res_ty = hs_res_ty })
= addErrCtxt (DataConDefCtxt names) $
- do { traceTc "tcConDecl 1 gadt" (ppr names)
+ do { traceTc "tcConDecl 1 gadt" $
+ vcat [ text "data con names:" <+> ppr names
+ , text "outer_bndrs:" <+> ppr outer_bndrs
+ , text "inner_bndrs:" <+> ppr inner_bndrs ]
; let L _ name :| _ = names
; skol_info <- mkSkolemInfo (DataConSkol name)
- ; (tclvl, wanted, (tvbs, (ctxt, arg_tys, res_ty, field_lbls, stricts)))
- <- pushLevelAndSolveEqualitiesX "tcConDecl:GADT" $
- tcGadtConTyVarBndrs skol_info outer_bndrs inner_bndrs $
+ ; (tclvl, wanted, (tc_outer, (inner_tvbs, (ctxt, arg_tys, res_ty, field_lbls, stricts))))
+ <- pushLevelAndSolveEqualitiesX "tcConDecl:GADT" $
+ tcOuterTKBndrs skol_info outer_bndrs $
+ tcExplicitTKBndrs skol_info (gadtTelescopeBndrs inner_bndrs) $
do { ctxt <- tcHsContext cxts
; (res_ty, res_kind) <- tcInferLHsTypeKind hs_res_ty
-- See Note [GADT return kinds]
@@ -4217,11 +4221,16 @@ tcConDecl new_or_data dd_info rep_tycon tc_bndrs _res_kind tag_map
; return (ctxt, arg_tys, res_ty, field_lbls, stricts)
}
+ -- Must do this scopedSortOut /after/ solving the equalities (#28135)
+ ; tc_outer <- scopedSortOuter tc_outer
+ ; let outer_tvbs = tyVarSpecToBinders (outerTyVarBndrs tc_outer)
+ tvbs = outer_tvbs ++ inner_tvbs
+
; inf_tkvs <- kindGeneralizeAll skol_info
- (mkForAllTys tvbs $
- tcMkPhiTy ctxt $
- tcMkScaledFunTys arg_tys $
- res_ty)
+ (mkForAllTys tvbs $
+ tcMkPhiTy ctxt $
+ tcMkScaledFunTys arg_tys $
+ res_ty)
; traceTc "tcConDecl:GADT" (ppr names $$ ppr res_ty $$ ppr inf_tkvs)
; reportUnsolvedEqualities skol_info inf_tkvs tclvl wanted
=====================================
testsuite/tests/typecheck/should_compile/T28135.hs
=====================================
@@ -0,0 +1,10 @@
+{-# LANGUAGE GADTs, TypeFamilies #-}
+
+-- GHC 9.14.1 panics with "updateRole" when compiling this module.
+-- Compiles fine with GHC 9.12 (but by a fluke)
+module T28135 where
+
+data S t where
+ W :: C f => (forall (a :: k). S (t a)) -> S (t f)
+
+class C f
=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -975,3 +975,4 @@ test('T26543_orig', normal, compile, [''])
test('T27994', normal, compile, [''])
test('T27994a', normal, compile, [''])
test('T27994b', normal, compile, [''])
+test('T28135', normal, compile, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/64f821c6e8da5af8558e10016105bb4…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/64f821c6e8da5af8558e10016105bb4…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] Use Set operations over Foldable operations
by Marge Bot (@marge-bot) 22 Nov '26
by Marge Bot (@marge-bot) 22 Nov '26
22 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
c0764c69 by Hannes Siebenhandl at 2026-11-22T16:39:04-05:00
Use Set operations over Foldable operations
Use `O(log n)` operations over `O(n)` for all call-sites of `hsc_all_home_unit_ids`.
- - - - -
4 changed files:
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
Changes:
=====================================
compiler/GHC/Driver/Downsweep.hs
=====================================
@@ -415,7 +415,7 @@ downsweepInteractiveImports hsc_env ic = unsafeInterleaveIO $ do
downsweepInstalledModules :: HscEnv -> [Module] -> IO ModuleGraph
downsweepInstalledModules hsc_env mods = do
let
- (home_mods, external_mods) = partition (\u -> moduleUnitId u `elem` hsc_all_home_unit_ids hsc_env) mods
+ (home_mods, external_mods) = partition (\u -> moduleUnitId u `Set.member` hsc_all_home_unit_ids hsc_env) mods
installed_mods = map (fst . getModuleInstantiation) home_mods
external_uids = map moduleUnitId external_mods
=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -424,7 +424,7 @@ load how_much = loadWithCache noIfaceCache mkUnknownDiagnostic how_much
mkBatchMsg :: HscEnv -> Messager
mkBatchMsg hsc_env =
- if length (hsc_all_home_unit_ids hsc_env) > 1
+ if Set.size (hsc_all_home_unit_ids hsc_env) > 1
-- This also displays what unit each module is from.
then batchMultiMsg
else batchMsg
=====================================
compiler/GHC/Iface/Load.hs
=====================================
@@ -150,6 +150,7 @@ import Control.Monad
import qualified Data.Foldable as Foldable
import Data.Function ((&))
import Data.Map ( toList )
+import qualified Data.Set as Set
import System.FilePath
import System.Directory
@@ -843,7 +844,7 @@ loadInterface doc_str mod from
-- overlapping instances.
; massertPpr
((isOneShot (ghcMode (hsc_dflags hsc_env)))
- || moduleUnitId mod `notElem` hsc_all_home_unit_ids hsc_env
+ || moduleUnitId mod `Set.notMember` hsc_all_home_unit_ids hsc_env
|| mod == gHC_PRIM)
(text "Attempting to load home package interface into the EPS" $$ ppr (HUG.allUnits hug) $$ doc_str $$ ppr mod $$ ppr (moduleUnitId mod))
; ignore_prags <- goptM Opt_IgnoreInterfacePragmas
=====================================
compiler/GHC/Iface/Recomp.hs
=====================================
@@ -668,7 +668,7 @@ checkDependencies hsc_env summary iface
(Set.map ((SpliceLevel),) (dep_plugin_pkgs (mi_deps iface))))
classify st _ (Found _ mod)
- | (toUnitId $ moduleUnit mod) `elem` all_home_units = Right (Left ((st, toUnitId $ moduleUnit mod, moduleName mod)))
+ | toUnitId (moduleUnit mod) `Set.member` all_home_units = Right (Left ((st, toUnitId $ moduleUnit mod, moduleName mod)))
| otherwise = Right (Right (moduleNameFS (moduleName mod), (st, toUnitId $ moduleUnit mod)))
classify _ reason _ = Left (RecompBecause reason)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c0764c698bbf747b1c30055bd3b7ebb…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c0764c698bbf747b1c30055bd3b7ebb…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][master] Cmm: drop eliminated blocks from the graph in CBE
by Marge Bot (@marge-bot) 22 Nov '26
by Marge Bot (@marge-bot) 22 Nov '26
22 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
cd6c2a96 by Simon Jakobi at 2026-11-22T16:38:23-05:00
Cmm: drop eliminated blocks from the graph in CBE
Previously, common block elimination only made the eliminated blocks
unreachable. They stayed in the graph until stack layout discarded
them.
Removing these blocks right away reduces the potential for confusion
(e.g. #27368). It does not appear to make any significant difference
to compiler allocations.
Assisted-by: Claude Opus 5.5
- - - - -
1 changed file:
- compiler/GHC/Cmm/CommonBlockElim.hs
Changes:
=====================================
compiler/GHC/Cmm/CommonBlockElim.hs
=====================================
@@ -64,7 +64,7 @@ elimCommonBlocks :: CmmGraph -> CmmGraph
elimCommonBlocks g =
assert (g_entry g == g_entry g') g'
where
- g' = replaceLabels env $ copyTicks env g
+ g' = replaceLabels env $ dropEliminatedBlocks env $ copyTicks env g
env = iterate mapEmpty blocks_with_key
blocks_with_key = [ [ (successors b, [b]) | b <- bs] | bs <- groups]
groups = groupByInt hash_block candidates :: [[CmmBlock]]
@@ -322,6 +322,12 @@ copyTicks env g
in CmmEntry lbl (combineTickScopes scp0 scp1) `blockJoinHead`
foldr blockCons code (map CmmTick ticks)
+-- | Remove the blocks eliminated by the substitution from the graph.
+dropEliminatedBlocks :: Subst -> CmmGraph -> CmmGraph
+dropEliminatedBlocks env g
+ | mapNull env = g
+ | otherwise = ofBlockMap (g_entry g) (toBlockMap g `mapDifference` env)
+
-- Group by [Label]
-- See Note [Compressed TrieMap] in GHC.Core.Map.Expr about the usage of GenMap.
groupByLabel :: [(Key, DistinctBlocks)] -> [(Key, NonEmpty DistinctBlocks)]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cd6c2a96b30212d8e7b827ebb908796…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cd6c2a96b30212d8e7b827ebb908796…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
242f8daf by Alan Zimmerman at 2026-11-22T16:39:46-05:00
EPA: Use AnnList in DecBrl
Via updating the TTG extension point payload
- - - - -
4 changed files:
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Parser.y
- + distrib/configure.ac
- utils/check-exact/ExactPrint.hs
Changes:
=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -2327,7 +2327,7 @@ ppr_splice herald mn e
type instance XExpBr GhcPs = (BracketAnn (EpUniToken "[|" "⟦") (EpToken "[e|"), EpUniToken "|]" "⟧")
type instance XPatBr GhcPs = (EpToken "[p|", EpUniToken "|]" "⟧")
-type instance XDecBrL GhcPs = (EpToken "[d|", EpUniToken "|]" "⟧", (EpToken "{", EpToken "}"))
+type instance XDecBrL GhcPs = (EpToken "[d|", EpUniToken "|]" "⟧", AnnList)
type instance XDecBrG GhcPs = NoExtField
type instance XTypBr GhcPs = (EpToken "[t|", EpUniToken "|]" "⟧")
type instance XVarBr GhcPs = EpaLocation
=====================================
compiler/GHC/Parser.y
=====================================
@@ -3338,9 +3338,9 @@ acmd :: { LHsCmdTop GhcPs }
runPV (checkCmdBlockArguments cmd) >>= \ _ ->
return (sL1a cmd $ HsCmdTop noExtField cmd) }
-cvtopbody :: { ((EpToken "{", EpToken "}"),[LHsDecl GhcPs]) }
- : '{' cvtopdecls0 '}' { ((epTok $1 ,epTok $3),$2) }
- | vocurly cvtopdecls0 close { ((noEpTok, noEpTok),$2) }
+cvtopbody :: { (AnnList,[LHsDecl GhcPs]) }
+ : '{' cvtopdecls0 '}' { (AnnList AnnListBraces (ListBraces (epTok $1) (epTok $3)) [],$2) }
+ | vocurly cvtopdecls0 close { (AnnList (AnnListLayout (glR $1)) ListNone [],$2) }
cvtopdecls0 :: { [LHsDecl GhcPs] }
: topdecls_semi { cvTopDecls $1 }
=====================================
distrib/configure.ac
=====================================
@@ -0,0 +1,474 @@
+dnl
+dnl Binary distribution configure script
+dnl
+#!/bin/sh
+#
+
+AC_INIT([The Glorious Glasgow Haskell Compilation System], [10.1.20260925], [glasgow-haskell-bugs(a)haskell.org] [ghc-AC_PACKAGE_VERSION])
+
+dnl See /configure.ac for rationale.
+AC_PREREQ([2.69])
+
+AC_CONFIG_MACRO_DIRS([../m4])
+
+dnl--------------------------------------------------------------------
+dnl * Deal with arguments telling us gmp is somewhere odd
+dnl--------------------------------------------------------------------
+
+build_alias=x86_64-unknown-linux
+host_alias=x86_64-unknown-linux
+target_alias=x86_64-unknown-linux
+
+dnl this makes sure `./configure --target=<cross-compile-target>`
+dnl works as expected, since we're slightly modifying how Autoconf
+dnl interprets build/host/target and how this interacts with $CC tests
+test -n "$target_alias" && ac_tool_prefix=$target_alias-
+
+dnl Various things from the source distribution configure
+bootstrap_build=x86_64-unknown-linux
+bootstrap_host=x86_64-unknown-linux
+bootstrap_target=x86_64-unknown-linux
+
+bootstrap_llvm_target=x86_64-unknown-linux
+
+TargetHasLibm=YES
+
+UseLibffiForAdjustors=NO
+AC_SUBST(UseLibffiForAdjustors)
+
+GhcWithSMP=YES
+AC_SUBST(GhcWithSMP)
+
+# We have to run these unconditionally as FPTOOLS_SET_PLATFORMS_VARS wants the
+# values it computes.
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+FPTOOLS_SET_PLATFORMS_VARS
+
+# Requires FPTOOLS_SET_PLATFORMS_VARS to be run first.
+FP_FIND_ROOT
+
+CrossCompiling=NO
+# If 'host' and 'target' differ, then this means we are building a cross-compiler.
+if test "$target" != "$host" ; then
+ CrossCompiling=YES
+ cross_compiling=yes # This tells configure that it can accept just 'target',
+ # otherwise you get
+ # configure: error: cannot run C compiled programs.
+ # If you meant to cross compile, use `--host'.
+fi
+LeadingUnderscore="NO"
+CrossCompilePrefix=""
+TablesNextToCode="YES"
+
+AC_SUBST(LeadingUnderscore)
+AC_SUBST(CrossCompiling)
+AC_SUBST(CrossCompilePrefix)
+AC_SUBST(TablesNextToCode)
+
+Unregisterised="NO"
+AC_SUBST(Unregisterised)
+
+#
+dnl ** figure out how to do a BSD-ish install **
+#
+AC_PROG_INSTALL
+
+#
+dnl ** how to do symlinks **
+#
+AC_PROG_LN_S()
+
+#
+dnl ** Find the path to sed **
+#
+AC_PATH_PROG(SedCmd,gsed sed,sed)
+
+dnl ** check for Python for testsuite driver
+FIND_PYTHON
+FP_PROG_FIND
+if test -z "$FindCmd"
+then
+ AC_MSG_ERROR([find is required.])
+fi
+
+AC_ARG_ENABLE(distro-toolchain,
+[AS_HELP_STRING([--enable-distro-toolchain],
+ [Do not use bundled Windows toolchain binaries.])],
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableDistroToolchain])],
+ [EnableDistroToolchain=NO]
+)
+AC_SUBST([EnableDistroToolchain])
+
+if test "$HostOS" = "mingw32" -a "$EnableDistroToolchain" = "NO"; then
+ FP_SETUP_WINDOWS_TOOLCHAIN([$hardtop/mingw/], [\$\$topdir/../mingw/])
+fi
+
+
+if test "$HostOS" = "darwin"; then
+ # On darwin, we need to clean the extended attributes of the
+ # ghc-toolchain binary and its dynamic library before we can execute it in the bindist
+ # (this is a workaround for #24554, for the lack of proper notarisation #17418)
+
+ # The following is the work around suggested by @carter in #17418 during
+ # install time. This should help us with code signing issues by removing
+ # extended attributes from all files.
+ XATTR="${XATTR:-/usr/bin/xattr}"
+
+ if test -e "${XATTR}"; then
+
+ # Instead of cleaning the attributes of the ghc-toolchain binary only,
+ # we clean them from all files in the bin/ and lib/ directories, as it additionally future
+ # proofs running executables from the bindist besides ghc-toolchain at configure time, and
+ # we can avoid figuring out the path to the ghc-toolchain dynlib specifically.
+ "$XATTR" -rc bin/
+ "$XATTR" -rc lib/
+
+ fi
+fi
+
+AC_ARG_ENABLE(ghc-toolchain,
+[AS_HELP_STRING([--enable-ghc-toolchain],
+ [Whether to use the newer ghc-toolchain tool to configure ghc targets])],
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableGhcToolchain])],
+ [EnableGhcToolchain=NO]
+)
+AC_SUBST([EnableGhcToolchain])
+
+AC_ARG_ENABLE(strict-ghc-toolchain-check,
+[AS_HELP_STRING([--enable-strict-ghc-toolchain-check],
+ [Whether to raise an error if the output of ghc-toolchain differs from configure])],
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableStrictGhcToolchainCheck])],
+ [EnableStrictGhcToolchainCheck=NO]
+)
+AC_SUBST([EnableStrictGhcToolchainCheck])
+
+dnl ** Which gcc to use?
+dnl --------------------------------------------------------------
+AC_PROG_CC([cc gcc clang])
+AC_PROG_CXX([c++ g++ clang++])
+# Work around #24324
+MOVE_TO_FLAGS([CC],[CFLAGS])
+MOVE_TO_FLAGS([CXX],[CXXFLAGS])
+
+dnl ** figure out how to invoke the C preprocessor (i.e. `gcc -E`)
+AC_PROG_CPP
+
+# --with-hs-cpp/--with-hs-cpp-flags
+FP_HSCPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
+AC_SUBST([HaskellCPPCmd])
+AC_SUBST([HaskellCPPArgs])
+
+# --with-js-cpp/--with-js-cpp-flags
+FP_JSCPP_CMD_WITH_ARGS(JavaScriptCPPCmd, JavaScriptCPPArgs)
+AC_SUBST([JavaScriptCPPCmd])
+AC_SUBST([JavaScriptCPPArgs])
+
+# --with-cmm-cpp/--with-cmm-cpp-flags
+FP_CMM_CPP_CMD_WITH_ARGS([$CC], [CmmCPPCmd], [CmmCPPArgs], [CmmCPPSupportsG0])
+AC_SUBST([CmmCPPCmd])
+AC_SUBST([CmmCPPArgs])
+AC_SUBST([CmmCPPSupportsG0])
+
+dnl ** Which ld to use?
+dnl --------------------------------------------------------------
+FIND_LD([$target],[GccUseLdOpt])
+FIND_MERGE_OBJECTS()
+CONF_GCC_LINKER_OPTS_STAGE1="$CONF_GCC_LINKER_OPTS_STAGE1 $GccUseLdOpt"
+CONF_GCC_LINKER_OPTS_STAGE2="$CONF_GCC_LINKER_OPTS_STAGE2 $GccUseLdOpt"
+CFLAGS="$CFLAGS $GccUseLdOpt"
+
+FP_PROG_LD_IS_GNU
+FP_PROG_LD_NO_COMPACT_UNWIND
+FP_PROG_LD_FILELIST
+FP_PROG_LD_SINGLE_MODULE
+
+dnl ** which strip to use?
+dnl --------------------------------------------------------------
+AC_CHECK_TARGET_TOOL([STRIP], [strip])
+StripCmd="$STRIP"
+AC_SUBST([StripCmd])
+
+# Here is where we re-target which specific version of the LLVM
+# tools we are looking for. In the past, GHC supported a number of
+# versions of LLVM simultaneously, but that stopped working around
+# 3.5/3.6 release of LLVM.
+LlvmMinVersion=13
+LlvmMaxVersion=24
+
+dnl ** Which LLVM llc to use?
+dnl --------------------------------------------------------------
+AC_ARG_VAR(LLC,[Use as the path to LLVM's llc [default=autodetect]])
+FIND_LLVM_PROG([LLC], [llc], [$LlvmMinVersion], [$LlvmMaxVersion])
+LlcCmd="$LLC"
+AC_SUBST([LlcCmd])
+
+dnl ** Which LLVM opt to use?
+dnl --------------------------------------------------------------
+AC_ARG_VAR(OPT,[Use as the path to LLVM's opt [default=autodetect]])
+FIND_LLVM_PROG([OPT], [opt], [$LlvmMinVersion], [$LlvmMaxVersion])
+OptCmd="$OPT"
+AC_SUBST([OptCmd])
+
+dnl ** look to see if we have a C compiler using an llvm back end.
+dnl
+FP_CC_LLVM_BACKEND
+AC_SUBST(CcLlvmBackend)
+
+dnl ** Which LLVM assembler to use?
+dnl --------------------------------------------------------------
+AC_ARG_VAR(LLVMAS,[Use as the path to LLVM's assembler (typically clang) [default=autodetect]])
+if test "x$CcLlvmBackend" = "xYES" && test -z "$LLVMAS"; then
+ LLVMAS="$CC"
+fi
+FIND_LLVM_PROG([LLVMAS], [clang], [$LlvmMinVersion], [$LlvmMaxVersion])
+LlvmAsCmd="$LLVMAS"
+AC_SUBST([LlvmAsCmd])
+
+dnl ** Which LLVM llvm-dlltool to use?
+dnl --------------------------------------------------------------
+AC_CHECK_TARGET_TOOL([DlltoolCmd],[llvm-dlltool])
+AC_ARG_VAR(DlltoolCmd,[Use as the path to LLVM's llvm-dlltool [default=autodetect]])
+FIND_LLVM_PROG([DlltoolCmd], [llvm-dlltool], [$LlvmMinVersion], [$LlvmMaxVersion])
+AC_SUBST([DlltoolCmd])
+
+dnl We know that `clang` supports `--target` and it is necessary to pass it
+dnl lest we see #25793.
+if test -z "$LlvmAsFlags" && ! test -z "$LlvmTarget"; then
+ LlvmAsFlags="--target=$LlvmTarget"
+fi
+AC_SUBST([LlvmAsFlags])
+
+dnl ** Check gcc version and flags we need to pass it **
+FP_GCC_VERSION
+FP_GCC_SUPPORTS_NO_PIE
+FP_GCC_SUPPORTS_VIA_C_FLAGS
+
+FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
+FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
+# Stage 3 won't be supported by cross-compilation
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
+
+#-no_fixup_chains
+FP_LD_NO_FIXUP_CHAINS([target], [LDFLAGS])
+FP_LD_NO_FIXUP_CHAINS([build], [CONF_GCC_LINKER_OPTS_STAGE0])
+FP_LD_NO_FIXUP_CHAINS([target], [CONF_GCC_LINKER_OPTS_STAGE1])
+FP_LD_NO_FIXUP_CHAINS([target], [CONF_GCC_LINKER_OPTS_STAGE2])
+
+#-no_warn_duplicate_libraries
+FP_LD_NO_WARN_DUPLICATE_LIBRARIES([build], [CONF_GCC_LINKER_OPTS_STAGE0])
+FP_LD_NO_WARN_DUPLICATE_LIBRARIES([target], [CONF_GCC_LINKER_OPTS_STAGE1])
+FP_LD_NO_WARN_DUPLICATE_LIBRARIES([target], [CONF_GCC_LINKER_OPTS_STAGE2])
+
+FP_MERGE_OBJECTS_SUPPORTS_RESPONSE_FILES
+
+AC_SUBST(CONF_CC_OPTS_STAGE0)
+AC_SUBST(CONF_CC_OPTS_STAGE1)
+AC_SUBST(CONF_CC_OPTS_STAGE2)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
+AC_SUBST(CONF_CPP_OPTS_STAGE0)
+AC_SUBST(CONF_CPP_OPTS_STAGE1)
+AC_SUBST(CONF_CPP_OPTS_STAGE2)
+
+dnl Identify C++ standard library flavour and location
+FP_FIND_CXX_STD_LIB
+AC_CONFIG_FILES([mk/system-cxx-std-lib-1.0.conf])
+
+dnl ** Which otool to use on macOS
+dnl --------------------------------------------------------------
+AC_CHECK_TARGET_TOOL([OTOOL], [otool])
+OtoolCmd="$OTOOL"
+AC_SUBST(OtoolCmd)
+
+dnl ** Which install_name_tool to use on macOS
+dnl --------------------------------------------------------------
+AC_CHECK_TARGET_TOOL([INSTALL_NAME_TOOL], [install_name_tool])
+InstallNameToolCmd="$INSTALL_NAME_TOOL"
+AC_SUBST(InstallNameToolCmd)
+
+# Check that we have the same emsdk version as the one we were built with.
+ConfiguredEmsdkVersion=
+EMSDK_VERSION("", "", ${ConfiguredEmsdkVersion})
+
+dnl ** Set up the variables for the platform in the settings file.
+dnl May need to use gcc to find platform details.
+dnl --------------------------------------------------------------
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Build])
+
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host])
+AC_SUBST(HaskellHostArch)
+AC_SUBST(HaskellHostOs)
+
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Target])
+AC_SUBST(HaskellTargetArch)
+AC_SUBST(HaskellTargetOs)
+
+GHC_SUBSECTIONS_VIA_SYMBOLS
+AC_SUBST(TargetHasSubsectionsViaSymbols)
+
+GHC_IDENT_DIRECTIVE
+AC_SUBST(TargetHasIdentDirective)
+
+GHC_GNU_NONEXEC_STACK
+AC_SUBST(TargetHasGnuNonexecStack)
+
+GHC_LLVM_TARGET_SET_VAR
+AC_SUBST(LlvmTarget)
+
+dnl ** See whether cc supports --target=<triple> and set
+dnl CONF_CC_OPTS_STAGE[12] accordingly.
+FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_CXX_OPTS_STAGE1])
+FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_CXX_OPTS_STAGE2])
+
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_GCC_LINKER_OPTS_STAGE1])
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_GCC_LINKER_OPTS_STAGE2])
+
+dnl Pass -Qunused-arguments or otherwise GHC will have very noisy invocations of Clang
+FP_CC_IGNORE_UNUSED_ARGS([$CC], [CONF_CC_OPTS_STAGE1])
+FP_CC_IGNORE_UNUSED_ARGS([$CC], [CONF_CC_OPTS_STAGE2])
+
+# CPP, CPPFLAGS
+# --with-cpp/-with-cpp-flags
+dnl Note that we must do this after setting and using the C11 CPPFLAGS, or
+dnl otherwise risk trying to configure the C11 and LD flags using -E as a CPPFLAG
+FP_CPP_CMD_WITH_ARGS([$CC_STAGE0],[CPPCmd_STAGE0],[CONF_CPP_OPTS_STAGE0])
+FP_CPP_CMD_WITH_ARGS([$CC],[CPPCmd],[CONF_CPP_OPTS_STAGE1])
+FP_CPP_CMD_WITH_ARGS([$CC],[CPPCmd],[CONF_CPP_OPTS_STAGE2])
+AC_SUBST([CPPCmd_STAGE0])
+AC_SUBST([CPPCmd])
+
+dnl TargetWordSize for settings file
+AC_CHECK_SIZEOF(void *, 4)
+if test "x$ac_cv_sizeof_void_p" = "x0"; then
+ AC_MSG_ERROR([Failed to determine machine word size. Does your toolchain actually work?])
+fi
+dnl Check that the toolchain we have is consistent with what the compiler expects
+if test "x$ac_cv_sizeof_void_p" != "x8"; then
+ AC_MSG_ERROR([This binary distribution produces binaries for a target with
+ word size of 8, but your target toolchain produces binaries
+ with a word size of $ac_cv_sizeof_void_p. Are you sure your toolchain
+ targets the intended target platform of this compiler?])
+fi
+TargetWordSize=$ac_cv_sizeof_void_p
+AC_SUBST(TargetWordSize)
+
+dnl TargetWordBigEndian for settings file
+AC_C_BIGENDIAN([TargetWordBigEndian=YES],[TargetWordBigEndian=NO])
+dnl Check that the toolchain we have is consistent with what the compiler expects
+if test "x$TargetWordBigEndian" != "xNO"; then
+ AC_MSG_ERROR([This binary distribution produces binaries for a target with
+ a different byte order than your target toolchain.
+ Are you sure your toolchain targets the intended target platform
+ of this compiler?])
+fi
+AC_SUBST(TargetWordBigEndian)
+
+#
+dnl ** how to invoke `ar' and `ranlib'
+#
+FP_PROG_AR_SUPPORTS_ATFILE
+FP_PROG_AR_SUPPORTS_DASH_L
+FP_PROG_AR_NEEDS_RANLIB
+RanlibCmd="$RANLIB"
+AC_SUBST([RanlibCmd])
+
+LINKER_SUPPORTS_VERBATIM_LINKING
+
+dnl ** Have libdw?
+dnl --------------------------------------------------------------
+dnl Check for a usable version of libdw/elfutils
+dnl Currently we need 0.158 or newer.
+UseLibdw=NO
+if test "x$UseLibdw" = "xYES" ; then
+ AC_CHECK_LIB(dw, dwfl_attach_state,
+ [UseLibdw=YES],
+ [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])]
+ )
+fi
+AC_SUBST(UseLibdw)
+
+dnl What is the version of the base library which we are going to use?
+dnl The user can use BASE_UNIT_ID at install time to point the compiler to
+dnl link against a different base package by default.
+dnl If the package is unavailable it will simply not be linked against.
+BaseUnitId=base-4.23.0.0-inplace
+if test -n "$BASE_UNIT_ID"; then
+ BaseUnitId="$BASE_UNIT_ID"
+fi
+
+AC_SUBST(BaseUnitId)
+
+# We get caught by
+# http://savannah.gnu.org/bugs/index.php?1516
+# $(eval ...) inside conditionals causes errors
+# with make 3.80, so warn the user if it looks like they're about to
+# try to use it.
+# We would use "grep -q" here, but Solaris's grep doesn't support it.
+checkMake380() {
+ if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
+ then
+ echo
+ echo "WARNING: It looks like \"$1\" is GNU make 3.80."
+ echo "This version cannot be used to build GHC."
+ echo "Please use GNU make >= 3.81."
+ fi
+}
+
+checkMake380 make
+checkMake380 gmake
+
+# Toolchain target files
+FIND_GHC_TOOLCHAIN_BIN([YES])
+PREP_TARGET_FILE
+FIND_GHC_TOOLCHAIN([.])
+
+AC_CONFIG_FILES([config.mk])
+AC_CONFIG_FILES([default.host.target])
+AC_CONFIG_FILES([default.target])
+AC_CONFIG_FILES([mk/hsc2hs])
+AC_OUTPUT
+
+VALIDATE_GHC_TOOLCHAIN([default.target],[default.target.ghc-toolchain])
+
+if test "$EnableDistroToolchain" = "YES"; then
+ # If the user specified --enable-distro-toolchain then we just use the
+ # executable names, not paths. We do this by finding strings of paths to
+ # programs and keeping the basename only:
+ cp default.target default.target.bak
+
+ while IFS= read -r line; do
+ if echo "$line" | grep -q 'prgPath = "'; then
+ path=$(echo "$line" | sed -E 's/.*prgPath = "([[^"]]+)".*/\1/')
+ base=$(basename "$path")
+ echo "$line" | sed "s|$path|$base|"
+ else
+ echo "$line"
+ fi
+ done < default.target.bak > default.target
+ echo "Applied --enable-distro-toolchain basename substitution to default.target:"
+ cat default.target
+fi
+
+if test "$windows" = YES -a "$EnableDistroToolchain" = "NO"; then
+ # Handle the Windows toolchain installed in FP_SETUP_WINDOWS_TOOLCHAIN.
+ # We need to issue a substitution to use $tooldir,
+ # See Note [tooldir: How GHC finds mingw on Windows]
+ SUBST_TOOLDIR([default.target])
+ echo "Applied tooldir substitution to default.target:"
+ cat default.target
+fi
+
+rm -Rf acargs acghc-toolchain actmp-ghc-toolchain
+
+echo "****************************************************"
+echo "Configuration done, ready to 'make install'"
+echo "(see README and INSTALL files for more info.)"
+echo "****************************************************"
=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -3171,13 +3171,11 @@ instance ExactPrint (HsExpr GhcPs) where
c' <- markEpUniToken c
return (HsUntypedBracket a (PatBr (o',c') e'))
- exact (HsUntypedBracket a (DecBrL (o,c, (oc,cc)) e)) = do
+ exact (HsUntypedBracket a (DecBrL (o,c, al) e)) = do
o' <- markEpToken o
- oc' <- markEpToken oc
- e' <- mapM markAnnotated e
- cc' <- markEpToken cc
+ (al',e') <- markAnnListA al $ setLayoutBoth $ mapM markAnnotated e
c' <- markEpUniToken c
- return (HsUntypedBracket a (DecBrL (o',c',(oc',cc')) e'))
+ return (HsUntypedBracket a (DecBrL (o',c',al') e'))
exact (HsUntypedBracket a (TypBr (o,c) e)) = do
o' <- markEpToken o
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/242f8daf024b89c02ecfd3e507072fb…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/242f8daf024b89c02ecfd3e507072fb…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
22 Nov '26
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
06e71ddf by Simon Peyton Jones at 2026-11-22T16:37:40-05:00
Better desugaring for bang patterns
Ticket #27862 showed that we were desugaring bang patterns in a
silly way, which led to bad code. This small fix makes it much
better.
I ended up refactoring `decomposeFirstPat` to be of type
(LPat -> LPat) instead of (Pat -> Pat)
which made it much easier to keep the locations correct.
On the way I also fixed #28137, a missing warning.
See Note [Tidying patterns] which has new (TP1) and (TP2)
and Note [Grouping equations] especially (GE1)
- - - - -
23 changed files:
- + changelog.d/T27137
- + changelog.d/T27862
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- testsuite/tests/ado/T22483.stderr
- + testsuite/tests/deSugar/should_compile/T27862.hs
- + testsuite/tests/deSugar/should_compile/T27862.stderr
- + testsuite/tests/deSugar/should_compile/T27862a.hs
- + testsuite/tests/deSugar/should_compile/T27862a.stderr
- + testsuite/tests/deSugar/should_compile/T27862b.hs
- + testsuite/tests/deSugar/should_compile/T27862b.stderr
- + testsuite/tests/deSugar/should_compile/T27862c.hs
- + testsuite/tests/deSugar/should_compile/T27862c.stderr
- + testsuite/tests/deSugar/should_compile/T27862d.hs
- + testsuite/tests/deSugar/should_compile/T27862d.stderr
- + testsuite/tests/deSugar/should_compile/T28137.hs
- + testsuite/tests/deSugar/should_compile/T28137.stderr
- testsuite/tests/deSugar/should_compile/all.T
- testsuite/tests/deSugar/should_run/dsrun008.stderr
- testsuite/tests/pmcheck/should_compile/T24234.stderr
- testsuite/tests/typecheck/should_fail/tcfail203a.stderr
Changes:
=====================================
changelog.d/T27137
=====================================
@@ -0,0 +1,10 @@
+section: compiler
+issues: #28137
+mrs: !16899
+synopsis:
+ Refactor desugaring for pattern matching
+description:
+ Fix a missing warning for an overflowed literal in
+ pattern matching, when using ``-XStrict``. We get the extra
+ warning, and a minor change in column numbers for lazy-pattern
+ warnings.
=====================================
changelog.d/T27862
=====================================
@@ -0,0 +1,7 @@
+section: compiler
+issues: #27862
+mrs: !16899
+synopsis:
+ Improve desugaring for pattern matching involving bang-patterns
+description:
+ GHC was generating poor code for pattern matching that used bang-patterns
=====================================
compiler/GHC/HsToCore/Match.hs
=====================================
@@ -23,7 +23,7 @@ where
import GHC.Prelude
import GHC.Platform
-import {-#SOURCE#-} GHC.HsToCore.Expr (dsExpr)
+import {-#SOURCE#-} GHC.HsToCore.Expr (dsLExpr)
import GHC.Types.Basic
@@ -32,6 +32,9 @@ import GHC.Hs
import GHC.Hs.Syn.Type
import GHC.Tc.Types.Evidence
import GHC.Tc.Utils.Monad
+
+import GHC.Rename.Utils (wrapGenSpan)
+
import GHC.HsToCore.Pmc
import GHC.HsToCore.Pmc.Utils
import GHC.HsToCore.Types ( LdiNablas )
@@ -164,6 +167,64 @@ applying ``the mixture rule'' (SLPJ, p.~88) [which really {\em
un}mixes the equations], producing a list of equation-info
blocks, each block having as its first column patterns compatible with each other.
+
+Note [Grouping equations]
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Given a bunch of equations, `groupEquations` makes groups of consecutive equations,
+in which the first patern of each member of a group shares the same `PatGroup`
+category.
+ groupEquations :: [EquationInfoNE] -> [NonEmpty (PatGroup, EquationInfoNE)]
+Generally, in each NonEmpty (PatGroup, EquationInfoNE) element of the result list,
+all the PatGroup's will be the same (e.g. all PgCon or all PgAny). But see (GE1)
+for an exception.
+
+We will match each group in turn, with failure falling through into the
+next group. For example
+ f x 0 = ... -- (E1)
+ f !y 1 = ... -- (E2)
+ f y 2 = ... -- (E3)
+ f (Just True) _ = ... -- (E4)
+ f Nothing _ = ... -- (E5)
+ f x 4 = ... -- (E6)
+ f _ 5 = ... -- (E7)
+
+The initial groups are
+ [E1]
+ [E2,E3, .. E7]
+because the bang dominates all the the equations that follow; see (GE1) below. Once we
+get inside the bang we'll again do a `groupEquations` and get groups
+ [E2,E3] -- PgAny
+ [E4,E5] -- PgCon
+ [E6,E7] -- PgAny
+
+Wrinkles
+
+(GE1) A bang pattern captures all the equations that follow. For example, given
+ g !x (p,True) = ...(E1)...
+ g x (p,False) = ...(E2)...
+ g True v = ...(E3)...
+ we want to get the (p,True) and (p,False) patterns in a single group so we can share
+ the matching on the pair, and we can't do that if we put (E1) and (E2) in different
+ groups. See #27862. So we build a single group /from the bang-pattern downwards/:
+
+ Group 1: !x (p,True) -> ..E1..
+ x (p,False) -> ..E2..
+ True v -> ..E3..
+
+ A consequence is that in a group with a `PgBang` category, such as Group 1 above,
+ the second and subsequent equations may not be headed with a bang-pattern; indeed
+ their PatGroup classifiers may differ from each other. Hence in `matchBangs`, the
+ function `getBangPat` is not surprised to see a non-bang pattern. When we do
+ `getBangPat` on each equation and divide into groups again we get
+
+ Group 1: x (p,True) -> ..E1..
+ x (p,False) -> ..E2..
+
+ Group 2: True v -> ..E3..
+
+ Now things proceeds as if there had been no bang.
+
+(GE2) Overloaded literals: see Note [Grouping overloaded literal patterns]
-}
match :: [MatchId] -- ^ Variables rep\'ing the exprs we\'re matching with
@@ -176,17 +237,25 @@ match [] ty eqns = maybe (assertPprPanic (ppr ty)) combineEqnRhss $ nonEmpty eqn
match (v:vs) ty eqns -- Eqns can be empty, but each equation is nonempty
= assertPpr (all (isInternalName . idName . matchId) vars) (ppr vars) $
do { dflags <- getDynFlags
+
+ -- Tidy the first pattern, to remove unnecessary diversity,
+ -- generating auxiliary bindings if necessary
+ -- See Note [Tidying patterns]
; let platform = targetPlatform dflags
- -- Tidy the first pattern, generating
- -- auxiliary bindings if necessary
; (aux_binds, tidy_eqns) <- mapAndUnzipM (tidyEqnInfo v) eqns
- -- Group the equations and match each group in turn
- ; let grouped = groupEquations platform tidy_eqns
- -- print the view patterns that are commoned up to help debug
- ; whenDOptM Opt_D_dump_view_pattern_commoning (debug grouped)
+ -- Group the equations and match each group in turn
+ -- See Note [Grouping equations]
+ ; let grouped :: [NonEmpty (PatGroup, EquationInfoNE)]
+ grouped = groupEquations platform tidy_eqns
+
+ -- Print the view patterns that are commoned up to help debug
+ ; whenDOptM Opt_D_dump_view_pattern_commoning (debugViewPats grouped)
+ -- Match each group separately
; match_results <- match_groups grouped
+
+ -- And combine the results
; return $ foldr (.) id aux_binds <$>
foldr1 combineMatchResults match_results
}
@@ -197,10 +266,11 @@ match (v:vs) ty eqns -- Eqns can be empty, but each equation is nonempty
dropGroup = fmap snd
match_groups :: [NonEmpty (PatGroup,EquationInfoNE)] -> DsM (NonEmpty (MatchResult CoreExpr))
- match_groups [] = matchEmpty v ty
+ match_groups [] = matchEmpty v ty
match_groups (g:gs) = mapM match_group $ g :| gs
match_group :: NonEmpty (PatGroup,EquationInfoNE) -> DsM (MatchResult CoreExpr)
+ -- See Note [Grouping equations]
match_group eqns@((group,_) :| _)
= case group of
PgCon {} -> matchConFamily vars ty (ne $ subGroupUniq [(c,e) | (PgCon c, e) <- eqns'])
@@ -218,19 +288,23 @@ match (v:vs) ty eqns -- Eqns can be empty, but each equation is nonempty
Just nel -> nel
Nothing -> pprPanic "match match_group" $ text "Empty result should be impossible since input was non-empty"
- -- FIXME: we should also warn about view patterns that should be
- -- commoned up but are not
- -- print some stuff to see what's getting grouped
- -- use -dppr-debug to see the resolution of overloaded literals
- debug eqns =
- let gs = map (\group -> foldr (\ (p,_) -> \acc ->
- case p of PgView e _ -> e:acc
- _ -> acc) [] group) eqns
- maybeWarn [] = return ()
- maybeWarn l = diagnosticDs (DsAggregatedViewExpressions l)
- in
- maybeWarn $ filter (not . null) gs
+debugViewPats :: [NonEmpty (PatGroup, EquationInfoNE)] -> DsM ()
+-- print some stuff to see what's getting grouped
+-- use -dppr-debug to see the resolution of overloaded literals
+--
+-- FIXME: we should also warn about view patterns that should be
+-- commoned up but are not
+debugViewPats eqns
+ | null gs = return ()
+ | otherwise = diagnosticDs (DsAggregatedViewExpressions gs)
+ where
+ gs :: [[LHsExpr GhcTc]]
+ gs = mapMaybe gather_views eqns
+
+ gather_views :: NonEmpty (PatGroup, EquationInfoNE) -> Maybe [LHsExpr GhcTc]
+ gather_views ((PgView e _, _) :| vs) = Just (e : [ e' | (PgView e' _, _) <- vs ])
+ gather_views _ = Nothing
matchEmpty :: MatchId -> Type -> DsM (NonEmpty (MatchResult CoreExpr))
-- See Note [Empty case alternatives]
@@ -246,9 +320,10 @@ matchVariables :: NonEmpty MatchId -> Type -> NonEmpty EquationInfoNE -> DsM (Ma
matchVariables (_ :| vars) ty eqns = match vars ty $ NE.toList $ shiftEqns eqns
matchBangs :: NonEmpty MatchId -> Type -> NonEmpty EquationInfoNE -> DsM (MatchResult CoreExpr)
+-- See (GE1) in Note [Grouping equations]
matchBangs (var :| vars) ty eqns
= do { match_result <- match (var:vars) ty $ NE.toList $
- decomposeFirstPat getBangPat <$> eqns
+ decomposeFirstPat getBangPat <$> eqns
; return (mkEvalMatchResult (matchId var) ty match_result) }
matchCoercion :: NonEmpty MatchId -> Type -> NonEmpty EquationInfoNE -> DsM (MatchResult CoreExpr)
@@ -275,37 +350,44 @@ matchView (var :| vars) ty eqns@(eqn1 :| _)
-- to figure out the type of the fresh variable
let TcViewPat viewExpr pat = firstPat eqn1
-- do the rest of the compilation
- ; let pat_ty' = hsPatType pat
+ ; let pat_ty' = hsLPatType pat
; var' <- newUniqueId (matchId var) (matchIdMult var) pat_ty'
; match_result <- match (mkMatchId var' : vars) ty $ NE.toList $
decomposeFirstPat getViewPat <$> eqns
-- compile the view expressions
- ; viewExpr' <- dsExpr viewExpr
+ ; viewExpr' <- dsLExpr viewExpr
; return (mkViewMatchResult var'
(mkCoreApp viewExpr' (matchIdExpr var))
match_result) }
-- decompose the first pattern and leave the rest alone
-decomposeFirstPat :: (Pat GhcTc -> Pat GhcTc) -> EquationInfoNE -> EquationInfoNE
-decomposeFirstPat extract eqn@(EqnMatch { eqn_pat = pat }) = eqn{eqn_pat = fmap extract pat}
+decomposeFirstPat :: (LPat GhcTc -> LPat GhcTc) -> EquationInfoNE -> EquationInfoNE
+decomposeFirstPat extract eqn@(EqnMatch { eqn_pat = pat }) = eqn { eqn_pat = extract pat }
decomposeFirstPat _ (EqnDone {}) = panic "decomposeFirstPat"
-getCoPat, getBangPat, getViewPat :: Pat GhcTc -> Pat GhcTc
-getCoPat (XPat (CoPat _ pat _)) = pat
-getCoPat _ = panic "getCoPat"
-getBangPat (BangPat _ pat ) = unLoc pat
-getBangPat _ = panic "getBangPat"
-getViewPat (TcViewPat _ pat) = pat
-getViewPat _ = panic "getViewPat"
+getCoPat :: LPat GhcTc -> LPat GhcTc
+getCoPat (L loc (XPat (CoPat _ pat _))) = L loc pat
+getCoPat _ = panic "getCoPat"
+
+getViewPat :: LPat GhcTc -> LPat GhcTc
+getViewPat (L _ (TcViewPat _ pat)) = pat
+getViewPat _ = panic "getViewPat"
+
+getBangPat :: LPat GhcTc -> LPat GhcTc
+-- See (GE1) in Note [Grouping equations] for why it's expected
+-- that `getBangPat` may be passed a non-bang pattern.
+getBangPat (L _ (BangPat _ pat)) = pat
+getBangPat pat = pat
+
-- | Use this pattern synonym to match on a 'ViewPat'.
--
-- N.B.: View patterns can occur inside HsExpansions.
-pattern TcViewPat :: HsExpr GhcTc -> Pat GhcTc -> Pat GhcTc
+pattern TcViewPat :: LHsExpr GhcTc -> LPat GhcTc -> Pat GhcTc
pattern TcViewPat viewExpr pat <- (getTcViewPat -> (viewExpr, pat))
-getTcViewPat :: Pat GhcTc -> (HsExpr GhcTc, Pat GhcTc)
-getTcViewPat (ViewPat _ viewLExpr pat) = (unLoc viewLExpr, unLoc pat)
+getTcViewPat :: Pat GhcTc -> (LHsExpr GhcTc, LPat GhcTc)
+getTcViewPat (ViewPat _ viewLExpr pat) = (viewLExpr, pat)
getTcViewPat (XPat (ExpansionPat _ p)) = getTcViewPat p
getTcViewPat p = pprPanic "getTcViewPat" (ppr p)
@@ -334,41 +416,48 @@ See also the "lifted case" discussion in Note [Case elimination] in GHC.Core.Opt
* *
************************************************************************
-Tidy up the leftmost pattern in an @EquationInfo@, given the variable @v@
-which will be scrutinised.
-
-This makes desugaring the pattern match simpler by transforming some of
-the patterns to simpler forms. (Tuples to Constructor Patterns)
+Note [Tidying patterns]
+~~~~~~~~~~~~~~~~~~~~~~~
+`tidyEqninfo` tidies up the leftmost pattern in an `EquationInfo`, given the
+variable `v` which will be scrutinised. This makes desugaring the pattern match
+simpler by transforming some of the patterns to simpler forms. (Tuples to
+Constructor Patterns)
Among other things in the resulting Pattern:
* Variables and irrefutable(lazy) patterns are replaced by Wildcards
* As patterns are replaced by the patterns they wrap.
The bindings created by the above patterns are put into the returned wrapper
-instead.
-
-This means a definition of the form:
+instead. This means a definition of the form:
f x = rhs
when called with v get's desugared to the equivalent of:
let x = v
in
f _ = rhs
-The same principle holds for as patterns (@) and
-irrefutable/lazy patterns (~).
-In the case of irrefutable patterns the irrefutable pattern is pushed into
-the binding.
+The same principle holds for as patterns (@) and irrefutable/lazy patterns (~). In
+the case of irrefutable patterns the irrefutable pattern is pushed into the binding.
-Pattern Constructors which only represent syntactic sugar are converted into
-their desugared representation.
-This usually means converting them to Constructor patterns but for some
-depends on enabled extensions. (Eg OverloadedLists)
+Pattern Constructors which only represent syntactic sugar are converted into their
+desugared representation. This usually means converting them to Constructor
+patterns but for some depends on enabled extensions. (Eg OverloadedLists)
GHC also tries to convert overloaded Literals into regular ones.
The result of this tidying is that the column of patterns will include
only these which can be assigned a PatternGroup (see patGroup).
+(TP1) We may call `tidyPat` on the same pattern more than once, principally because
+ of the treatment of bang-patterns; see (GE1) in Note [Grouping equations].
+ So (slightly hackily) we wrap tidied patterns in GeneratedSrcSpan to signal this.
+ See `wrapGenSpan` calls in `tidyLPat`.
+
+(TP2) Tidying is a convenient place to warn about overflowed literal values. We
+ can't do it in the typechecker because the types are not settled. See the
+ `tidyPat1` equations for `LitPat`, `NPat`, `NPlusKPat`. But we only want to
+ want /once/; hence, for these cases:
+ (a) the `unlessInGenCode` check, in turn relying on (TP1).
+ (b) wrap the result with `wrapGenSpan`
-}
tidyEqnInfo :: MatchId -> EquationInfo
@@ -383,44 +472,40 @@ tidyEqnInfo :: MatchId -> EquationInfo
tidyEqnInfo _ eqn@(EqnDone {}) = return (idDsWrapper, eqn)
-tidyEqnInfo v eqn@(EqnMatch { eqn_pat = p@(L loc _) }) = do
- (wrap, pat') <- tidyLPat v p
- return (wrap, eqn{eqn_pat = L loc pat' })
-
-tidyLPat :: MatchId -> LPat GhcTc -> DsM (DsWrapper, Pat GhcTc)
-tidyLPat v (L loc pat) = putSrcSpanDsA loc (tidy1 v pat)
+tidyEqnInfo v eqn@(EqnMatch { eqn_pat = pat })
+ = do { (wrap, pat') <- tidyLPat v pat
+ ; return (wrap, eqn{ eqn_pat = pat' }) }
-tidy1 :: MatchId -- The scrutinee
- -> Pat GhcTc -- The pattern against which it is to be matched
- -> DsM (DsWrapper, -- Extra bindings to do before the match
- Pat GhcTc) -- Equivalent pattern
+tidyLPat :: MatchId -- The scrutinee
+ -> LPat GhcTc -- The pattern against which it is to be matched
+ -> DsM (DsWrapper, -- Extra bindings to do before the match
+ LPat GhcTc) -- Equivalent pattern
-------------------------------------------------------
--- (pat', mr') = tidy1 v pat mr
+-- (pat', mr') = tidyLPat v pat mr
-- tidies the *outer level only* of pat, giving pat'
-- It eliminates many pattern forms (as-patterns, variable patterns,
-- list patterns, etc) and returns any created bindings in the wrapper.
-tidy1 v (ParPat _ pat) = tidyLPat v pat
-tidy1 v (SigPat _ pat _) = tidyLPat v pat
-tidy1 _ (WildPat ty) = return (idDsWrapper, WildPat ty)
-tidy1 v (BangPat _ (L l p)) = putSrcSpanDsA l $ tidy_bang_pat v l p
-tidy1 v (ModifiedPat _ _ pat) = tidyLPat v pat
+tidyLPat v (L _ (ParPat _ pat)) = tidyLPat v pat -- Drop parens
+tidyLPat v (L _ (SigPat _ pat _)) = tidyLPat v pat -- Drop signatures
+tidyLPat v (L _ (ModifiedPat _ _ pat)) = tidyLPat v pat -- Drop modifiers
+
+tidyLPat v (L _ (BangPat _ p)) = tidy_bang_pat v p
-- case v of { x -> mr[] }
-- = case v of { _ -> let x=v in mr[] }
-tidy1 v (VarPat _ (L _ var))
- = return (bindMatchId var v, WildPat (idType var))
+tidyLPat v (L loc (VarPat _ (L _ var)))
+ = return (bindMatchId var v, L loc (WildPat (idType var)))
-- case v of { x@p -> mr[] }
-- = case v of { p -> let x=v in mr[] }
-tidy1 v (AsPat _ (L _ var) pat)
-
+tidyLPat v (L _ (AsPat _ (L _ var) pat))
= do { (wrap, pat') <- tidyLPat v pat
; return (bindMatchId var v . wrap, pat') }
{- now, here we handle lazy patterns:
- tidy1 v ~p bs = (v, v1 = case v of p -> v1 :
+ tidyLPat v ~p bs = (v, v1 = case v of p -> v1 :
v2 = case v of p -> v2 : ... : bs )
where the v_i's are the binders in the pattern.
@@ -430,29 +515,35 @@ tidy1 v (AsPat _ (L _ var) pat)
The case expr for v_i is just: match [v] [(p, [], \ x -> Var v_i)] any_expr
-}
-tidy1 v (LazyPat _ pat)
+tidyLPat v (L loc (LazyPat _ lpat))
-- This is a convenient place to check for unlifted types under a lazy pattern.
-- Doing this check during type-checking is unsatisfactory because we may
-- not fully know the zonked types yet. We sure do here.
- = putSrcSpanDs (getLocA pat) $
- do { let unlifted_bndrs = filter (isUnliftedType . idType) (collectPatBinders CollNoDictBinders pat)
- -- NB: the binders can't be representation-polymorphic, so we're OK to call isUnliftedType
+ = putSrcSpanDsA loc $
+ -- This putSrcSpan sets the location for
+ -- (a) the `DsLazyPatCantBindVarsOfUnliftedType` warning
+ -- (b) pattern-match overlap warnings inside `mkSelectorBinds`
+ -- (which ultimately calls `pmcPatBind`)
+ do { let unlifted_bndrs = filter (isUnliftedType . idType) $
+ collectPatBinders CollNoDictBinders lpat
+ -- NB: the binders can't be representation-polymorphic,
+ -- so we're OK to call isUnliftedType
; unless (null unlifted_bndrs) $
diagnosticDs (DsLazyPatCantBindVarsOfUnliftedType unlifted_bndrs)
- ; (_,sel_prs) <- mkSelectorBinds [] pat LazyPatCtx (matchIdExpr v)
+ ; (_,sel_prs) <- mkSelectorBinds [] lpat LazyPatCtx (matchIdExpr v)
; let sel_binds = [NonRec b rhs | (b,rhs) <- sel_prs]
- ; return (mkCoreLets sel_binds, WildPat (matchIdType v)) }
+ ; return (mkCoreLets sel_binds, L loc (WildPat (matchIdType v))) }
-tidy1 _ (ListPat ty pats)
- = return (idDsWrapper, unLoc list_ConPat)
+tidyLPat _ (L _ (ListPat ty pats))
+ = return (idDsWrapper, list_ConPat)
where
list_ConPat = foldr (\ x y -> mkPrefixConPat consDataCon [x, y] [ty])
(mkNilPat ty)
pats
-tidy1 _ (TuplePat tys pats boxity)
- = return (idDsWrapper, unLoc tuple_ConPat)
+tidyLPat _ (L _ (TuplePat tys pats boxity))
+ = return (idDsWrapper, tuple_ConPat)
where
arity = length pats
tuple_ConPat = mkPrefixConPat (tupleDataCon boxity arity) pats tys'
@@ -461,45 +552,47 @@ tidy1 _ (TuplePat tys pats boxity)
Boxed -> tys
-- See Note [Unboxed tuple RuntimeRep vars] in TyCon
-tidy1 _ (SumPat tys pat alt arity)
- = return (idDsWrapper, unLoc sum_ConPat)
+tidyLPat _ (L _ (SumPat tys pat alt arity))
+ = return (idDsWrapper, sum_ConPat)
where
sum_ConPat = mkPrefixConPat (sumDataCon alt arity) [pat] (map getRuntimeRep tys ++ tys)
-- See Note [Unboxed tuple RuntimeRep vars] in TyCon
-- LitPats: we *might* be able to replace these w/ a simpler form
-tidy1 _ (LitPat _ lit)
- = do { in_gen <- inGeneratedCodeDs;
- unless in_gen $
- warnAboutOverflowedLit lit
- ; return (idDsWrapper, tidyLitPat lit) }
+tidyLPat _ (L loc (LitPat _ lit))
+ = do { unlessInGenCode loc $ warnAboutOverflowedLit lit
+ -- Overflow warnings: see (TP2) in Note [Tidying patterns]
+ ; return (idDsWrapper, wrapGenSpan $ tidyLitPat lit) }
-- NPats: we *might* be able to replace these w/ a simpler form
-tidy1 _ (NPat ty (L _ lit@OverLit { ol_val = v }) mb_neg eq)
- = do { in_gen <- inGeneratedCodeDs;
- unless in_gen $
- let lit' | Just _ <- mb_neg = lit{ ol_val = negateOverLitVal v }
- | otherwise = lit
- in warnAboutOverflowedOverLit lit'
- ; return (idDsWrapper, tidyNPat lit mb_neg eq ty) }
+tidyLPat _ (L loc (NPat ty (L _ lit@OverLit { ol_val = v }) mb_neg eq))
+ = do { unlessInGenCode loc $ warnAboutOverflowedOverLit lit'
+ -- Overflow warnings: see (TP2) in Note [Tidying patterns]
+ ; return (idDsWrapper, wrapGenSpan $ tidyNPat lit mb_neg eq ty) }
+ where
+ lit' | Just _ <- mb_neg = lit{ ol_val = negateOverLitVal v }
+ | otherwise = lit
-- NPlusKPat: we may want to warn about the literals
-tidy1 _ n@(NPlusKPat _ _ (L _ lit1) lit2 _ _)
- = do { in_gen <- inGeneratedCodeDs;
- unless in_gen $ do
- warnAboutOverflowedOverLit lit1
- warnAboutOverflowedOverLit lit2
- ; return (idDsWrapper, n) }
-
-tidy1 _ (OrPat ty lpats)
+tidyLPat _ (L loc n@(NPlusKPat _ _ (L _ lit1) lit2 _ _))
+ = do { unlessInGenCode loc $
+ do { warnAboutOverflowedOverLit lit1
+ ; warnAboutOverflowedOverLit lit2 }
+ -- Overflow warnings: see (TP2) in Note [Tidying patterns]
+ ; return (idDsWrapper, wrapGenSpan n) }
+
+tidyLPat _ (L loc (OrPat ty lpats))
-- See Note [Implementation of OrPatterns]. We desugar
-- (1; 2; 3)
-- to
-- ((\case 1 -> True; 2 -> True; 3 -> True; _ -> False) -> True)
- = return (idDsWrapper, ViewPat ty (noLocA (HsLam noAnn LamCase mg)) (mkPrefixConPat trueDataCon [] []))
+ = return ( idDsWrapper
+ , L loc $ ViewPat ty (noLocA (HsLam noAnn LamCase mg))
+ (mkPrefixConPat trueDataCon [] []) )
where
mg :: MatchGroup GhcTc (LHsExpr GhcTc)
- mg = MG mgtc (noLocA (map match_true (NE.toList lpats) ++ [match_false (noLocA $ WildPat ty)]))
+ mg = MG mgtc (noLocA (map match_true (NE.toList lpats)
+ ++ [match_false (noLocA $ WildPat ty)]))
mgtc = MatchGroupTc
{ mg_arg_tys = [tymult ty]
, mg_res_ty = boolTy
@@ -516,50 +609,59 @@ tidy1 _ (OrPat ty lpats)
hs_var :: Var -> LHsExpr GhcTc
hs_var v = noLocA $ mkHsVar (noLocA v)
+
single_grhs :: LHsExpr GhcTc -> GRHSs GhcTc (LHsExpr GhcTc)
- single_grhs e = GRHSs emptyComments [noLocA $ GRHS noAnn [] e] (noLocA $ EmptyLocalBinds noExtField)
+ single_grhs e = GRHSs emptyComments [noLocA $ GRHS noAnn [] e]
+ (noLocA $ EmptyLocalBinds noExtField)
-- Everything else goes through unchanged...
-tidy1 _ non_interesting_pat
+tidyLPat _ non_interesting_pat
= return (idDsWrapper, non_interesting_pat)
--------------------
-tidy_bang_pat :: MatchId -> SrcSpanAnnA -> Pat GhcTc
- -> DsM (DsWrapper, Pat GhcTc)
-
--- Discard par/sig under a bang
-tidy_bang_pat v _ (ParPat _ (L l p)) = putSrcSpanDsA l $ tidy_bang_pat v l p
-tidy_bang_pat v _ (SigPat _ (L l p) _) = putSrcSpanDsA l $ tidy_bang_pat v l p
-
--- Push the bang-pattern inwards, in the hope that
--- it may disappear next time
-tidy_bang_pat v l (AsPat x v' p)
- = tidy1 v (AsPat x v' (L l (BangPat noExtField p)))
-tidy_bang_pat v l (XPat (CoPat w p t))
- = tidy1 v (XPat $ CoPat w (BangPat noExtField (L l p)) t)
-tidy_bang_pat v l (OrPat x (p:|ps)) -- push bang into first pat alt
- = tidy1 v (OrPat x (L l (BangPat noExtField p) :| ps))
+tidy_bang_pat :: MatchId -> LPat GhcTc
+ -> DsM (DsWrapper, LPat GhcTc)
+
+-- Push the bang-pattern inwards, in the hope that it may disappear next time
+-- AsPat !(x@p) --> x@(!p)
+-- CoPat !(p |> co) --> (!p) |> co
+-- OrPat !(p || q) --> (!p || !q)
+tidy_bang_pat v (L l (AsPat x v' p))
+ = tidyLPat v (L l (AsPat x v' (L l (BangPat noExtField p))))
+tidy_bang_pat v (L l (XPat (CoPat w p t)))
+ = tidyLPat v (L l (XPat $ CoPat w (BangPat noExtField (L l p)) t))
+tidy_bang_pat v (L l (OrPat x (p:|ps))) -- push bang into first pat alt
+ = tidyLPat v (L l (OrPat x (L l (BangPat noExtField p) :| ps)))
+
+-- Discard par/sig/bang under a bang
+-- !(p) --> !p
+-- !(p::ty) --> !p
+-- !(!p) --> !p
+tidy_bang_pat v (L _ (ParPat _ lp)) = tidy_bang_pat v lp
+tidy_bang_pat v (L _ (SigPat _ lp _)) = tidy_bang_pat v lp
+tidy_bang_pat v (L _ (BangPat _ lp)) = tidy_bang_pat v lp
-- Discard bang around strict pattern
-tidy_bang_pat v _ p@(LitPat {}) = tidy1 v p
-tidy_bang_pat v _ p@(ListPat {}) = tidy1 v p
-tidy_bang_pat v _ p@(TuplePat {}) = tidy1 v p
-tidy_bang_pat v _ p@(SumPat {}) = tidy1 v p
+-- e.g. !(Just p) --> Just p
+tidy_bang_pat v lp@(L _ (LitPat {})) = tidyLPat v lp
+tidy_bang_pat v lp@(L _ (ListPat {})) = tidyLPat v lp
+tidy_bang_pat v lp@(L _ (TuplePat {})) = tidyLPat v lp
+tidy_bang_pat v lp@(L _ (SumPat {})) = tidyLPat v lp
-- Data/newtype constructors
-tidy_bang_pat v l p@(ConPat { pat_con = L _ (RealDataCon dc)
- , pat_args = args
- , pat_con_ext = ConPatTc
- { cpt_arg_tys = arg_tys
- }
- })
+tidy_bang_pat v lp@(L l p@(ConPat { pat_con = L _ (RealDataCon dc)
+ , pat_args = args
+ , pat_con_ext = ConPatTc
+ { cpt_arg_tys = arg_tys
+ } }))
-- Newtypes: push bang inwards (#9844)
- =
- if isNewTyCon (dataConTyCon dc)
- then tidy1 v (p { pat_args = push_bang_into_newtype_arg l (scaledThing ty) args })
- else tidy1 v p -- Data types: discard the bang
- where
- (ty:_) = dataConInstArgTys dc arg_tys
+ | isNewTyCon (dataConTyCon dc)
+ , (ty:_) <- dataConInstArgTys dc arg_tys
+ = tidyLPat v (L l (p { pat_args = push_bang_into_newtype_arg l (scaledThing ty) args }))
+
+ -- Discard bang around non-newtype data constructors
+ | otherwise
+ = tidyLPat v lp
-------------------
-- Default case, leave the bang there:
@@ -576,7 +678,7 @@ tidy_bang_pat v l p@(ConPat { pat_con = L _ (RealDataCon dc)
--
-- NB: SigPatIn, ConPatIn should not happen
-tidy_bang_pat _ l p = return (idDsWrapper, BangPat noExtField (L l p))
+tidy_bang_pat _ lp = return (idDsWrapper, wrapGenSpan $ BangPat noExtField lp)
-------------------
push_bang_into_newtype_arg :: SrcSpanAnnA
@@ -1033,14 +1135,25 @@ for overloaded strings.
groupEquations :: Platform -> [EquationInfoNE] -> [NonEmpty (PatGroup, EquationInfoNE)]
-- If the result is of form [g1, g2, g3],
-- (a) all the (pg,eq) pairs in g1 have the same pg
+-- with the exception documented in (GE1) of Note [Grouping equations]
-- (b) none of the gi are empty
-- The ordering of equations is unchanged
groupEquations platform eqns
- = NE.groupBy same_gp $ [(patGroup platform (firstPat eqn), eqn) | eqn <- eqns]
- -- comprehension on NonEmpty
+ = group_eqns $ map add_gp eqns
where
- same_gp :: (PatGroup,EquationInfo) -> (PatGroup,EquationInfo) -> Bool
- (pg1,_) `same_gp` (pg2,_) = pg1 `sameGroup` pg2
+ add_gp :: EquationInfoNE -> (PatGroup, EquationInfoNE)
+ add_gp eqn = (patGroup platform (firstPat eqn), eqn)
+
+ group_eqns :: [(PatGroup,EquationInfoNE)] -> [NonEmpty (PatGroup, EquationInfoNE)]
+ -- See Note [Grouping equations]
+ group_eqns [] = []
+ group_eqns ((PgBang,e) : pges) = [ (PgBang,e) :| pges ] -- See (GE1)
+ group_eqns ((pg1,e) : pges) = ((pg1,e) :| pges1) : group_eqns pges2
+ where
+ (pges1, pges2) = span same_gp pges
+
+ same_gp :: (PatGroup,EquationInfo) -> Bool
+ same_gp (pg2,_) = pg1 `sameGroup` pg2
-- TODO Make subGroup1 using a NonEmptyMap
subGroup :: (m -> [NonEmpty EquationInfo]) -- Map.elems
=====================================
compiler/GHC/HsToCore/Match/Literal.hs
=====================================
@@ -581,8 +581,9 @@ tidyNPat (OverLit (OverLitTc False _ ty) val) mb_neg _eq outer_ty
mk_con_pat :: DataCon -> HsLit GhcTc -> Pat GhcTc
mk_con_pat con lit
- -- Mark the generated literal to avoid duplicate -Woverflowed-literals.
= unLoc (mkPrefixConPat con [wrapGenSpan $ LitPat noExtField lit] [])
+ -- wrapGenSpan: mark the literal in a generated SrcSpan to avoid duplicate
+ -- -Woverflowed-literals. See (TP2) in Note [Tidying patterns]
mb_int_lit :: Maybe Integer
mb_int_lit = case (mb_neg, val) of
=====================================
compiler/GHC/HsToCore/Monad.hs
=====================================
@@ -16,7 +16,7 @@ module GHC.HsToCore.Monad (
newSysLocalMDs, newSysLocalsMDs, newFailLocalMDs,
newUniqueId, newPredVarDs, newStaticId,
getSrcSpanDs, inGeneratedCodeDs, putSrcSpanDs, putSrcSpanDsA,
- mkNamePprCtxDs,
+ unlessInGenCode, mkNamePprCtxDs,
newUnique,
UniqSupply, newUniqueSupply,
getGhcModeDs, dsGetFamInstEnvs, dsGetGlobalRdrEnv,
@@ -151,7 +151,7 @@ data EquationInfo
= EqnMatch { eqn_pat :: LPat GhcTc
-- ^ The first pattern of the equation
--
- -- NB: The location info is used to determine whether the
+ -- NB: The location info is used only to determine whether the
-- pattern is generated or not.
-- This helps us avoid warnings on patterns that GHC elaborated.
--
@@ -681,6 +681,13 @@ getSrcSpanDs = do { env <- getLclEnv
inGeneratedCodeDs :: DsM Bool
inGeneratedCodeDs = dsl_in_generated_code <$> getLclEnv
+unlessInGenCode :: EpAnn ann -> DsM () -> DsM ()
+unlessInGenCode ann do_warn
+ | isGeneratedSrcSpan span = return ()
+ | otherwise = putSrcSpanDs span $ do_warn
+ where
+ span = locA ann
+
putSrcSpanDs :: SrcSpan -> DsM a -> DsM a
putSrcSpanDs (RealSrcSpan real_span _) thing_inside
= updLclEnv (\ env -> env {dsl_loc = real_span, dsl_in_generated_code = False}) thing_inside
=====================================
compiler/GHC/HsToCore/Pmc.hs
=====================================
@@ -143,10 +143,8 @@ pmcGRHSs hs_ctxt guards@(GRHSs _ grhss _) =
let combined_loc = foldl1 combineSrcSpans (NE.map getLocA grhss)
ctxt = DsMatchContext hs_ctxt combined_loc
matches <- dontDoPmc $ desugarGRHSs combined_loc empty guards
- tracePm "pmcGRHSs" (hang (vcat [ppr ctxt
- , text "Guards:"])
- 2
- (pprGRHSs hs_ctxt guards $$ ppr missing))
+ tracePm "pmcGRHSs" (hang (vcat [ppr ctxt, text "Guards:"])
+ 2 (pprGRHSs hs_ctxt guards $$ ppr missing))
result <- unCA (checkGRHSs matches) missing
tracePm "}: " (ppr (cr_uncov result))
formatReportWarnings ReportGRHSs ctxt [] result
=====================================
testsuite/tests/ado/T22483.stderr
=====================================
@@ -1,8 +1,8 @@
-
T22483.hs:1:1: warning: [GHC-38417] [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature: main :: IO ()
-T22483.hs:4:4: warning: [GHC-62161] [-Wincomplete-uni-patterns (in -Wall)]
+T22483.hs:4:3: warning: [GHC-62161] [-Wincomplete-uni-patterns (in -Wall)]
Pattern match(es) are non-exhaustive
In an irrefutable pattern:
Patterns of type ‘Maybe ()’ not matched: Nothing
+
=====================================
testsuite/tests/deSugar/should_compile/T27862.hs
=====================================
@@ -0,0 +1,48 @@
+{-# LANGUAGE BangPatterns #-}
+module T27862 (allBangs, firstBang, lastLazy) where
+
+data Axis = Axis !Int !Int
+
+-- The axes of extent other than 1, their strides made positive, and
+-- the offset moved by each negative stride. The three functions are
+-- the same, except for the bangs on 'off'.
+
+{- With GHC 10.0
+* allBangs has a bang on all three equations.
+ The flag reports the bangs on equations 2 and 3.
+
+* firstBang keeps only the bang that the flag does not report. Its
+ worker matches both lists two times: the second match is in a join point fail, and
+ the first match jumps to it. In the second match, GHC does not know that n is
+ evaluated. Thus it builds the strict-field constructor Axis x n inside case n
+ of I#, and in STG this is an updatable thunk, one for each axis with an extent
+ other than 1 and a non-negative stride. allBangs allocates no thunk.
+
+* lastLazy removes only the bang on equation 3. Its worker is better than
+ the worker of allBangs. allBangs keeps a join point fail _ = (# axes, ww #),
+ and its two [] alternatives jump to it. In lastLazy, the two [] alternatives
+ return (# axes, ww #) directly.
+-}
+
+allBangs :: [Axis] -> Int -> [Int] -> [Int] -> ([Axis], Int)
+allBangs axes !off (_ : sts) (1 : ns) = allBangs axes off sts ns
+allBangs axes !off (st : sts) (n : ns)
+ | st < 0 = allBangs (Axis (negate st) n : axes) (off + (n - 1) * st) sts ns
+ | otherwise = allBangs (Axis st n : axes) off sts ns
+allBangs axes !off _ _ = (axes, off)
+
+-- Both bangs that the flag reports are removed.
+firstBang :: [Axis] -> Int -> [Int] -> [Int] -> ([Axis], Int)
+firstBang axes !off (_ : sts) (1 : ns) = firstBang axes off sts ns
+firstBang axes off (st : sts) (n : ns)
+ | st < 0 = firstBang (Axis (negate st) n : axes) (off + (n - 1) * st) sts ns
+ | otherwise = firstBang (Axis st n : axes) off sts ns
+firstBang axes off _ _ = (axes, off)
+
+-- Only the last bang that the flag reports is removed.
+lastLazy :: [Axis] -> Int -> [Int] -> [Int] -> ([Axis], Int)
+lastLazy axes !off (_ : sts) (1 : ns) = lastLazy axes off sts ns
+lastLazy axes !off (st : sts) (n : ns)
+ | st < 0 = lastLazy (Axis (negate st) n : axes) (off + (n - 1) * st) sts ns
+ | otherwise = lastLazy (Axis st n : axes) off sts ns
+lastLazy axes off _ _ = (axes, off)
=====================================
testsuite/tests/deSugar/should_compile/T27862.stderr
=====================================
@@ -0,0 +1,2 @@
+firstBang = lastLazy
+allBangs = lastLazy
=====================================
testsuite/tests/deSugar/should_compile/T27862a.hs
=====================================
@@ -0,0 +1,13 @@
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -Woverflowed-literals #-}
+
+-- We expect only /one/ warning
+
+module T27862a where
+
+import Data.Word
+
+f :: Word8 -> Int
+f !x | even x = 0
+f 300 = 1
+f _ = 2
=====================================
testsuite/tests/deSugar/should_compile/T27862a.stderr
=====================================
@@ -0,0 +1,3 @@
+T27862a.hs:12:3: warning: [GHC-97441] [-Woverflowed-literals (in -Wdefault)]
+ Literal 300 is out of the Word8 range 0..255
+
=====================================
testsuite/tests/deSugar/should_compile/T27862b.hs
=====================================
@@ -0,0 +1,10 @@
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -Woverflowed-literals #-}
+
+module T27862b where
+
+import Data.Word
+
+f :: Word8 -> Int
+f !300 = 1
+f _ = 2
=====================================
testsuite/tests/deSugar/should_compile/T27862b.stderr
=====================================
@@ -0,0 +1,3 @@
+T27862b.hs:9:4: warning: [GHC-97441] [-Woverflowed-literals (in -Wdefault)]
+ Literal 300 is out of the Word8 range 0..255
+
=====================================
testsuite/tests/deSugar/should_compile/T27862c.hs
=====================================
@@ -0,0 +1,8 @@
+{-# LANGUAGE BangPatterns, MagicHash #-}
+
+module T27862c where
+
+import GHC.Exts
+
+g :: Int -> Int
+g !(~(I# x)) = 0
=====================================
testsuite/tests/deSugar/should_compile/T27862c.stderr
=====================================
@@ -0,0 +1,5 @@
+T27862c.hs:8:5: error: [GHC-17879]
+ A lazy (~) pattern cannot bind variables of unlifted type.
+ Unlifted variables:
+ x :: Int#
+
=====================================
testsuite/tests/deSugar/should_compile/T27862d.hs
=====================================
@@ -0,0 +1,10 @@
+{-# LANGUAGE MagicHash, ExtendedLiterals, TypeFamilies #-}
+module T27862d where
+
+import GHC.Exts
+
+type family F a where F () = Int8#
+
+f :: F () -> Int
+f 300#Int8 = 1 -- overflow warning expected
+f _ = 0
=====================================
testsuite/tests/deSugar/should_compile/T27862d.stderr
=====================================
@@ -0,0 +1,3 @@
+T27862d.hs:9:3: warning: [GHC-97441] [-Woverflowed-literals (in -Wdefault)]
+ Literal 300 is out of the Int8# range -128..127
+
=====================================
testsuite/tests/deSugar/should_compile/T28137.hs
=====================================
@@ -0,0 +1,8 @@
+{-# LANGUAGE Strict #-} -- NB: Strict
+module T28137 where
+
+import Data.Word
+
+f :: Word8 -> Int
+f 300 = 1 -- Should trigger a warning
+f _ = 2
=====================================
testsuite/tests/deSugar/should_compile/T28137.stderr
=====================================
@@ -0,0 +1,3 @@
+T28137.hs:7:3: warning: [GHC-97441] [-Woverflowed-literals (in -Wdefault)]
+ Literal 300 is out of the Word8 range 0..255
+
=====================================
testsuite/tests/deSugar/should_compile/all.T
=====================================
@@ -121,3 +121,13 @@ test('T27383',
[collect_compiler_stats('bytes allocated', 10)],
compile,
['-Wincomplete-patterns'])
+
+# T27862. Expecting to see
+# allBangs = lastLazy, and firstBang = lastLazy,
+# so they have identical code
+test('T27862', [grep_errmsg(' lastLazy')], compile, ['-O -ddump-simpl -dsuppress-uniques -dno-typeable-binds'])
+test('T27862a', normal, compile, [''])
+test('T27862b', normal, compile, [''])
+test('T27862c', normal, compile_fail, [''])
+test('T27862d', normal, compile, [''])
+test('T28137', normal, compile, [''])
=====================================
testsuite/tests/deSugar/should_run/dsrun008.stderr
=====================================
@@ -1,8 +1,8 @@
dsrun008: Uncaught exception ghc-internal:GHC.Internal.Control.Exception.Base.PatternMatchFail:
-dsrun008.hs:2:32-36: Non-exhaustive patterns in (2, x)
+dsrun008.hs:2:31-36: Non-exhaustive patterns in (2, x)
HasCallStack backtrace:
- throw, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:434:30 in ghc-internal:GHC.Internal.Control.Exception.Base
+ throw, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:438:30 in ghc-internal:GHC.Internal.Control.Exception.Base
=====================================
testsuite/tests/pmcheck/should_compile/T24234.stderr
=====================================
@@ -1,8 +1,8 @@
-
-T24234.hs:6:6: warning: [GHC-62161] [-Wincomplete-uni-patterns (in -Wall)]
+T24234.hs:6:5: warning: [GHC-62161] [-Wincomplete-uni-patterns (in -Wall)]
Pattern match(es) are non-exhaustive
In an irrefutable pattern: Patterns of type ‘[()]’ not matched: []
T24234.hs:7:1: warning: [GHC-53633] [-Woverlapping-patterns (in -Wdefault)]
Pattern match is redundant
In an equation for ‘foo’: foo _ = ...
+
=====================================
testsuite/tests/typecheck/should_fail/tcfail203a.stderr
=====================================
@@ -1,5 +1,5 @@
-
-tcfail203a.hs:10:17: error: [GHC-17879]
+tcfail203a.hs:10:16: error: [GHC-17879]
A lazy (~) pattern cannot bind variables of unlifted type.
Unlifted variables:
x :: Int#
+
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/06e71ddf02cff6d206f843d4d2f495a…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/06e71ddf02cff6d206f843d4d2f495a…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0