<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>



<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<h3>
 Marge Bot pushed to branch master
at <a href="https://gitlab.haskell.org/ghc/ghc">Glasgow Haskell Compiler / GHC</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/118e1c3da622f17c67b4e0fbc12ed7c7084055dc">118e1c3d</a></strong>
<div>
<span>by Alp Mestanogullari</span>
<i>at 2020-07-14T21:30:52-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">compiler: re-engineer the treatment of rebindable if

Executing on the plan described in #17582, this patch changes the way if expressions
are handled in the compiler in the presence of rebindable syntax. We get rid of the
SyntaxExpr field of HsIf and instead, when rebindable syntax is on, we rewrite the HsIf
node to the appropriate sequence of applications of the local `ifThenElse` function.

In order to be able to report good error messages, with expressions as they were
written by the user (and not as desugared by the renamer), we make use of TTG
extensions to extend GhcRn expression ASTs with an `HsExpansion` construct, which
keeps track of a source (GhcPs) expression and the desugared (GhcRn) expression that
it gives rise to. This way, we can typecheck the latter while reporting the former in
error messages.

In order to discard the error context lines that arise from typechecking the desugared
expressions (because they talk about expressions that the user has not written), we
carefully give a special treatment to the nodes fabricated by this new renaming-time
transformation when typechecking them. See Note [Rebindable syntax and HsExpansion]
for more details. The note also includes a recipe to apply the same treatment to
other rebindable constructs.

Tests 'rebindable11' and 'rebindable12' have been added to make sure we report
identical error messages as before this patch under various circumstances.

We also now disable rebindable syntax when processing untyped TH quotes, as per
the discussion in #18102 and document the interaction of rebindable syntax and
Template Haskell, both in Note [Template Haskell quotes and Rebindable Syntax]
and in the user guide, adding a test to make sure that we do not regress in
that regard.
</pre>
</li>
</ul>
<h4>30 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#5f4b3cf094f6e2fc46805a6c447613ae13a08942">
<span class="new-file">
+
compiler/GHC/Builtin/RebindableNames.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#cc97d81e7223ad4a3a5e801156ca632f9fa75654">
compiler/GHC/Hs/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#9f00edfedb0f969865b049a78de3866545b4a60b">
compiler/GHC/Hs/Instances.hs
</a>
</li>
<li class="file-stats">
<a href="#7a1af22e4c32b9aa6ec708d9d3788e1c4db5da9a">
compiler/GHC/Hs/Utils.hs
</a>
</li>
<li class="file-stats">
<a href="#e011edcbdb6414ff00022ab5c1eeee88906a53ab">
compiler/GHC/HsToCore/Coverage.hs
</a>
</li>
<li class="file-stats">
<a href="#6bdd5abc649727f2a802bc96ce5c276de19d3726">
compiler/GHC/HsToCore/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#085703923f9c18f6ac9f926ac9a4c7c7e6d9d9ed">
compiler/GHC/HsToCore/Match.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="#86d694037d496c511e28b2c09c8410f67dc19596">
compiler/GHC/Rename/Env.hs
</a>
</li>
<li class="file-stats">
<a href="#b47ece2bbb8303a5792c2fdc52394c8ed336e8a2">
compiler/GHC/Rename/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#16b273b96a1c03d4261e2ac6de4cc456ba2dd014">
compiler/GHC/Rename/Splice.hs
</a>
</li>
<li class="file-stats">
<a href="#902811828741e6bcd64702935bbb54edbbd070ef">
compiler/GHC/Tc/Gen/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#7dcf5b567a6cd3c9d98cf8d57323fbca1b1536e9">
compiler/GHC/Tc/Types.hs
</a>
</li>
<li class="file-stats">
<a href="#93bba9b9e0195db135fec54160523a427ea042fd">
compiler/GHC/Tc/Types/Origin.hs
</a>
</li>
<li class="file-stats">
<a href="#c6e4263ee64c68e57b7525127d98243fce38b1ea">
compiler/GHC/Tc/Utils/Monad.hs
</a>
</li>
<li class="file-stats">
<a href="#6a120b0673f8920127d8fffdaa16f01b90cc92d7">
compiler/GHC/Tc/Utils/Zonk.hs
</a>
</li>
<li class="file-stats">
<a href="#9b5f1671f007d547cf3b5ec40babeafdffb99b1a">
compiler/GHC/Types/SrcLoc.hs
</a>
</li>
<li class="file-stats">
<a href="#f35faa85de2e0a75cdaa452eb7336a09c677d450">
compiler/GHC/Utils/Binary.hs
</a>
</li>
<li class="file-stats">
<a href="#0f33fd88c617246c7f89c4477d2d1d24f942df23">
compiler/ghc.cabal.in
</a>
</li>
<li class="file-stats">
<a href="#f0474104bf5123c0904d8fa7745d89840c730d16">
docs/users_guide/exts/template_haskell.rst
</a>
</li>
<li class="file-stats">
<a href="#c30f4ac98f08779ad1bd5a02a27802862c1e9521">
ghc/GHCi/UI.hs
</a>
</li>
<li class="file-stats">
<a href="#0f814617086487f888918aa4c53eadb938e7a412">
ghc/GHCi/UI/Info.hs
</a>
</li>
<li class="file-stats">
<a href="#1ea60062936d861f059c546ee26b936b7eab1a65">
testsuite/tests/ghc-api/show-srcspan/showsrcspan.stdout
</a>
</li>
<li class="file-stats">
<a href="#d22f77fc8c4cf5de6acf34f8a183080973f0688d">
testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
</a>
</li>
<li class="file-stats">
<a href="#d0af5c870f431f527da62d336c841bc9bdcbc67e">
testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
</a>
</li>
<li class="file-stats">
<a href="#1ed99bff05e2a26e593dfb4d8bdba3460c51ea10">
testsuite/tests/rebindable/all.T
</a>
</li>
<li class="file-stats">
<a href="#67d1ceb9894cd86b24328b5f2f4220fb387248a0">
<span class="new-file">
+
testsuite/tests/rebindable/rebindable11.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#517df3346a8c8f84430cc3251ac0f45c64f3e4f8">
<span class="new-file">
+
testsuite/tests/rebindable/rebindable11.stderr
</span>
</a>
</li>
<li class="file-stats">
<a href="#31cbff6f2769bfad724702b5f49db6de01395bc3">
<span class="new-file">
+
testsuite/tests/rebindable/rebindable12.hs
</span>
</a>
</li>
</ul>
<h5>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: #777;">

<br>
<a href="https://gitlab.haskell.org/ghc/ghc/-/commit/118e1c3da622f17c67b4e0fbc12ed7c7084055dc">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.haskell.org.
If you'd like to receive fewer emails, you can
adjust your notification settings.
<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/118e1c3da622f17c67b4e0fbc12ed7c7084055dc"}}</script>


</p>
</div>
</body>
</html>