<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.Code, li.Code, div.Code
        {mso-style-name:Code;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Richard<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">I’m on a train, so can’t look at the detail.  But the following thought occurs to me.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">uo_thing is a Maybe SDoc attached to a constraint.   But a constraint also has a stack of [ErrCtxt], captured in the CtLoc.  That’s what produces
 the “In the declaration for …” stuff.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Idea: instead of uo_thing, could we just push an extra ErrCtxt onto the stack, in the CtLoc for this constraint?  (Or not, in the Nothing case.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Simon<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></a></p>
<span style="mso-bookmark:_MailEndCompose"></span>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> noreply@phabricator.haskell.org [mailto:noreply@phabricator.haskell.org]
<br>
<b>Sent:</b> 18 July 2017 19:39<br>
<b>To:</b> Simon Peyton Jones <simonpj@microsoft.com><br>
<b>Subject:</b> [Differential] [Request, 533 lines] D3754: Refactor uo_thing<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="5" cellpadding="0">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
goldfire created this revision.<br>
Herald added subscribers: thomie, rwbarton.<br>
Herald added a reviewer: hvr. <o:p></o:p></p>
<p class="MsoNormal"><a href="https://phabricator.haskell.org/D3754"><b><span style="color:#464C5C;background:#F7F7F9;text-decoration:none">View Revision</span></b></a><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">REVISION SUMMARY</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<p>The uo_thing field of TypeEqOrigin is used to track the<br>
"thing" (either term or type) that has the type (kind) stored<br>
in the TypeEqOrigin fields. Previously, this was sometimes a<br>
proper Core Type, which needed zonking and tidying. Now, it<br>
is only HsSyn: much simpler, and the error messages now use<br>
the user-written syntax.<o:p></o:p></p>
<p>But this aspect of uo_thing didn't cause <a href="https://ghc.haskell.org/trac/ghc/ticket/13819">
<b>Trac #13819</b></a>; it was the<br>
sibling field uo_arity that did. uo_arity stored the number<br>
of arguments of uo_thing, useful when reporting something<br>
like "should have written 2 fewer arguments". We wouldn't want<br>
to say that if the thing didn't have two arguments. However,<br>
in practice, GHC was getting this wrong, and this message<br>
didn't seem all that helpful. Furthermore, the calculation<br>
of the number of arguments is what caused <a href="https://ghc.haskell.org/trac/ghc/ticket/13819">
<b>Trac #13819</b></a> to fall over.<br>
This patch just removes uo_arity. In my opinion, the change<br>
to error messages is a nudge in the right direction.<o:p></o:p></p>
<p>Test case: typecheck/should_fail/T13819<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">TEST PLAN</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<p>./validate<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">REPOSITORY</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">rGHC Glasgow Haskell Compiler<o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">BRANCH</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">wip/rae<o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">REVISION DETAIL</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><a href="https://phabricator.haskell.org/D3754">https://phabricator.haskell.org/D3754</a><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">AFFECTED FILES</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">compiler/ghci/RtClosureInspect.hs<br>
compiler/typecheck/Inst.hs<br>
compiler/typecheck/TcArrows.hs<br>
compiler/typecheck/TcErrors.hs<br>
compiler/typecheck/TcExpr.hs<br>
compiler/typecheck/TcHsType.hs<br>
compiler/typecheck/TcMType.hs<br>
compiler/typecheck/TcPat.hs<br>
compiler/typecheck/TcRnTypes.hs<br>
compiler/typecheck/TcSigs.hs<br>
compiler/typecheck/TcSplice.hs<br>
compiler/typecheck/TcSplice.hs-boot<br>
compiler/typecheck/TcTyClsDecls.hs<br>
compiler/typecheck/TcType.hs<br>
compiler/typecheck/TcUnify.hs<br>
compiler/typecheck/TcUnify.hs-boot<br>
compiler/types/Type.hs<br>
testsuite/tests/indexed-types/should_fail/T12867.stderr<br>
testsuite/tests/polykinds/T12593.stderr<br>
testsuite/tests/polykinds/T6039.stderr<br>
testsuite/tests/polykinds/T7278.stderr<br>
testsuite/tests/polykinds/T8616.stderr<br>
testsuite/tests/polykinds/T9200b.stderr<br>
testsuite/tests/rename/should_fail/rnfail026.stderr<br>
testsuite/tests/th/T3177a.stderr<br>
testsuite/tests/typecheck/should_fail/T11356.stderr<br>
testsuite/tests/typecheck/should_fail/T11672.stderr<br>
testsuite/tests/typecheck/should_fail/T12785b.stderr<br>
testsuite/tests/typecheck/should_fail/T13819.hs<br>
testsuite/tests/typecheck/should_fail/T13819.stderr<br>
testsuite/tests/typecheck/should_fail/T2994.stderr<br>
testsuite/tests/typecheck/should_fail/T3540.stderr<br>
testsuite/tests/typecheck/should_fail/T4875.stderr<br>
testsuite/tests/typecheck/should_fail/T7609.stderr<br>
testsuite/tests/typecheck/should_fail/T7778.stderr<br>
testsuite/tests/typecheck/should_fail/all.T<br>
testsuite/tests/typecheck/should_fail/tcfail070.stderr<br>
testsuite/tests/typecheck/should_fail/tcfail078.stderr<br>
testsuite/tests/typecheck/should_fail/tcfail113.stderr<br>
testsuite/tests/typecheck/should_fail/tcfail123.stderr<br>
testsuite/tests/typecheck/should_fail/tcfail132.stderr<o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">EMAIL PREFERENCES</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><a href="https://phabricator.haskell.org/settings/panel/emailpreferences/">https://phabricator.haskell.org/settings/panel/emailpreferences/</a><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">To:
</span></strong><span style="font-size:10.0pt;font-family:"Calibri",sans-serif">goldfire, simonpj, austin, bgamari, hvr<br>
<strong><span style="font-family:"Calibri",sans-serif">Cc: </span></strong>rwbarton, thomie, Mikolaj, fryguybob, carter, mpickering, adamgundry<o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>