[Git][ghc/ghc][wip/andreask/start-9.8.1-notes] Fix #22742
Andreas Klebinger (@AndreasK)
gitlab at gitlab.haskell.org
Mon Jan 23 14:30:45 UTC 2023
Andreas Klebinger pushed to branch wip/andreask/start-9.8.1-notes at Glasgow Haskell Compiler / GHC
Commits:
3e4469d1 by Simon Peyton Jones at 2023-01-23T15:29:20+01:00
Fix #22742
runtimeRepLevity_maybe was panicing unnecessarily; and
the error printing code made use of the case when it should
return Nothing rather than panicing.
For some bizarre reason perf/compiler/T21839r shows a 10% bump in runtime
peak-megagbytes-used, on a single architecture (alpine). See !9753 for
commentary, but I'm going to accept it.
Metric Increase:
T21839r
- - - - -
5 changed files:
- compiler/GHC/Core/Type.hs
- docs/users_guide/9.8.1-notes.rst
- + testsuite/tests/polykinds/T22742.hs
- + testsuite/tests/polykinds/T22742.stderr
- testsuite/tests/polykinds/all.T
Changes:
=====================================
compiler/GHC/Core/Type.hs
=====================================
@@ -686,8 +686,8 @@ kindBoxedRepLevity_maybe ty
-- * False of type variables, type family applications,
-- and of other reps such as @IntRep :: RuntimeRep at .
isLiftedRuntimeRep :: RuntimeRepType -> Bool
-isLiftedRuntimeRep rep =
- runtimeRepLevity_maybe rep == Just Lifted
+isLiftedRuntimeRep rep
+ = runtimeRepLevity_maybe rep == Just Lifted
-- | Check whether a type of kind 'RuntimeRep' is unlifted.
--
@@ -779,7 +779,8 @@ isBoxedRuntimeRep_maybe rep
| otherwise
= Nothing
--- | Check whether a type of kind 'RuntimeRep' is lifted, unlifted, or unknown.
+-- | Check whether a type (usually of kind 'RuntimeRep') is lifted, unlifted,
+-- or unknown. Returns Nothing if the type isn't of kind 'RuntimeRep'.
--
-- `runtimeRepLevity_maybe rr` returns:
--
@@ -793,7 +794,9 @@ runtimeRepLevity_maybe rep
if (rr_tc `hasKey` boxedRepDataConKey)
then case args of
[lev] -> levityType_maybe lev
- _ -> pprPanic "runtimeRepLevity_maybe" (ppr rep)
+ _ -> Nothing -- Type isn't of kind RuntimeRep
+ -- The latter case happens via the call to isLiftedRuntimeRep
+ -- in GHC.Tc.Errors.Ppr.pprMisMatchMsg (#22742)
else Just Unlifted
-- Avoid searching all the unlifted RuntimeRep type cons
-- In the RuntimeRep data type, only LiftedRep is lifted
=====================================
docs/users_guide/9.8.1-notes.rst
=====================================
@@ -10,4 +10,72 @@ Compiler
~~~~~~~~
- Added a new warning :ghc-flag:`-Wterm-variable-capture` that helps to make code compatible with
- the future extension ``RequiredTypeArguments``.
\ No newline at end of file
+ the future extension ``RequiredTypeArguments``.
+
+GHCi
+~~~~
+
+
+Runtime system
+~~~~~~~~~~~~~~
+
+
+
+``base`` library
+~~~~~~~~~~~~~~~~
+
+
+``ghc-prim`` library
+~~~~~~~~~~~~~~~~~~~~
+
+``ghc`` library
+~~~~~~~~~~~~~~~
+
+``ghc-heap`` library
+~~~~~~~~~~~~~~~~~~~~
+
+
+Included libraries
+------------------
+
+The package database provided with this distribution also contains a number of
+packages other than GHC itself. See the changelogs provided with these packages
+for further change information.
+
+.. ghc-package-list::
+
+ libraries/array/array.cabal: Dependency of ``ghc`` library
+ libraries/base/base.cabal: Core library
+ libraries/binary/binary.cabal: Dependency of ``ghc`` library
+ libraries/bytestring/bytestring.cabal: Dependency of ``ghc`` library
+ libraries/Cabal/Cabal/Cabal.cabal: Dependency of ``ghc-pkg`` utility
+ libraries/Cabal/Cabal-syntax/Cabal-syntax.cabal: Dependency of ``ghc-pkg`` utility
+ libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library
+ libraries/deepseq/deepseq.cabal: Dependency of ``ghc`` library
+ libraries/directory/directory.cabal: Dependency of ``ghc`` library
+ libraries/exceptions/exceptions.cabal: Dependency of ``ghc`` and ``haskeline`` library
+ libraries/filepath/filepath.cabal: Dependency of ``ghc`` library
+ compiler/ghc.cabal: The compiler itself
+ libraries/ghci/ghci.cabal: The REPL interface
+ libraries/ghc-boot/ghc-boot.cabal: Internal compiler library
+ libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library
+ libraries/ghc-compact/ghc-compact.cabal: Core library
+ libraries/ghc-heap/ghc-heap.cabal: GHC heap-walking library
+ libraries/ghc-prim/ghc-prim.cabal: Core library
+ libraries/haskeline/haskeline.cabal: Dependency of ``ghci`` executable
+ libraries/hpc/hpc.cabal: Dependency of ``hpc`` executable
+ libraries/integer-gmp/integer-gmp.cabal: Core library
+ libraries/libiserv/libiserv.cabal: Internal compiler library
+ libraries/mtl/mtl.cabal: Dependency of ``Cabal`` library
+ libraries/parsec/parsec.cabal: Dependency of ``Cabal`` library
+ libraries/pretty/pretty.cabal: Dependency of ``ghc`` library
+ libraries/process/process.cabal: Dependency of ``ghc`` library
+ libraries/stm/stm.cabal: Dependency of ``haskeline`` library
+ libraries/template-haskell/template-haskell.cabal: Core library
+ libraries/terminfo/terminfo.cabal: Dependency of ``haskeline`` library
+ libraries/text/text.cabal: Dependency of ``Cabal`` library
+ libraries/time/time.cabal: Dependency of ``ghc`` library
+ libraries/transformers/transformers.cabal: Dependency of ``ghc`` library
+ libraries/unix/unix.cabal: Dependency of ``ghc`` library
+ libraries/Win32/Win32.cabal: Dependency of ``ghc`` library
+ libraries/xhtml/xhtml.cabal: Dependency of ``haddock`` executable
=====================================
testsuite/tests/polykinds/T22742.hs
=====================================
@@ -0,0 +1,8 @@
+module T22742 where
+
+import GHC.Exts (TYPE)
+
+data T (a :: TYPE r) = MkT
+
+f :: T @(f a b) () -> ()
+f MkT = ()
=====================================
testsuite/tests/polykinds/T22742.stderr
=====================================
@@ -0,0 +1,6 @@
+
+T22742.hs:7:17: error: [GHC-83865]
+ • Couldn't match kind ‘GHC.Types.BoxedRep’ with ‘f a’
+ Expected kind ‘TYPE (f a b)’, but ‘()’ has kind ‘*’
+ • In the second argument of ‘T’, namely ‘()’
+ In the type signature: f :: T @(f a b) () -> ()
=====================================
testsuite/tests/polykinds/all.T
=====================================
@@ -242,3 +242,4 @@ test('T19739d', normal, compile, [''])
test('T22379a', normal, compile, [''])
test('T22379b', normal, compile, [''])
test('T22743', normal, compile_fail, [''])
+test('T22742', normal, compile_fail, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3e4469d12e9bd42beea2b2c5b28254c7057d344b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3e4469d12e9bd42beea2b2c5b28254c7057d344b
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/20230123/aea5c529/attachment-0001.html>
More information about the ghc-commits
mailing list