-
c77d88fc
by sheaf at 2026-08-13T10:15:22-04:00
Allow rewriting in RuntimeReps for newtype ConPats
This commit implements PHASE 2 of the FixedRuntimeRep plan described in
Note [The Concrete mechanism] in GHC.Tc.Utils.Concrete for newtype
constructor patterns.
In short, GHC now accepts programs of the form
f (MkN x) = ...
in which the argument 'x' of the newtype constructor pattern 'MkN x'
has a representation that is not syntactically concrete, e.g. it can be
'Id IntRep' reducing to 'IntRep'. See T20363{,b,c} for examples.
There are two main parts to the implementation:
1. Typechecking, in GHC.Tc.Gen.Pat.tcDataConPat.
See Note [Typechecking newtype constructor patterns] in GHC.Tc.Gen.Pat.
2. Desugaring. We restructure the code for desugaring pattern matches
by allowing the scrutinised match variable to be casted. This allows
us to accumulate coercions and avoids creating binders at intermediate
types tha don't have a fixed RuntimeRep.
See the revamped Note [Match Ids] in GHC.HsToCore.Monad.
Fixes #20363
-------------------------
Metric Increase:
InstanceMatching
-------------------------
-
6ba9dd41
by Wolfgang Jeltsch at 2026-08-13T10:16:07-04:00
Improve the documentation of `--show-iface`
This change in particular gets rid of the claim that `--show-iface`
writes *the* contents of the interface file in question. It doesn’t do
that; it only writes those parts that are likely of interest to a human
reader.
-
4bd193fa
by Sylvain Henry at 2026-08-13T10:17:00-04:00
RTS: fix LDV profiler's slop skipping (#27585)
processHeapForDead was the one heap scanner not updated for the slop
marker encoding introduced in #19048. It still assumed slop is zeroed:
while (p < bd->free && !*p) p++; // skip slop
so it stopped at the (StgWord)(-1) sentinel and passed it to
processHeapClosureForDead. IS_FORWARDING_PTR(-1) holds, hence a garbage
size was read out of LDVW and the scan ran off the block, tripping
ASSERT(p == bd->free) on a debug RTS and silently corrupting the census
otherwise.
The loop was hand-copied in four places, so factor it out into skipSlop
in ClosureMacros.h and use it in ProfHeap.c, Sanity.c, Printer.c and
LdvProfile.c.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
-
1446bb03
by Zubin Duggal at 2026-08-13T10:17:48-04:00
hadrian: Fix links to remaining doc sites to not use the package hash for haddock links
In 07267f79d91169f474cacc8bcd38d76a6e97887d we changed hadrian to not include the package hash in the haddock
directory. This patch takes care of a few remaining links that were missed in that patch
Fixes #27671
-
257c3ed7
by Simon Jakobi at 2026-08-13T10:18:29-04:00
Testsuite: widen InstanceMatching acceptance window to 5% (#27673)
...in order to unblock CI.
Assisted-by: Claude Fable 5
-
62cc6594
by Simon Jakobi at 2026-08-13T21:41:27+02:00
Enumerate RoughMap unifiers non-deterministically
The wildcard case of lookupRM' enumerated potential unifiers with a
deterministic fold, which must inspect every entry of rm_known before
producing the first element. This defeats the laziness that
Note [Matches vs Unifiers] relies on: hot consumers such as matchInstEnv
only test whether the unifier list is empty, yet paid for deterministic
iteration over the whole map (#27459).
Enumerate the unifiers with a new lazy nonDetFoldUDFM instead, so the
emptiness test can stop at the first unifier. Matches are still
enumerated deterministically. Unifier order is now restored at the
error-rendering sites: class-instance overlap errors already sort with
fuzzyClsInstCmp, and reportConflictInstErr now picks the reported
conflict deterministically. See Note [Matches vs Unifiers].
Test output changes: the lazier enumeration forces fewer candidate
types during solving, so fewer interfaces are demand-loaded and the
"...plus N instances involving out-of-scope types" counts in ambiguity
errors shrink (default-fail05, T10963) — these lists reflect the
instance environment as loaded at error-report time and were already
load-state-dependent. In implicit-dyn-too, the recompiled QuasiExpr.o
is now bit-identical to the original (previously it differed only in
unique-derived local symbol names), so the [TH] changed recompilation
of QuasiQuote correctly no longer fires.
-------------------------
Metric Decrease:
InstanceMatching
InstanceMatching1
Assisted-by: Claude Fable 5