-
7bf546fc
by Simon Peyton Jones at 2026-08-31T23:48:53-04:00
Never make an absent filler for a constraint type
mkAbsentFiller used isTerminatingType to decide, but that is not enough.
Consider
class Eq a => UC a where {}
let u :: UC Int -- UC Int is a "non-terminating type"
u = error "Absent"
let e :: Eq Int -- Eq Int is a "terminating type"
e = $p1UC u
We clearly must not make a filler for `e`, because we speculatively
evaluate it. But speculatively evaluating `e` forces `u`, so we must not
make one for `u` either.
Asking isDictTy instead is not enough either, because it does not catch a
constraint hidden behind an unreduced type family application:
type family F a :: Constraint
type instance F W = TC W
a :: F W => Int -> Int -- (F W) argument is absent
Oops! Entered absent arg Arg: irred
Type: F W
So play safe and use isPredTy: never make an absent filler for any
constraint-kinded type.
Fixes #27627
-
5f474953
by Zubin Duggal at 2026-08-31T23:48:53-04:00
Add tests for absent fillers at dictionary types
T27627 a unary class whose superclass is a non-unary class
T27627a ...whose superclass is a Constraint-kinded type family
T27627b ...whose superclass is a quantified constraint
T27627c a unary class applied to itself, (UC (UC (TC a)))
T27627e a (forall b. P b) dictionary that loops
-
cd5c6bcc
by Zubin Duggal at 2026-08-31T23:48:53-04:00
An abstract TyCon may hide a unary class
A class declared in an hs-boot file is an AbstractTyCon inside the
module loop, and compiling the real declaration may reveal it to be a
UnaryClassTyCon.
- isTerminatingType returned True for such AbstractTyCons
- IfaceToCore set the unary flag to False in the DFunId
So we could end up speculating bottom dictionaries because inside a module
loop we see an UnaryClassTyCon as an AbstractTyCon
Use isTerminatingTyCon, which returns False for an abstract TyCon.
The Bool in DFunId is now a cache for isTerminatingTyCon, set in
mkDFunIdDetails.
Fixes #27704
-
abfc224a
by Zubin Duggal at 2026-08-31T23:48:53-04:00
Specialise: don't replace dead args with absent fillers
specHeader decides an argument is dead by calling isDeadBinder on a binder of
the /optimised RHS/, then applies the filler to the /stable unfolding/
template instead. The two may differ, so the argument can be dead in
the RHS and not in the template.
The specialised function's unfolding then has an absent filler, and any call
site that inlines it evaluates the error thunk.
Dropping dead args in the specialiser is rarely worth it, to quote Simon,
"The later worker/wrapper pass will pick up the dead arg later if it is really dead. Keeps the specialiser simpler."
So instead of trying to check if the arg really is dead in the stable unfolding,
just drop the logic for dropping dead args in the specialiser altogeher.
Fixes #27703
-
1557fd1c
by Zubin Duggal at 2026-08-31T23:48:53-04:00
CorePrep: don't speculate a call across an hs-boot edge
We take care not to evaluate things that might be bottom, like a
looping dictionary group, but our analysis is defeated by boot files.
We only track recursion within a module, so two dictionaries that
depend on each other across a module loop each look non-recursive, and
we might speculate them.
Any recursion we cannot see must cross an hs-boot edge, so refuse to
speculate calls that cross one.
Fixes #27717
-
4117e5ae
by Wolfgang Jeltsch at 2026-08-31T23:49:35-04:00
Incorporate the `rethrowSTM` reexport into the `stm` submodule
-
4bfbf5c8
by ARATA Mizuki at 2026-09-01T18:55:08-04:00
testsuite: Fix out-of-bounds access in T3586
unsafeRead and unsafeWrite use 0-based index.
Looking at #3586, the expected output seems to be 2.8e8.
Addresses #27596
-
3f9db6d4
by ARATA Mizuki at 2026-09-01T18:55:08-04:00
testsuite: Fix out-of-bounds access in T21305
writeInt64Array# takes an index measured in units of Int64 elements.
Fixes #27596
-
44d7788f
by Simon Peyton Jones at 2026-09-01T18:55:53-04:00
Fix buglet in INLINE-arity calculation for pattern synonyms
This fixes #27744.
The buglet was accidentally introduced by
commit 3a0f9a51c1dacc474c7fd128082edd8bf4081256
Author: Simon Peyton Jones <simon.peytonjones@gmail.com>
Date: Sat Aug 1 00:13:02 2026 +0100
Fix three bugs related to required type args and INLINE pragmas
I failed to find all the calls to `addInlinePragArity`!
-
df058f1d
by Simon Jakobi at 2026-09-02T07:18:06-04:00
testsuite: Migrate perf tests off collect_compiler_stats('all')
The 'all' metric argument applies a single tolerance to bytes
allocated, max_bytes_used and peak_megabytes_allocated, although their
noise profiles are incompatible (#27653): allocations are nearly
deterministic, residency needs 10-20%, and peak is quantized to 1 MB.
Any single tolerance is too tight for one metric or too slack for
another. This migrates the remaining users of 'all' (and of the 'all'
default) to explicit per-metric collection, ahead of removing 'all'
from the driver.
peak_megabytes_allocated is dropped everywhere: its 1 MB granularity
makes tight relative windows meaningless (#27613), and it is sensitive
to GC timing. In #27489 it drifted by -5.3% while max_bytes_used moved
by less than 0.1%. Where a test guards a memory property,
max_bytes_used covers it at byte granularity.
Where the motivating ticket was about compile-time memory
(T11545, T15304, T26425), residency remains gated via max_bytes_used,
now with a residency-appropriate tolerance.
max_bytes_used is dropped where residency was only ever an accident of
'all':
* T15630, T15630a, T20261: the underlying tickets (#15630, #20261)
contain no memory data at all. One is a simplifier-ticks blowup and
the other is stated entirely in allocation numbers, so the 20%
window never had teeth.
* T21839c: #21839's measurements show residency essentially flat
(+0.16%) while allocations moved +7%, so allocations are the
discriminating metric. They are already gated at 1% via
collect_compiler_runtime. The ghc/max gate had previously broken CI
spuriously (9fd11585eb widened it from 1% to 10% for that reason).
Allocation tolerances are tightened to the testsuite's conventional 2%
where 'all' previously left them at 10-20%.
Assisted-by: Claude Fable 5
-
72dd2432
by Simon Jakobi at 2026-09-02T07:18:06-04:00
testsuite: Remove the 'all' metric argument of collect_stats
'all' gated bytes allocated, max_bytes_used and peak_megabytes_allocated
at a single tolerance, although their noise profiles are incompatible,
making such tests either flaky or toothless (#27653).
Closes #27653.
Assisted-by: Claude Fable 5
-
2228cb30
by Simon Jakobi at 2026-09-02T07:18:06-04:00
testsuite: Make the deviation argument of collect_stats mandatory
Almost every caller passes an explicit tolerance matched to the
metric's noise profile, and the silent 20% default is far slacker than
'bytes allocated' merits. Only two tests relied on it. They now state
their tolerance explicitly:
large-project gets 10%, in line with other large compile-time tests.
T9848 gets 2%: its metric is byte-for-byte deterministic across CI
jobs and platforms of a given test_env, has drifted only about 2.5%
since 2015, and the fusion failure it guards against would show up as
a roughly +30000% jump.
Assisted-by: Claude Fable 5
-
56291fc5
by Cheng Shao at 2026-09-02T07:18:45-04:00
autoconf/ghc-toolchain: bump llvm upper bound to support llvm 23
This commit bumps llvm upper bound to support llvm 23.
-
20eb3f41
by Cheng Shao at 2026-09-02T07:18:45-04:00
rts: fix compilation issues with clang 23
clang 23 has broadened `-Wall`/`-Wextra` ranges, exposing some minor
issues in the rts when building with validate flavours:
- Unused locals
- `#pragma GCC diagnostic pop` mismatch
This commit fixes those.
-
6af3089f
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA Fix HsCmdDo exact print with comments
Exact printing of HsCmdDo was ignoring the location for the do
statements, and this is an annotation that can have comments in it.
Update it so we print the statements as a unit, including any
comments.
Also add the result of auditing that we capture comments in all needed
places, noting that the remaining Anno SrcSpan instances are benign.
-
8b9d68b9
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Remove ListBanana / ListParens from AnnListBrackets
-
7c7b211b
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Tidy up mkHsDoPv, take AnnList directly
And some extra stuff by accident.
The main goal is to slim down AnnListBrackets to just have braces or
none.
This makes it clear that it serves only for lists which may have layout,
and opens the route to use EpLayout instead of AnnListBrackets
-
d37fc354
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Add specific layout field to AnnList
-
ee573d5a
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Use EpaLocation in EpVirtualBraces
reword:
EPA Use vocurly as basis for AnnListLayout
For the existing cases that populate AnnList.
This also shows up AnnList usages that can never capture layout.
-
41c9e563
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Use vocurly as basis for AnnListLayout
For the existing cases that populate AnnList.
This also shows up AnnList usages that can never capture layout.
-
fda7a82b
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: AnnList clean up patch for empty where clause
-
ce84e6b0
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Add TTG fields to FamilyInfo
This commit is a simple add, with unused extension fields.
It lays the groundwork for using them for exact print annotations
-
318a9fa6
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
WIP annclassdecl
-
0317310d
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Update AnnClsInstDecl to contain AnnList
It was already separately tracking the '{', '}' and leading ';' values.
This aligns it with layout-introducing parser productions ('vocurly'),
so the layout processing can be handled uniformly
-
43bcf7d4
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Tidy up markAnnListA'
It takes an action which can modify the AnnList, but this
is never used. So remove it.
-
6eaf8db6
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Use AnnList for GADT declarations
-
50e7d2b9
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Use AnnList in AnnClassDecl
-
135354b3
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
MOVE EPA: Plan for Fixing AnnList Layout Properly
-
1e82f47c
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make local binds located
Use LHsLocalBinds instead of HsLocalBinds
This reverses an earlier change, and brings processing of local binds
into alignement with the exact printing principle that the LocatedA
contents provide the location and extent of the enclosed item,
together with any comments or context-specific trailing items like
commas or semi colons.
The internal TTG extension points only carry exact print annotations
related to printing the item within its bounds.
This change brings back the problem of EmptyLocalBinds, which by
definition cannot have a location. These get a noSrcSpan location,
which is ignored in the exact printing process.
-
34ddb367
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Use AnnList in HsMultiIf
It introduces layout, capture it
-
2414cc87
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Use AnnList in DecBrl
-
f8ad7558
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Replace AnnListLayout / AnnListBrackets with EpLayout
-
1ca1c941
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
WIP: setLayoutBoth inside markAnnListA
Current problem is it is a global one-shot, and MG has one too
Check: is it needed?
if so, honouring EpLayout may be needed
-
d38e771d
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA some tests for layout. WIP
-
8adabcd9
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
Exactprint layout scope plan. Do not commit
-
55706ebf
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: tidy up a bit. Combine somewhere else
-
cf9a4129
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Introduce LayoutFrame stacks in ExactPrint state
-
5933f435
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
Align with ghc-exactprint
-
594bc847
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Fix AnnList leading semis when layout
When there is layout, anything printed triggers it, including leading
semis.
Add some test case examples too
-
8c07e9d7
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
Exactprint: tidy up layout capturing
-
21acf99c
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: add makeDelta test for Test20297
The original #20297 related to comment placement for exact printing
after running ExactPrint.makeDelta on ParsedSource. Add an additional
test that explicitly tests this.
-
20e10b1f
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make ValBinds LocatedA in HsLocalBindsLR
If we have items with an AnnList Annotation, as part of another, which
has different content, it must be LocatedA. This is a technical requirement
due to the way comment allocation happens during the makeDelta processing.
Comments are queued for printing, and as soon as any non-comment is to
be printed, the pending comments before that position are printed, and
in makeDelta processing these attached as preceding comments to the thing
just printed.
The means they end up captured inside the layout region of the AnnList item.
So for
foo = x
where -- comment
x = 3
the comment ends up as a preceding comment of `x = 3`, inside the
layout, and prints as
foo = x
where
-- comment
x = 3
-
ef214a84
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make IPBinds LocatedA
-
9b5725ee
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make ClsInstDecl decls LocatedA
-
9628e2d2
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make ClassDecls decls LocatedA
-
a82f5c5b
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make ClosedTypeFamily equations Located
For FamilyDecl/ClosedTypeFamily
-
0bd5da1f
by Alan Zimmerman at 2026-09-02T18:17:56+01:00
EPA: Make dd_cons located
-
b0cb7630
by Alan Zimmerman at 2026-09-02T21:19:02+01:00
EPA: Make HsMultiIf options located
-
903dfa3e
by Alan Zimmerman at 2026-09-02T22:24:23+01:00
EPA: Make DecBrl contents LocatedA
-
ade7d2cc
by Alan Zimmerman at 2026-09-02T22:42:34+01:00
Extend Test20297 for additional occurrences
-
7ae6dc91
by Alan Zimmerman at 2026-09-03T18:43:43+01:00
Plan update DO NOT COMMIT
-
24aa13d8
by Alan Zimmerman at 2026-09-03T18:43:43+01:00
EPA: First pass implementation of HsList, for ClassDecls
Just as a straight list replacement to start with, no payload.
This shows the scope and invasiveness of the initial change
-
f76ea0c3
by Alan Zimmerman at 2026-09-03T18:43:43+01:00
EPA: HsList attempt WIP
-
f8a70d9d
by Alan Zimmerman at 2026-09-03T18:43:43+01:00
Enable ppr test for Haddock1. It currently fails
-
c91bc0b4
by Alan Zimmerman at 2026-09-03T18:43:43+01:00
WIP on removing NoEpAnn. Likely abandon
-
bb94450b
by Alan Zimmerman at 2026-09-03T18:43:43+01:00
EPA: Add an overview doc for exact printing
-
cb9f848c
by Simon Peyton Jones at 2026-09-03T18:43:43+01:00
Added an intro section