[Git][ghc/ghc][master] GHC proposal 496 - Nullary record wildcards

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Feb 21 23:36:16 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
172ff88f by Georgi Lyubenov at 2023-02-21T18:35:56-05:00
GHC proposal 496 - Nullary record wildcards

This patch implements GHC proposal 496, which allows record wildcards
to be used for nullary constructors, e.g.

  data A = MkA1 | MkA2 { fld1 :: Int }
  f :: A -> Int
  f (MkA1 {..}) = 0
  f (MkA2 {..}) = fld1

To achieve this, we add arity information to the record field
environment, so that we can accept a constructor which has no fields
while continuing to reject non-record constructors with more than 1
field. See Note [Nullary constructors and empty record wildcards],
as well as the more general overview in Note [Local constructor info in the renamer],
both in the newly introduced GHC.Types.ConInfo module.

Fixes #22161

- - - - -


30 changed files:

- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- + compiler/GHC/Types/ConInfo.hs
- compiler/Language/Haskell/Syntax/Type.hs
- compiler/ghc.cabal.in
- docs/users_guide/9.8.1-notes.rst
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- + testsuite/tests/rename/should_compile/GADTNullaryRecordRecordWildcard.hs
- + testsuite/tests/rename/should_compile/GADTNullaryRecordWildcard.hs
- + testsuite/tests/rename/should_compile/GADTSymbolicRecordRecordWildcard.hs
- + testsuite/tests/rename/should_compile/GHCIImplicitImportNullaryRecordWildcard.script
- + testsuite/tests/rename/should_compile/GHCINullaryRecordWildcard.script
- + testsuite/tests/rename/should_compile/ImportNullaryRecordWildcard.hs
- + testsuite/tests/rename/should_compile/NullaryRecordRecordWildcard.hs
- + testsuite/tests/rename/should_compile/NullaryRecordWildcard.hs
- testsuite/tests/rename/should_compile/all.T
- testsuite/tests/rename/should_fail/T9815.stderr
- + testsuite/tests/rename/should_fail/T9815b.hs
- + testsuite/tests/rename/should_fail/T9815b.stderr
- + testsuite/tests/rename/should_fail/T9815bghci.script
- + testsuite/tests/rename/should_fail/T9815bghci.stderr
- + testsuite/tests/rename/should_fail/T9815ghci.script


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/172ff88fcac864a029d1cf77fbbe04c7a969d70d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/172ff88fcac864a029d1cf77fbbe04c7a969d70d
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/20230221/5c5c5a65/attachment-0001.html>


More information about the ghc-commits mailing list