diff options
| author | Gintautas Miliauskas <gintautas.miliauskas@gmail.com> | 2014-10-29 23:14:17 -0500 |
|---|---|---|
| committer | Austin Seipp <austin@well-typed.com> | 2014-10-29 23:14:17 -0500 |
| commit | 45175e13edad452843207491d01cdbce0bedbbd4 (patch) | |
| tree | 521b1ad056cfe3fb063f66e7e604d313a7815ac9 | |
| parent | acb3295c69179159ba8230baff4104414c1db2c2 (diff) | |
| download | haskell-45175e13edad452843207491d01cdbce0bedbbd4.tar.gz | |
Extra CRs are now filtered out from the source file for :list.
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
| -rw-r--r-- | ghc/InteractiveUI.hs | 3 | ||||
| -rw-r--r-- | testsuite/tests/ghci/scripts/Makefile | 5 | ||||
| -rw-r--r-- | testsuite/tests/ghci/scripts/T9367-raw.stdout | 6 | ||||
| -rw-r--r-- | testsuite/tests/ghci/scripts/T9367.hs | 2 | ||||
| -rw-r--r-- | testsuite/tests/ghci/scripts/T9367.script | 4 | ||||
| -rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 4 |
6 files changed, 23 insertions, 1 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 3192d20857..ed4ea7bdfd 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -2934,7 +2934,8 @@ listModuleLine modl line = do 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) diff --git a/testsuite/tests/ghci/scripts/Makefile b/testsuite/tests/ghci/scripts/Makefile index 73f62036d7..873de43d09 100644 --- a/testsuite/tests/ghci/scripts/Makefile +++ b/testsuite/tests/ghci/scripts/Makefile @@ -39,3 +39,8 @@ ghci056_setup: 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 + diff --git a/testsuite/tests/ghci/scripts/T9367-raw.stdout b/testsuite/tests/ghci/scripts/T9367-raw.stdout new file mode 100644 index 0000000000..69da032d83 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9367-raw.stdout @@ -0,0 +1,6 @@ +Breakpoint 0 activated at T9367.hs:1:5-9
+"Stopped at T9367.hs:1:5-9
+_result :: [Char] = _
+1 x = "abc"
+ ^^^^^
+2 main = print x
diff --git a/testsuite/tests/ghci/scripts/T9367.hs b/testsuite/tests/ghci/scripts/T9367.hs new file mode 100644 index 0000000000..0f24fa497a --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9367.hs @@ -0,0 +1,2 @@ +x = "abc"
+main = print x
diff --git a/testsuite/tests/ghci/scripts/T9367.script b/testsuite/tests/ghci/scripts/T9367.script new file mode 100644 index 0000000000..afc89a8fe0 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9367.script @@ -0,0 +1,4 @@ +:l T9367 +:b 1 +:main +:list diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index ede9807d00..624f4310c1 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -43,6 +43,10 @@ test('ghci024', 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']) |
