Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 56b32c5a by sheaf at 2025-08-12T10:00:19-04:00 Improve deep subsumption This commit improves the DeepSubsumption sub-typing implementation in GHC.Tc.Utils.Unify.tc_sub_type_deep by being less eager to fall back to unification. For example, we now are properly able to prove the subtyping relationship ((∀ a. a->a) -> Int) -> Bool <= β[tau] Bool for an unfilled metavariable β. In this case (with an AppTy on the right), we used to fall back to unification. No longer: now, given that the LHS is a FunTy and that the RHS is a deep rho type (does not need any instantiation), we try to make the RHS into a FunTy, viz. β := (->) γ We can then continue using covariance & contravariance of the function arrow, which allows us to prove the subtyping relationship, instead of trying to unify which would cause us to error out with: Couldn't match expected type ‘β’ with actual type ‘(->) ((∀ a. a -> a) -> Int) See Note [FunTy vs non-FunTy case in tc_sub_type_deep] in GHC.Tc.Utils.Unify. The other main improvement in this patch concerns type inference. The main subsumption logic happens (before & after this patch) in GHC.Tc.Gen.App.checkResultTy. However, before this patch, all of the DeepSubsumption logic only kicked in in 'check' mode, not in 'infer' mode. This patch adds deep instantiation in the 'infer' mode of checkResultTy when we are doing deep subsumption, which allows us to accept programs such as: f :: Int -> (forall a. a->a) g :: Int -> Bool -> Bool test1 b = case b of True -> f False -> g test2 b = case b of True -> g False -> f See Note [Deeply instantiate in checkResultTy when inferring]. Finally, we add representation-polymorphism checks to ensure that the lambda abstractions we introduce when doing subsumption obey the representation polymorphism invariants of Note [Representation polymorphism invariants] in GHC.Core. See Note [FunTy vs FunTy case in tc_sub_type_deep]. This is accompanied by a courtesy change to `(<.>) :: HsWrapper -> HsWrapper -> HsWrapper`, adding the equation: WpCast c1 <.> WpCast c2 = WpCast (c1 `mkTransCo` c2) This is useful because mkWpFun does not introduce an eta-expansion when both of the argument & result wrappers are casts; so this change allows us to avoid introducing lambda abstractions when casts suffice. Fixes #26225 - - - - - d175aff8 by Sylvain Henry at 2025-08-12T10:01:31-04:00 Add regression test for #18619 - - - - - a3983a26 by Sylvain Henry at 2025-08-12T10:02:20-04:00 RTS: remove some TSAN annotations (#20464) Use RELAXED_LOAD_ALWAYS macro instead. - - - - - 0434af81 by Ben Gamari at 2025-08-12T10:03:02-04:00 Bump time submodule to 1.15 Also required bumps of Cabal, directory, and hpc. - - - - - be2e65f6 by Ben Gamari at 2025-08-12T10:35:58-04:00 rts: Clarify rationale for undefined atomic wrappers Since c06e3f46d24ef69f3a3d794f5f604cb8c2a40cbc the RTS has declared various atomic operation wrappers defined by ghc-internal as undefined. While the rationale for this isn't clear from the commit message, I believe that this is necessary due to the unregisterised backend. Specifically, the code generator will reference these symbols when compiling RTS Cmm sources. - - - - - dc8e2942 by Andreas Klebinger at 2025-08-12T10:36:00-04:00 Make unexpected LLVM versions a warning rather than an error. Typically a newer LLVM version *will* work so erroring out if a user uses a newer LLVM version is too aggressive. Fixes #25915 - - - - - 8a14d3e2 by Zubin Duggal at 2025-08-12T10:36:02-04:00 testsuite: Be more permissive when filtering out GNU_PROPERTY_TYPE linker warnings The warning text is slightly different with ld.bfd. Fixes #26249 - - - - - fc691fb4 by Teo Camarasu at 2025-08-12T10:36:03-04:00 rts: ensure MessageBlackHole.link is always a valid closure We turn a MessageBlackHole into an StgInd in wakeBlockingQueue(). Therefore it's important that the link field, which becomes the indirection field, always points to a valid closure. It's unclear whether it's currently possible for the previous behaviour to lead to a crash, but it's good to be consistent about this invariant nonetheless. Co-authored-by: Andreas Klebinger <klebinger.andreas@gmx.at> - - - - - d7990d5a by Teo Camarasu at 2025-08-12T10:36:03-04:00 rts: spin if we see a WHITEHOLE in messageBlackHole When a BLACKHOLE gets cancelled in raiseAsync, we indirect to a THUNK. GC can then shortcut this, replacing our BLACKHOLE with a fresh THUNK. This THUNK is not guaranteed to have a valid indirectee field. If at the same time, a message intended for the previous BLACKHOLE is processed and concurrently we BLACKHOLE the THUNK, thus temporarily turning it into a WHITEHOLE, we can get a segfault, since we look at the undefined indirectee field of the THUNK The fix is simple: spin if we see a WHITEHOLE, and it will soon be replaced with a valid BLACKHOLE. Resolves #26205 - - - - - 423d9752 by Oleg Grenrus at 2025-08-12T10:36:04-04:00 Allow defining HasField instances for naughty fields Resolves #26295 ... as HasField solver doesn't solve for fields with "naughty" selectors, we could as well allow defining HasField instances for these fields. - - - - - 49 changed files: - compiler/GHC/Builtin/PrimOps/Ids.hs - compiler/GHC/Driver/Errors/Ppr.hs - compiler/GHC/HsToCore.hs - compiler/GHC/Tc/Gen/App.hs - compiler/GHC/Tc/Gen/Expr.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/Types/Evidence.hs - compiler/GHC/Tc/Types/Origin.hs - compiler/GHC/Tc/Utils/Concrete.hs - compiler/GHC/Tc/Utils/Unify.hs - compiler/GHC/Tc/Validity.hs - compiler/GHC/Types/Id/Make.hs - compiler/ghc.cabal.in - ghc/ghc-bin.cabal.in - libraries/Cabal - libraries/directory - libraries/hpc - libraries/time - libraries/unix - rts/Messages.c - rts/StgMiscClosures.cmm - rts/Updates.h - rts/external-symbols.list.in - rts/posix/ticker/Pthread.c - rts/posix/ticker/TimerFd.c - rts/rts.cabal - testsuite/driver/testlib.py - testsuite/tests/corelint/LintEtaExpand.stderr - testsuite/tests/indexed-types/should_fail/T5439.stderr - + testsuite/tests/numeric/should_run/T18619.hs - + testsuite/tests/numeric/should_run/T18619.stderr - testsuite/tests/numeric/should_run/all.T - + testsuite/tests/overloadedrecflds/should_run/T26295.hs - + testsuite/tests/overloadedrecflds/should_run/T26295.stdout - testsuite/tests/overloadedrecflds/should_run/all.T - testsuite/tests/partial-sigs/should_compile/T10403.stderr - testsuite/tests/partial-sigs/should_fail/T10615.stderr - + testsuite/tests/rep-poly/NoEtaRequired.hs - testsuite/tests/rep-poly/T21906.stderr - testsuite/tests/rep-poly/all.T - + testsuite/tests/typecheck/should_compile/T26225.hs - + testsuite/tests/typecheck/should_compile/T26225b.hs - testsuite/tests/typecheck/should_compile/all.T - − testsuite/tests/typecheck/should_fail/T12563.stderr - testsuite/tests/typecheck/should_fail/T14618.stderr - testsuite/tests/typecheck/should_fail/T6022.stderr - testsuite/tests/typecheck/should_fail/T8883.stderr - testsuite/tests/typecheck/should_fail/all.T - testsuite/tests/typecheck/should_fail/tcfail140.stderr The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/64fad685ef3edd4818dcb346a4bc4a7... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/64fad685ef3edd4818dcb346a4bc4a7... You're receiving this email because of your account on gitlab.haskell.org.