Fixes #9367.
Reviewers: austin
Reviewed By: austin
Subscribers: #ghc_windows_task_force, thomie, carter, simonmar
Differential Revision: https://phabricator.haskell.org/D382
GHC Trac Issues: #9367
listAround :: MonadIO m => RealSrcSpan -> Bool -> InputT m ()
listAround pan do_highlight = do
contents <- liftIO $ BS.readFile (unpackFS file)
- let ls = BS.split '\n' contents
+ -- Drop carriage returns to avoid duplicates, see #9367.
+ let ls = BS.split '\n' $ BS.filter (/= '\r') contents
ls' = take (line2 - line1 + 1 + pad_before + pad_after) $
drop (line1 - 1 - pad_before) $ ls
fst_line = max 1 (line1 - pad_before)
T6106_prep:
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make T6106_preproc
+.PHONY: T9367
+T9367:
+ '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci < T9367.script > T9367-raw.run.stdout
+ cmp T9367-raw.run.stdout T9367-raw.stdout
+
--- /dev/null
+Breakpoint 0 activated at T9367.hs:1:5-9\r
+"Stopped at T9367.hs:1:5-9\r
+_result :: [Char] = _\r
+1 x = "abc"\r
+ ^^^^^\r
+2 main = print x\r
--- /dev/null
+x = "abc"\r
+main = print x\r
--- /dev/null
+:l T9367
+:b 1
+:main
+:list
when(fast(), skip),
run_command,
['$MAKE -s --no-print-directory ghci024'])
+test('T9367',
+ when(fast() or config.os != 'mingw32', skip),
+ run_command,
+ ['$MAKE -s --no-print-directory T9367'])
test('ghci025', normal, ghci_script, ['ghci025.script'])
test('ghci026', normal, ghci_script, ['ghci026.script'])