Skip to content

Draft: Do not assume if/then/else accepts Bool in HPC

lierdakil requested to merge trac-lierdakil/ghc:lierdakil/fix-20568 into ghc-8.10

HPC code assumes if/then/else accepts Bool as a condition. With RebindableSyntax, this not necessarily correct. Hence, when HsIf is using RebindableSyntax, it's better (i.e. formally correct) to treat HsIf similarly to HsApp.

Note: this issue doesn't happen on GHC 9 since rebindable if resolution was moved to the renamer phase.

Resolves #20568 (closed)

One concern I have is that I'm not adding any tics to the SyntaxExpr in cnd here. I actually don't know whether it's a good or a bad idea, but doing stuff to HsExpr inside SyntaxExpr is rather awkward, so I decided to leave it be for the time being.

I'm creating the MR fully expecting to get "sorry, we're not planning to maintain 8.10 much longer, and this is fixed in 9.0" reply. That'd be a little sad, but fair enough. In any case, I wanted to see if I can relatively easily fix this, and apparently the answer is "yes".

Edited by lierdakil

Merge request reports