[Git][ghc/ghc][wip/T23162-spj] 27 commits: Fix buglet in GHC.Core.Unify.uVarOrFam

Simon Peyton Jones pushed to branch wip/T23162-spj at Glasgow Haskell Compiler / GHC Commits: 9c293544 by Simon Peyton Jones at 2025-10-01T09:36:10+01:00 Fix buglet in GHC.Core.Unify.uVarOrFam We were failing to match two totally-equal types! This led to #26457. - - - - - 554487a7 by Rodrigo Mesquita at 2025-10-01T23:04:43-04:00 cleanup: Drop obsolete comment about HsConDetails HsConDetails used to have an argument representing the type of the tyargs in a list: data HsConDetails tyarg arg rec = PrefixCon [tyarg] [arg] This datatype was shared across 3 synonyms: HsConPatDetails, HsConDeclH98Details, HsPatSynDetails. In the latter two cases, `tyarg` was instanced to `Void` meaning the list was always empty for these cases. In 7b84c58867edca57a45945a20a9391724db6d9e4, this was refactored such that HsConDetails no longer needs a type of tyargs by construction. The first case now represents the type arguments in the args type itself, with something like: ConPat "MkE" [InvisP tp1, InvisP tp2, p1, p2] So the deleted comment really is just obsolete. Fixes #26461 - - - - - 6992ac09 by Cheng Shao at 2025-10-02T07:27:55-04:00 testsuite: remove unused expected output files This patch removes unused expected output files in the testsuites on platforms that we no longer support. - - - - - 39eaaaba by Ben Gamari at 2025-10-02T07:28:45-04:00 rts: Dynamically initialize built-in closures To resolve #26166 we need to eliminate references to undefined symbols in the runtime system. One such source of these is the runtime's static references to `I#` and `C#` due the `stg_INTLIKE` and `stg_CHARLIKE` arrays. To avoid this we make these dynamic, initializing them during RTS start-up. - - - - - c254c54b by Cheng Shao at 2025-10-02T07:29:33-04:00 compiler: only invoke keepCAFsForGHCi if internal-interpreter is enabled This patch makes the ghc library only invoke keepCAFsForGHCi if internal-interpreter is enabled. For cases when it's not (e.g. the host build of a cross ghc), this avoids unnecessarily retaining all CAFs in the heap. Also fixes the type signature of c_keepCAFsForGHCi to match the C ABI. - - - - - c9ec4d43 by Simon Hengel at 2025-10-02T18:42:20-04:00 Update copyright in documentation - - - - - da9633a9 by Matthew Pickering at 2025-10-02T18:43:04-04:00 loader: Unify loadDecls and loadModuleLinkables functions These two functions nearly did the same thing. I have refactored them so that `loadDecls` now calls `loadModuleLinkables`. Fixes #26459 - - - - - 5db98d80 by Simon Hengel at 2025-10-02T18:43:53-04:00 Fix typo - - - - - 1275d360 by Matthew Pickering at 2025-10-03T06:05:56-04:00 testsuite: Use ghci_ways to set ways in PackedDataCon/UnboxedTuples/UnliftedDataTypeInterp tests These tests reimplemented the logic from `valid_way` in order to determine what ways to run. It's easier to use this combination of `only_ways` and `extra_ways` to only run in GHCi ways and always run in GHCi ways. - - - - - c06b534b by Matthew Pickering at 2025-10-03T06:06:40-04:00 Rename interpreterBackend to bytecodeBackend This is preparation for creating bytecode files. The "interpreter" is one way in which we can run bytecode objects. It is more accurate to describe that the backend produces bytecode, rather than the means by which the code will eventually run. The "interpreterBackend" binding is left as a deprecated alias. - - - - - 41bdb16f by Andreas Klebinger at 2025-10-06T18:04:34-04:00 Add a perf test for #26425 - - - - - 1da0c700 by Andreas Klebinger at 2025-10-06T18:05:14-04:00 Testsuite: Silence warnings about Wx-partial in concprog001 - - - - - 7471eb6a by sheaf at 2025-10-07T21:39:43-04:00 Improve how we detect user type errors in types This commit cleans up all the code responsible for detecting whether a type contains "TypeError msg" applications nested inside it. All the logic is now in 'userTypeError_maybe', which is always deep. Whether it looks inside type family applications is determined by the passed-in boolean flag: - When deciding whether a constraint is definitely insoluble, don't look inside type family applications, as they may still reduce -- in which case the TypeError could disappear. - When reporting unsolved constraints, look inside type family applications: they had the chance to reduce but didn't, and the custom type error might contain valuable information. All the details are explained in Note [Custom type errors in constraints] in GHC.Tc.Types.Constraint. Another benefit of this change is that it allows us to get rid of the deeply dodgy 'getUserTypeErrorMsg' function. This commit also improves the detection of custom type errors, for example in equality constraints: TypeError blah ~# rhs It used to be the case that we didn't detect the TypeError on the LHS, because we never considered that equality constraints could be insoluble due to the presence of custom type errors. Addressing this oversight improves detection of redundant pattern match warnings, fixing #26400. - - - - - 29955267 by Rodrigo Mesquita at 2025-10-07T21:40:25-04:00 cleanup: Drop obsolete settings from config.mk.in These values used to be spliced into the bindist's `config.mk` s.t. when `make` was run, the values were read and written into the bindist installation `settings` file. However, we now carry these values to the bindist directly in the default.target toolchain file, and `make` writes almost nothing to `settings` now (see #26227) The entries deleted in this MR were already unused. Fixes #26478 - - - - - f7adfed2 by ARATA Mizuki at 2025-10-08T08:37:24-04:00 T22033 is only relevant if the word size is 64-bit Fixes #25497 - - - - - ff1650c9 by Ben Gamari at 2025-10-08T08:38:07-04:00 rts/posix: Enforce iteration limit on heap reservation logic Previously we could loop indefinitely when attempting to get an address space reservation for our heap. Limit the logic to 8 iterations to ensure we instead issue a reasonable error message. Addresses #26151. - - - - - 01844557 by Ben Gamari at 2025-10-08T08:38:07-04:00 rts/posix: Hold on to low reservations when reserving heap Previously when the OS gave us an address space reservation in low memory we would immediately release it and try again. However, on some platforms this meant that we would get the same allocation again in the next iteration (since mmap's `hint` argument is just that, a hint). Instead we now hold on to low reservations until we have found a suitable heap reservation. Fixes #26151. - - - - - b2c8d052 by Sven Tennie at 2025-10-08T08:38:47-04:00 Build terminfo only in upper stages in cross-builds (#26288) Currently, there's no way to provide library paths for [n]curses for both - build and target - in cross-builds. As stage0 is only used to build upper stages, it should be fine to build terminfo only for them. This re-enables building cross-compilers with terminfo. - - - - - c58f9a61 by Julian Ospald at 2025-10-08T08:39:36-04:00 ghc-toolchain: Drop `ld.gold` from merge object command It's deprecated. Also see #25716 - - - - - 2b8baada by sheaf at 2025-10-08T18:23:37-04:00 Improvements to 'mayLookIdentical' This commit makes significant improvements to the machinery that decides when we should pretty-print the "invisible bits" of a type, such as: - kind applications, e.g. '@k' in 'Proxy @k ty' - RuntimeReps, e.g. 'TYPE r' - multiplicities and linear arrows 'a %1 -> b' To do this, this commit refactors 'mayLookIdentical' to return **which** of the invisible bits don't match up, e.g. in (a %1 -> b) ~ (a %Many -> b) we find that the invisible bit that doesn't match up is a multiplicity, so we should set 'sdocLinearTypes = True' when pretty-printing, and with e.g. Proxy @k1 ~ Proxy @k2 we find that the invisible bit that doesn't match up is an invisible TyCon argument, so we set 'sdocPrintExplicitKinds = True'. We leverage these changes to remove the ad-hoc treatment of linearity of data constructors with 'dataConDisplayType' and 'dataConNonLinearType'. This is now handled by the machinery of 'pprWithInvisibleBits'. Fixes #26335 #26340 - - - - - 129ce32d by sheaf at 2025-10-08T18:23:37-04:00 Store SDoc context in SourceError This commits modifies the SourceError datatype which is used for throwing and then reporting exceptions by storing all the info we need to be able to print the SDoc, including whether we should print with explicit kinds, explicit runtime-reps, etc. This is done using the new datatype: data SourceErrorContext = SEC !DiagOpts !(DiagnosticOpts GhcMessage) Now, when we come to report an error (by handling the exception), we have access to the full context we need. Fixes #26387 - - - - - f9790ca8 by Ben Gamari at 2025-10-08T18:24:19-04:00 gitlab-ci: Make RELEASE_JOB an input Rather than an undocumented variable. - - - - - e4298817 by Richard Eisenberg at 2025-10-09T09:17:56+01:00 Refactor fundep solving This commit is a large-scale refactor of the increasingly-messy code that handles functional dependencies. It has virtually no effect on what compiles but improves error messages a bit. And it does the groundwork for #23162. The big picture is described in Note [Overview of functional dependencies in type inference] in GHC.Tc.Solver.FunDeps * New module GHC.Tc.Solver.FunDeps contains all the fundep-handling code for the constraint solver. * Fundep-equalities are solved in a nested scope; they may generate unifications but otherwise have no other effect. See GHC.Tc.Solver.FunDeps.solveFunDeps The nested needs to start from the Givens in the inert set, but not the Wanteds; hence a new function `resetInertCans`, used in `nestFunDepsTcS`. * That in turn means that fundep equalities never show up in error messages, so the complicated FunDepOrigin tracking can all disappear. * We need to be careful about tracking unifications, so we kick out constraints from the inert set after doing unifications. Unification tracking has been majorly reformed: see Note [WhatUnifications] in GHC.Tc.Utils.Unify. A good consequence is that the hard-to-grok `resetUnificationFlag` has been replaced with a simpler use of `reportCoarseGrainUnifications` Smaller things: * Rename `FunDepEqn` to `FunDepEqns` since it contains multiple type equalities. Some compile time improvement Metrics: compile_time/bytes allocated Baseline Test value New value Change ---------------------- -------------------------------------- T5030(normal) 173,839,232 148,115,248 -14.8% GOOD hard_hole_fits(normal) 286,768,048 284,015,416 -1.0% geo. mean -0.2% minimum -14.8% maximum +0.3% Metric Decrease: T5030 - - - - - 229866d4 by Simon Peyton Jones at 2025-10-09T09:17:56+01:00 QuickLook's tcInstFun should make instantiation variables directly tcInstFun must make "instantiation variables", not regular unification variables, when instantiating function types. That was previously implemented by a hack: set the /ambient/ level to QLInstTyVar. But the hack finally bit me, when I was refactoring WhatUnifications. And it was always wrong: see the now-expunged (TCAPP2) note. This commit does it right, by making tcInstFun call its own instantiation functions. That entails a small bit of duplication, but the result is much, much cleaner. - - - - - 713f336c by Simon Peyton Jones at 2025-10-09T09:17:56+01:00 Build implication for constraints from (static e) This commit addresses #26466, by buiding an implication for the constraints arising from a (static e) form. The implication has a special ic_info field of StaticFormSkol, which tells the constraint solver to use an empty set of Givens. See (SF3) in Note [Grand plan for static forms] in GHC.Iface.Tidy.StaticPtrTable This commit also reinstates an `assert` in GHC.Tc.Solver.Equality. The test `StaticPtrTypeFamily` was failing with an assertion failure, but it now works. - - - - - f896f964 by Simon Peyton Jones at 2025-10-09T09:17:56+01:00 Comment wibbles - - - - - 3d463205 by Simon Peyton Jones at 2025-10-09T13:00:37+01:00 Wibbles (test and TC.Solve.Monad.hs) - - - - - 181 changed files: - .gitlab-ci.yml - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - compiler/GHC.hs - compiler/GHC/Core/Multiplicity.hs - compiler/GHC/Core/Predicate.hs - compiler/GHC/Core/TyCo/Compare.hs - compiler/GHC/Core/TyCo/Ppr.hs - compiler/GHC/Core/TyCon.hs - compiler/GHC/Core/Type.hs - compiler/GHC/Core/Unify.hs - compiler/GHC/Driver/Backend.hs - compiler/GHC/Driver/Backend/Internal.hs - compiler/GHC/Driver/Backpack.hs - compiler/GHC/Driver/Downsweep.hs - compiler/GHC/Driver/Env/Types.hs - compiler/GHC/Driver/Errors.hs - compiler/GHC/Driver/Main.hs - compiler/GHC/Driver/Make.hs - compiler/GHC/Driver/MakeFile.hs - compiler/GHC/Driver/Monad.hs - compiler/GHC/Driver/Pipeline.hs - compiler/GHC/Driver/Pipeline/Execute.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Iface/Decl.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Load.hs - compiler/GHC/Iface/Make.hs - compiler/GHC/Iface/Tidy/StaticPtrTable.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/Linker/Loader.hs - compiler/GHC/Parser/Header.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Tc/Errors.hs - compiler/GHC/Tc/Errors/Ppr.hs - compiler/GHC/Tc/Errors/Types.hs - compiler/GHC/Tc/Gen/App.hs - compiler/GHC/Tc/Gen/Expr.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Gen/Splice.hs - compiler/GHC/Tc/Instance/FunDeps.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Solver.hs - compiler/GHC/Tc/Solver/Default.hs - compiler/GHC/Tc/Solver/Dict.hs - compiler/GHC/Tc/Solver/Equality.hs - + compiler/GHC/Tc/Solver/FunDeps.hs - compiler/GHC/Tc/Solver/InertSet.hs - compiler/GHC/Tc/Solver/Monad.hs - compiler/GHC/Tc/Solver/Solve.hs - compiler/GHC/Tc/TyCl.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Types/Constraint.hs - compiler/GHC/Tc/Types/CtLoc.hs - compiler/GHC/Tc/Types/Origin.hs - compiler/GHC/Tc/Utils/Instantiate.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Tc/Utils/TcMType.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Tc/Utils/Unify.hs-boot - compiler/GHC/Tc/Validity.hs - compiler/GHC/Tc/Zonk/TcType.hs - compiler/GHC/Types/Basic.hs - compiler/GHC/Types/SourceError.hs - compiler/GHC/Types/TyThing/Ppr.hs - compiler/GHC/Utils/Error.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Decls.hs - compiler/cbits/keepCAFsForGHCi.c - compiler/ghc.cabal.in - docs/users_guide/conf.py - docs/users_guide/extending_ghc.rst - ghc/GHCi/UI.hs - ghc/Main.hs - hadrian/bindist/config.mk.in - hadrian/src/Settings/Default.hs - + rts/BuiltinClosures.c - + rts/BuiltinClosures.h - rts/RtsStartup.c - rts/StgMiscClosures.cmm - rts/include/rts/Constants.h - rts/include/stg/MiscClosures.h - rts/posix/OSMem.c - rts/rts.cabal - testsuite/driver/testglobals.py - testsuite/driver/testlib.py - testsuite/tests/concurrent/prog001/all.T - testsuite/tests/cpranal/should_compile/T18174.stderr - testsuite/tests/default/default-fail05.stderr - testsuite/tests/dependent/should_fail/T13135_simple.stderr - testsuite/tests/deriving/should_fail/T3621.stderr - testsuite/tests/driver/T11429c.stderr - testsuite/tests/driver/T21682.stderr - testsuite/tests/driver/T5313.hs - testsuite/tests/ghc-api/T10052/T10052.hs - testsuite/tests/ghc-api/T10942.hs - testsuite/tests/ghc-api/T8639_api.hs - testsuite/tests/ghc-api/annotations-literals/literals.hs - testsuite/tests/ghc-api/apirecomp001/myghc.hs - testsuite/tests/ghci-wasm/T26431.hs - testsuite/tests/ghci/linking/dyn/T3372.hs - testsuite/tests/ghci/should_run/PackedDataCon/packeddatacon.T - testsuite/tests/ghci/should_run/UnboxedTuples/unboxedtuples.T - testsuite/tests/ghci/should_run/UnliftedDataTypeInterp/unlifteddatatypeinterp.T - testsuite/tests/indexed-types/should_fail/T14369.stderr - testsuite/tests/indexed-types/should_fail/T14887.stderr - testsuite/tests/indexed-types/should_fail/T1897b.stderr - testsuite/tests/linear/should_fail/T19361.stderr - testsuite/tests/llvm/should_run/all.T - testsuite/tests/parser/should_fail/RecordDotSyntaxFail10.stderr - testsuite/tests/parser/should_fail/RecordDotSyntaxFail13.stderr - testsuite/tests/parser/should_fail/T20654a.stderr - + testsuite/tests/perf/compiler/T26425.hs - testsuite/tests/perf/compiler/all.T - + testsuite/tests/pmcheck/should_compile/T26400.hs - + testsuite/tests/pmcheck/should_compile/T26400.stderr - + testsuite/tests/pmcheck/should_compile/T26400b.hs - testsuite/tests/pmcheck/should_compile/all.T - testsuite/tests/polykinds/T6068.stdout - − testsuite/tests/process/process010.stdout-i386-unknown-solaris2 - testsuite/tests/rep-poly/RepPolyRightSection.stderr - testsuite/tests/roles/should_compile/Roles13.stderr - − testsuite/tests/rts/linker/T11223/T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32 - − testsuite/tests/rts/linker/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 - − testsuite/tests/rts/outofmem.stderr-i386-apple-darwin - − testsuite/tests/rts/outofmem.stderr-i386-unknown-mingw32 - − testsuite/tests/rts/outofmem.stderr-powerpc-apple-darwin - testsuite/tests/simplCore/should_compile/OpaqueNoCastWW.stderr - testsuite/tests/simplCore/should_compile/T17673.stderr - testsuite/tests/simplCore/should_compile/T18078.stderr - testsuite/tests/simplCore/should_compile/T18995.stderr - testsuite/tests/simplCore/should_compile/T19890.stderr - testsuite/tests/simplCore/should_compile/T21948.stderr - testsuite/tests/simplCore/should_compile/T21960.stderr - testsuite/tests/simplCore/should_compile/T24808.stderr - − testsuite/tests/simplCore/should_compile/T25713.stderr - testsuite/tests/simplCore/should_compile/T4201.stdout - testsuite/tests/simplCore/should_compile/T8331.stderr - testsuite/tests/typecheck/no_skolem_info/T20232.stderr - testsuite/tests/typecheck/should_compile/T13651.hs - − testsuite/tests/typecheck/should_compile/T13651.stderr - + testsuite/tests/typecheck/should_compile/T14745.hs - + testsuite/tests/typecheck/should_compile/T26457.hs - testsuite/tests/typecheck/should_compile/all.T - testsuite/tests/typecheck/should_compile/tc126.hs - testsuite/tests/typecheck/should_fail/AmbigFDs.hs - − testsuite/tests/typecheck/should_fail/AmbigFDs.stderr - testsuite/tests/typecheck/should_fail/FD3.stderr - testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr - testsuite/tests/typecheck/should_fail/T11672.stderr - testsuite/tests/typecheck/should_fail/T12373.stderr - testsuite/tests/typecheck/should_fail/T13506.stderr - testsuite/tests/typecheck/should_fail/T15807.stderr - testsuite/tests/typecheck/should_fail/T16074.stderr - testsuite/tests/typecheck/should_fail/T16512a.stderr - testsuite/tests/typecheck/should_fail/T18357a.stderr - testsuite/tests/typecheck/should_fail/T18851b.hs - − testsuite/tests/typecheck/should_fail/T18851b.stderr - testsuite/tests/typecheck/should_fail/T18851c.hs - − testsuite/tests/typecheck/should_fail/T18851c.stderr - testsuite/tests/typecheck/should_fail/T19415.stderr - testsuite/tests/typecheck/should_fail/T19415b.stderr - testsuite/tests/typecheck/should_fail/T19627.stderr - testsuite/tests/typecheck/should_fail/T20241b.stderr - testsuite/tests/typecheck/should_fail/T21530a.stderr - + testsuite/tests/typecheck/should_fail/T23162a.hs - + testsuite/tests/typecheck/should_fail/T23162a.stderr - testsuite/tests/typecheck/should_fail/T25325.stderr - testsuite/tests/typecheck/should_fail/T5246.stderr - testsuite/tests/typecheck/should_fail/T5978.stderr - testsuite/tests/typecheck/should_fail/T9612.stderr - testsuite/tests/typecheck/should_fail/UnliftedNewtypesFamilyKindFail2.stderr - testsuite/tests/typecheck/should_fail/VisFlag1.stderr - testsuite/tests/typecheck/should_fail/all.T - testsuite/tests/typecheck/should_fail/tcfail143.stderr - utils/check-exact/Parsers.hs - utils/check-exact/Preprocess.hs - utils/ghc-toolchain/src/GHC/Toolchain/Tools/MergeObjs.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4140df72dfb807fd525b57aba0ed90f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4140df72dfb807fd525b57aba0ed90f... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)