[Git][ghc/ghc][wip/T25651] 3 commits: Enhance kind inference for data family instances
Ryan Scott (@RyanGlScott)
gitlab at gitlab.haskell.org
Thu Jan 16 13:08:04 UTC 2025
Ryan Scott pushed to branch wip/T25651 at Glasgow Haskell Compiler / GHC
Commits:
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>
- - - - -
f6493dbc by amesgen at 2025-01-15T18:47:23-05:00
wasm: prevent bundlers from resolving import("node:timers")
This fixes the following esbuild error:
✘ [ERROR] Could not resolve "node:timers"
www/ghc_wasm_jsffi.js:66:25:
66 │ return (await import("node:timers")).setImmediate;
╵ ~~~~~~~~~~~~~
The package "node:timers" wasn't found on the file system but is built into node. Are you trying
to bundle for node? You can use "--platform=node" to do that, which will remove this error.
Previously (i.e. after !13503), one had to work around this by passing
`--external:node:timers`.
- - - - -
50940a2f by Ryan Scott at 2025-01-16T08:07:53-05:00
Fix :info pretty-printing of UNPACKed fields
This patch:
* Ensures that we do not pretty-print a field like `foo :: {-# UNPACK #-} !Int`
as `foo :: ! {-# UNPACK -#} Int` (as we were doing before) when running the
`:info` command.
* Prevents coercions that arise from `UNPACK`ed fields (e.g., such as when one
unpacks a newtype) from being printed in `:info` output unless `-dppr-debug`
is enabled.
Fixes #25651.
- - - - -
15 changed files:
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- testsuite/tests/backpack/should_fail/T19244a.stderr
- testsuite/tests/ghci/scripts/T9881.stdout
- + testsuite/tests/indexed-types/should_compile/DataInstanceKindsDefaults.hs
- + testsuite/tests/indexed-types/should_compile/T25611a.hs
- + testsuite/tests/indexed-types/should_compile/T25611b.hs
- testsuite/tests/typecheck/should_fail/UnliftedNewtypesUnassociatedFamilyFail.hs → testsuite/tests/indexed-types/should_compile/T25611c.hs
- + testsuite/tests/indexed-types/should_compile/T25611d.hs
- testsuite/tests/indexed-types/should_compile/all.T
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c9920431542503cc9746f0c7923dada4ad418f96...50940a2f01654cb6a29f2064f2333fdc157824cb
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c9920431542503cc9746f0c7923dada4ad418f96...50940a2f01654cb6a29f2064f2333fdc157824cb
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/20250116/b81eb4aa/attachment.html>
More information about the ghc-commits
mailing list