<div dir="ltr"><div>Hello all,</div><div><br></div><div>The typechecker doesn't preserve parenthesis that occur at the head of applications.<br><br>This results in some weird SrcSpans in the TypecheckedSource<br><br>For example, given code<br><br>foo a b c = (bar a) b c<br><br>The typechecker will emit an HsApp with head spanning over `bar a) b` and tail spanning over `c`.<br>Notice that the opening parenthesis is not included.<br><br>On the other hand, the renamer will generate the expected SrcSpans that always include both parenthesis, or neither. This becomes an issue when you want to associate RenamedSource with its corresponding TypecheckedSource, as the SrcSpans no longer match and overlap partially.<br><br>This occurs due to this line in TcExpr.hs<br><br>tcApp m_herald (L _ (HsPar _ fun)) args res_ty<br>  = tcApp m_herald fun args res_ty<br><br>I have a work in progress fix here: <a href="https://github.com/wz1000/ghc/commit/3b6db5a35dc8677a7187e349a85ffd51f452452a">https://github.com/wz1000/ghc/commit/3b6db5a35dc8677a7187e349a85ffd51f452452a</a></div><div><br></div><div>I have also created a ticket on trac: <a href="https://ghc.haskell.org/trac/ghc/ticket/15242#ticket">https://ghc.haskell.org/trac/ghc/ticket/15242#ticket</a><br></div></div>