-
41e80f41
by Simon Peyton Jones at 2026-10-11T14:38:51-04:00
Simplify the error-suppression mechanism in GHC.Tc.Errors
In `GHC.Tc.Errors.reportWanteds` we suppress some errors in favour of
others. But the mechanism had grown crufty, and #27331 exposed a bug.
This MR makes it simpler and more uniform, by doing everything via
the `ei_suppress` field of the ErrorItem.
Claude then found another closely-related bug (see the review linked
on !16564). That bug is immortalised in new test T18851d.
I'm still not happy with `ignoreConstraint` but we can worry about
that another day; I have not touched it.
Main changes
* Instead of /predicting/ when an error will be reported, we set
`cec_error_reported` when an error is /actually/ reported. (I renamed
it from `cec_suppress` to reflect this change.)
Now errors are suppressed only when a preceding error has actually been
reported. Simpler and more robust.
See `Note [cec_error_reported: suppressing less-serious errors]`
The big changes are in `reportWanteds` which looks very different.
* New `Note [ei_suppress: suppressing confusing errors]` describes the
(quite separate) `ei_suppress` mechanism for suppressing confusing
errors, mainly arising from non-empty rewriter sets
* In `tryTypeClassDefaulting`, instead of switching off type-class defaulting
if there is an insoluble /anywhere/, we just switch it off locally when
we find an insoluble sub-tree. See Note [When to do type-class defaulting]
and (W5) in Note [ApproximateWC]
* Greatly simplify `insolubleWantedCt`.
* I made type-class-defaulting be a bit more eager, only switched off when
a peer or ancestor (but not child) constraint is insoluble. See
Note [When to do type-class defaulting].
Small refactorings
* Rename `askNoErrs` to `askErrsFound` and flip its polarity
* The code for "check if ei_suppress is true of all items" code is
moved to `mkErrorItems` rather than in the large `reportWanteds`.
* Code for `has_gadt_match` moves to `mkGivenErrorReporter`, rather than
polluting the large `reportWanteds`.
* Many tests with `-fdefer-type-errors` get more warnings, especially
about ambiguous (Num a) constraints. This is by-design: see
Note [Always warn with -fdefer-type-errors]. Previously GHC was not
honouring this Note but now it is, hence the extra errors.
-
f217fc31
by Cheng Shao at 2026-10-11T14:39:33-04:00
compiler: ensure cross ghc --info output target unit ids
Previously, for cross ghcs, the base/ghc/ghc-internal unit ids in
--info output do not match the target unit ids reported by ghc-pkg,
breaking cross ghc release builds with hash-unit-ids when being used
with cabal 3.18. This patch fixes it by making --info output target
unit ids. Fixes #27919.
Co-authored-by: Codex <codex@openai.com>
-
84ac2475
by Sven Tennie at 2026-10-13T10:56:52+02:00
hadrian: Add Stage3 cross-compiled target bindist (#26924)
Add a `binary-dist-stage3` Hadrian target that packages target
executables (produced by the stage2 compiler) into a separate
'_build/bindist-stage3/' folder, distinct from the stage2 regular or
cross-compiler bindist in '_build/bindist/'.
This allows a single CI pipeline job to produce both a cross-compiler
bindist (e.g. x86_64 -> RISC-V) and a target-architecture bindist (e.g.
RISC-V -> RISC-V) that can be installed and run natively on the target.
To avoid issues with stale files or race-conditions on them, generate
the `configure` script per stage in `_build/<stage>/distrib`
directories.
-
9792dde4
by Sven Tennie at 2026-10-13T10:56:53+02:00
ci: Build Stage3 and Stage2 bindists for cross targets in one job (#26924)
Building the stage3 target bindist already produces most of the stage2
cross-compiler bindist as a byproduct, so building them in separate jobs
duplicates the build efforts for no benefit. Instead of a separate
CROSS_STAGE=3 job, the stage3 job now also builds and publishes the
stage2 bindist.
The stage3 tarball is named and versioned as if it were built natively
on the target (target triple prefix, non-cross opsys), so its artifact
name stays what downstream consumers already expect and no changes are
needed on their side.
For now, this is only enabled for the RISC-V job. Others can easily
follow.
-
936a20e0
by Sven Tennie at 2026-10-13T10:56:53+02:00
ci: model cross targets as structured TargetPlatform triples
Storing the cross target as a raw triple forced ad-hoc parsing at every
use, and broke the single responsibility rule. Modelling it as a
structured `TargetPlatform`` instead, avoids parsing and provides a
clear separation of concerns.
-
39b63d0a
by Sven Tennie at 2026-10-13T10:56:53+02:00
ci: use a scalar cross-stage switch, FINAL_CROSS_STAGE=2|3
For cross-compilers, Stage2 bindists are (almost) a by-product of Stage3
bindists. Thus, we either build Stage2 or Stage2 + Stage3 bindists. The
commit at hand reflects this fact in types.
-
c0b952a4
by Sven Tennie at 2026-10-13T10:56:53+02:00
ci: extract the cross smoke tests into a separate smoke_test command
This reduces if-nesting and complexity of the main `test_hadrian`
command. The decision how to test is now made by the caller. This is a
fair choice, because most test cases can run under emulation - they are
just very slow then.
-
52f40f7e
by Sven Tennie at 2026-10-13T10:56:53+02:00
ci: inline the FINAL_CROSS_STAGE renderer
`finalCrossStageEnvVal` was small and only used in one place.
-
3c0c55ec
by Sven Tennie at 2026-10-13T10:56:53+02:00
hadrian: clarify cross-stage settings and project.mk comments
Reword the settings-rule comment to name the two stage roles
(compilerStage vs libraryStage) and explain what 'the final
architecture' in terms of project.mk generation means.
-
52256473
by Sven Tennie at 2026-10-13T11:01:18+02:00
Fix intepreter settings for native target bindists
Stage3 cross-compiled bindists wrongly assumed they cannot run the
interpreter natively. Fix this by adjusting compile flags and choosing
the correct libs/target/default.target files per compiler stage.
-
be6eeb1b
by Sven Tennie at 2026-10-13T11:01:18+02:00
Generate default.target only from the successor stage for stage0
This mirrors the behaviour for the settings' rules. Reflects that Stage0
compilers depend on the Stage1 lib/ dir.
-
c64ae620
by GHC GitLab CI at 2026-10-13T12:14:47+02:00
Reduce libraryStage equation duplication
The same code was duplicated in a couple of places.