LINE pragma behaviour

Alan & Kim Zimmerman alan.zimm at gmail.com
Mon Nov 22 20:16:58 UTC 2021


I am working through some ghc-exactprint test cases with GHC 9.2.1 and came
across an oddity.

If I parse some source with

{-# LINE 93 "Foo.chs" #-}

on line five, it shows up in the ParseSource as

(L
  (Anchor
   { LINE:5:1-25 }
   (UnchangedAnchor))
  (EpaComment
   (EpaLineComment
    "{-# LINE 93 \"Foo.chs\" #-}")
   { LINE:5:1-25 }))

and the following item locations are unchanged.

The effect seems to be to change the name of the file in the RealSrcSpan to
"LINE", but just for that line, and no other effect.

Is this expected?

Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20211122/e801e890/attachment.html>


More information about the ghc-devs mailing list