Skip to content

unicode digits misparsed in escape sequences

*> "\₁"
*** Exception: parser/Ctype.lhs:(91,13)-(347,35): Non-exhaustive patterns in case

*> "\๔"
*** Exception: parser/Ctype.lhs:(91,13)-(347,35): Non-exhaustive patterns in case

I haven't seen ghc's code, but I bet it uses something like let (digits, str') = span isDigit str in chr (read digits) : parse str' to process escape sequences in string/character literals. This is broken because isDigit returns True for a lot of non-['0'..'9'] characters, such as subscripts, Thai digits, double-wide digits, etc.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information