<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style="--code-editor-font: GitLab Mono, JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>
<style>img {
max-width: 100%; height: auto;
}
body {
font-size: 0.875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px;
}
body {
font-family: "GitLab Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px; font-family: "GitLab Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";'>
<div class="content">
<h3 style="margin-top: 20px; margin-bottom: 10px;">
Ryan Scott pushed to branch wip/T23496-take-three at <a href="https://gitlab.haskell.org/ghc/ghc">Glasgow Haskell Compiler / GHC</a>
</h3>
<h4 style="margin-top: 10px; margin-bottom: 10px;">
Commits:
</h4>
<ul>
<li>
<strong style="font-weight: bold;"><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/c7f165cb75d93ca2662ddf802cd4139a8a8a95af">c7f165cb</a></strong>
<div>
<span> by Ryan Scott </span> <i> at 2023-08-03T08:14:10-04:00 </i>
</div>
<pre class="commit-message" style='white-space: pre-wrap; display: block; font-size: 14px; color: #333238; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; border-radius: 2px; margin: 0; padding: 8px 12px; border: 1px solid #dcdcde;'>deriving: Typecheck associated family instances before instance bindings
This is a significant overhaul of the way that `deriving` clauses and
standalone `deriving` declarations are typechecked. The highlights:
* Standalone `deriving` declarations are located in the new `DerivInstD`
constructor of `ClsInstDecl`, rather than as part of the `DerivD` constructor
of `HsGroup`. This move now means that standalone `deriving` instance
declarations are located alongside other forms of instance declarations,
which makes it easier to perform SCC analysis on them, as they are now part
of a `TyClGroup`.
* Now that everything `deriving`-related lives in `TyClGroup`s, we now
typecheck all of the associated type family instances that are generated from
`deriving` clauses/declarations first (in `tcTyClGroup`) _before_
typechecking any of the generated instance bindings, which happen after all
of the `TyClGroup`s have been processed. Doing so is essential to ensuring
that these associated type instances are in scope when needed to typecheck
other code in later `TyClGroup`s, such as the failing examples seen
in #23496. I have written an extensive `Note [Staging of deriving]` (previously
`Note [Staging of tcDeriving]`) to describe how everything works.
The second bullet point above involves quite a bit of churn in the expected
output of several test cases. This is for two reasons:
1. The order in which things are printed with `-ddump-deriv` is now different,
since `deriving`-related family instances are now generated earlier in the
typechecker.
2. If a test case errors out when typechecking a `deriving`-related family
instance, then GHC will stop there before printing any errors involving the
generated instance bindings. (Previously, both sorts of errors were printed
simultaneously.) As such, some expected-to-fail test cases do not print out
as many errors as before.
Fixes #23496.
</pre>
</li>
</ul>
<h4 style="margin-top: 10px; margin-bottom: 10px;">
30 changed files:
</h4>
<ul>
<li class="file-stats">
<a href="#75bfcd03f3ba9315d33104fcb0424c6bfeb4e334">
compiler/GHC/Hs/Decls.hs
</a>
</li>
<li class="file-stats">
<a href="#9f00edfedb0f969865b049a78de3866545b4a60b">
compiler/GHC/Hs/Instances.hs
</a>
</li>
<li class="file-stats">
<a href="#9f8f154268a51dc39e1f608e6d9845fdae82d480">
compiler/GHC/Hs/Stats.hs
</a>
</li>
<li class="file-stats">
<a href="#7a1af22e4c32b9aa6ec708d9d3788e1c4db5da9a">
compiler/GHC/Hs/Utils.hs
</a>
</li>
<li class="file-stats">
<a href="#ea46b374e004d4416e29a563ee063542f98e48c5">
compiler/GHC/HsToCore/Docs.hs
</a>
</li>
<li class="file-stats">
<a href="#3c19c0be465f9a28d7b69f89c55648080fcc37eb">
compiler/GHC/HsToCore/Quote.hs
</a>
</li>
<li class="file-stats">
<a href="#649144a78135a23cabfc90dd83c4aabf448eb6ab">
compiler/GHC/Iface/Ext/Ast.hs
</a>
</li>
<li class="file-stats">
<a href="#bf951467d4a9aa443cb109cb4c84a2891945649b">
compiler/GHC/Parser.y
</a>
</li>
<li class="file-stats">
<a href="#7dd1cd0f6f2164a14c83d9aa564dd32bc30e447a">
compiler/GHC/Rename/Module.hs
</a>
</li>
<li class="file-stats">
<a href="#e05ee69330b0f7088f11a5f3567137547489664d">
compiler/GHC/Rename/Names.hs
</a>
</li>
<li class="file-stats">
<a href="#b768fdf8e0594bf98104ef18145fc9f16550bc06">
compiler/GHC/Tc/Deriv.hs
</a>
</li>
<li class="file-stats">
<a href="#e9a44bb2cab837a54e2701986ac773e814e49eab">
compiler/GHC/Tc/Deriv/Utils.hs
</a>
</li>
<li class="file-stats">
<a href="#e65390fa5a32c453a81a1c9a3e1c4464d155ca4a">
compiler/GHC/Tc/Module.hs
</a>
</li>
<li class="file-stats">
<a href="#83d23a46bb6cdc8b1edc16f1fd2c8f5c53e2c9ca">
compiler/GHC/Tc/TyCl.hs
</a>
</li>
<li class="file-stats">
<a href="#e63425e031ffe9350ee6b1687e506aaea75d11e1">
compiler/GHC/Tc/TyCl/Instance.hs
</a>
</li>
<li class="file-stats">
<a href="#f04235bf859e624dffc011ef839bc10f854d8bf9">
compiler/GHC/Tc/TyCl/Instance.hs-boot
</a>
</li>
<li class="file-stats">
<a href="#f021c52a6ccf306e88c9f760b2aee33b180ba341">
compiler/GHC/Tc/Utils/Env.hs
</a>
</li>
<li class="file-stats">
<a href="#2eac51f9871ca0c0698aa1fc7f79c05ef8fc4a49">
compiler/GHC/ThToHs.hs
</a>
</li>
<li class="file-stats">
<a href="#997b81d43f8807b1b83ca6cc7c52b367982f2bf7">
compiler/Language/Haskell/Syntax/Decls.hs
</a>
</li>
<li class="file-stats">
<a href="#55fd4da29695073f23c02f21476e753eb7c467b4">
compiler/Language/Haskell/Syntax/Extension.hs
</a>
</li>
<li class="file-stats">
<a href="#26a9d6f140e598282df305f6a78ee2a2b07c3174">
libraries/base/GHC/Generics/Internal.hs
</a>
</li>
<li class="file-stats">
<a href="#993a6c64163e88bb2350df8be5df8c9aff800b73">
testsuite/tests/deriving/should_compile/T11068_aggressive.stderr
</a>
</li>
<li class="file-stats">
<a href="#d67e8c37b660b851784cafe36eb0327428012ff0">
testsuite/tests/deriving/should_compile/T14578.stderr
</a>
</li>
<li class="file-stats">
<a href="#1ba015f3ba3d29833c39cd76809b7794c6f137db">
testsuite/tests/deriving/should_compile/T14579.stderr
</a>
</li>
<li class="file-stats">
<a href="#06967d756dfba1325ba9737fb582269070a77b61">
testsuite/tests/deriving/should_compile/T14682.stderr
</a>
</li>
<li class="file-stats">
<a href="#f67cc79d7589f8c27fc112f3861c9b67b64c21dc">
testsuite/tests/deriving/should_compile/T17240.stderr
</a>
</li>
<li class="file-stats">
<a href="#0f0c88124a53b080068ea16a6ebb02998f38d5b5">
<span class="new-file">
+
testsuite/tests/deriving/should_compile/T23496a.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#7f26e04a5d3a231384ac834fcee90ecb50a1ba64">
<span class="new-file">
+
testsuite/tests/deriving/should_compile/T23496b.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#e7bc29da08da2be1b3bd264c751322dc3e8c1905">
testsuite/tests/deriving/should_compile/all.T
</a>
</li>
<li class="file-stats">
<a href="#03f37b664b8d39fa3a162ae50b5010c251ebcebc">
testsuite/tests/deriving/should_compile/drv-empty-data.stderr
</a>
</li>
</ul>
<h5 style="margin-top: 10px; margin-bottom: 10px; font-size: 0.875rem;">
The diff was not included because it is too large.
</h5>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #737278;">
—
<br>
<a href="https://gitlab.haskell.org/ghc/ghc/-/commit/c7f165cb75d93ca2662ddf802cd4139a8a8a95af">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.haskell.org">gitlab.haskell.org</a>. <a href="https://gitlab.haskell.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.haskell.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.haskell.org/ghc/ghc/-/commit/c7f165cb75d93ca2662ddf802cd4139a8a8a95af"}}</script>
</p>
</div>
</body>
</html>