Bugfix for bug 11632: `readLitChar` should consume null characters

Authored by kgupta on Jul 6 2016, 11:09 PM.



Changes functionality of readLitChar so that it consumes null characters \\& and ignores them. This is a fix for Bug Trac #11632.

Test Plan

The tests have been included. This change deals with a relatively minor edge case and should not break unrelated functionality.

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
kgupta updated this revision to Diff 8151.Jul 6 2016, 11:09 PM
kgupta retitled this revision from to Bugfix for bug 11632: `readLitChar` should consume null characters.
kgupta updated this object.
kgupta edited the test plan for this revision. (Show Details)
kgupta updated the Trac tickets for this revision.
kgupta added reviewers: thomie, GHC.
thomie edited reviewers, added: Core Libraries Committee; removed: GHC.Jul 7 2016, 7:30 AM
thomie set the repository for this revision to rGHC Glasgow Haskell Compiler.
thomie edited edge metadata.Jul 7 2016, 7:35 AM

This looks ok to me, but I'd like a sign off from someone on the CLC.


Fwiw: you could also write this as consumeEmpties = (string "\\&" >> consumeEmpties) <++ return ().

ekmett added a subscriber: ekmett.Jul 7 2016, 1:49 PM

LGTM. That is a remarkably subtle issue.

ekmett accepted this revision.Jul 7 2016, 1:49 PM
ekmett added a reviewer: ekmett.
This revision is now accepted and ready to land.Jul 7 2016, 1:49 PM
bgamari accepted this revision.Jul 8 2016, 7:14 AM
bgamari added a reviewer: bgamari.
bgamari added a subscriber: bgamari.

Looks reasonable to me as well. Thanks @kgupta!

This revision was automatically updated to reflect the committed changes.