summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser/Lexer.x
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Parser/Lexer.x')
-rw-r--r--compiler/GHC/Parser/Lexer.x6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index 8b3c4eccea..a116aec66c 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -2172,10 +2172,12 @@ finish_char_tok buf loc ch -- We've already seen the closing quote
let src = lexemeToString buf (cur bufEnd - cur buf)
if magicHash then do
case alexGetChar' i of
- Just ('#',i@(AI end _)) -> do
+ Just ('#',i@(AI end bufEnd')) -> do
setInput i
+ -- Include the trailing # in SourceText
+ let src' = lexemeToString buf (cur bufEnd' - cur buf)
return (L (mkPsSpan loc end)
- (ITprimchar (SourceText src) ch))
+ (ITprimchar (SourceText src') ch))
_other ->
return (L (mkPsSpan loc end)
(ITchar (SourceText src) ch))