Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addAnnotationsForPretty doesn't play nicely with do blocks #80

Open
isovector opened this issue Aug 23, 2019 · 0 comments
Open

addAnnotationsForPretty doesn't play nicely with do blocks #80

isovector opened this issue Aug 23, 2019 · 0 comments

Comments

@isovector
Copy link

isovector commented Aug 23, 2019

addAnnotationsForPretty inserts a leading space for HsVars (or RdrNames, I haven't dug in). This is the wrong thing to do in the case of a BodyStmt, which will break the do block's layout.

Consider this:

foo = do
  a

and we want to append a new noLoc $ BodyStmt _ (noLoc $ HsVar _ (noLoc $ Unqual "b") _ _ for b into the do block. After making new source spans for the noLocs, wen can call addAnnotationsForPretty, on the BodyStmt above, but printing this is:

foo = do
  a
   b

which is a parse error :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant