alanz / ghc-exactprint

GHC version of haskell-src-exts exactPrint
BSD 3-Clause "New" or "Revised" License
70 stars 32 forks source link

CPP preprocessing #25

Closed rubik closed 9 years ago

rubik commented 9 years ago

I had taken your Preprocess module and modified it a little to suit my needs for the Argon project. I had encountered a bug in CPP preprocessing, and I see now that it's mentioned in ghc-exactprint's readme.

This is the commit in which I fixed the problem: https://github.com/rubik/argon/commit/35ad16fab24e4be92948818ec137f48d1c3235ec

I annotated the commit diff to show exactly what changed. I could submit a PR if you want, but I'd need tests in order to verify my work.

mpickering commented 9 years ago

Please can you describe the bug you fixed?

rubik commented 9 years ago

Sometimes, when enabling CPP, the parsing failed even when the syntax was correct. The reason was that the updated DynFlags (updated during preprocessing) were discarded instead of being used for the parsing.

Example of the bug: https://github.com/rubik/argon/issues/14#issuecomment-152005234

mpickering commented 9 years ago

Yep, looks like a clear bug. A patch would be appreciated.