[Git][ghc/ghc][wip/soulomoon/25647-allow-newtype-instance-in-gadt-syntax] 5 commits: Remove SDocs from ErrCtxt & ErrInfo

Patrick (@soulomoon) gitlab at gitlab.haskell.org
Mon Jan 13 18:59:23 UTC 2025



Patrick pushed to branch wip/soulomoon/25647-allow-newtype-instance-in-gadt-syntax at Glasgow Haskell Compiler / GHC


Commits:
2e7bf446 by sheaf at 2025-01-13T10:55:26+01:00
Remove SDocs from ErrCtxt & ErrInfo

This commit:

  - turns the SDoc used in ErrCtxt into a proper error datatype,
    ErrCtxtMsg, which contains all the different error contexts that
    can be added,

  - replaces ErrInfo with [ErrCtxt].
    ErrInfo used to contain two SDocs; the first is replaced with [ErrCtxt],
    and the second is removed, with the relevant information being put
    in the appropriate error message constructors.

Fixes #23436

- - - - -
2d62b970 by Mike Pilgrem at 2025-01-13T12:59:10-05:00
Re CLC #300 - Specify fmap for NonEmpty as map

See:
* https://github.com/haskell/core-libraries-committee/issues/300

Seeks to:
* move existing instances for NonEmpty (except of Eq and Ord) out of GHC.Internal.Base into new GHC.Internal.Data.NonEmpty (to avoid otherwise unavoidable cycles in the module graph);
* move map out of Data.List.NonEmpty (base package) into GHC.Internal.Data.NonEmpty;
* define fmap as map for NonEmpty instance of Functor, avoiding code duplication;
* re-export map from existing GHC.Internal.Data.List.NonEmpty; and
* re-export map from Data.List.NonEmpty (base package);

without breaking anything in the GHC repository.

Various tests *.stdout and *.stderr files are amended also.

- - - - -
ab3ab3e3 by Luite Stegeman at 2025-01-13T12:59:58-05:00
compiler/coreprep: Turn off dictionary speculation by default

Speculative evaluation can cause performance regressions,
therefore we turn it off by default. It can be enabled again
with the -fspec-eval-dictfun flag

See #25284

- - - - -
3d9cacd5 by Patrick at 2025-01-14T02:34:46+08:00
Enhance kind inference for data family instances
This commit improves kind inference for data family instances by kind-checking
the constructors, for H98 and newtype declarations (ONLY), as well as
kind-checking the result kind signature (when using GADT syntax).
This fixes #25611.

Typechecker changes:
In `tcDataFamInstHeader`, we now kind-check the constructors using
`kcConDecls`, for H98-style decls and newtype decls ONLY.
See Note [Kind inference for data family instances].

Testsuite changes:
  - The T25611{a,b,c,d} tests test the new kind inference implementation.
    - a,b: infer result kind from constructors (H98 case)
    - c: renamed version of test UnliftedNewtypesUnassociatedFamilyFail,
      which now passes
    - d: GADT case, checking that we don't infer overly rigid kinds when
         kind-checking the constructors in data family instances.
 - DataInstanceKindsDefaults tests defaulting data instance kinds
   without UnliftedNewtypes or UnliftedDatatypes, as outlined in
   Note [Defaulting result kind of newtype/data family instance].

Also a few notes are updated to reflect the changes.

Co-authored-by: default avatarSimon Peyton Jones <simon.peytonjones at gmail.com>

- - - - -
fcdf16e5 by Patrick at 2025-01-14T02:47:13+08:00
allow newtype instance in gadt syntax

update T23308

move T18891a from should_fail to should_compile

Move T21447 from should_fail to should_compile

Remove `IsGADT` case

- - - - -


30 changed files:

- compiler/GHC/Core/TyCon.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Infer.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Hole.hs-boot
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Errors/Types/PromotionErr.hs
- compiler/GHC/Tc/Gen/Annotation.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Export.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Match.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3bf19b5c64cea02639a21a25e38bcc0f3c085fdb...fcdf16e591743af1a358bbcc5727662102a4f653

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3bf19b5c64cea02639a21a25e38bcc0f3c085fdb...fcdf16e591743af1a358bbcc5727662102a4f653
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250113/2f4f36db/attachment.html>


More information about the ghc-commits mailing list