Skip to content

Comment delimiters ignored inside compiler pragma

GHC accepts some pragmas that are not valid comments because of embedded comment delimiters. If the delimiters are hidden inside an embedded comment or string, they are not recognized by the parser, but they should be according to the Haskell report. For example, the following has one opening and three closing comment delimiters, but is accepted by the parser.

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