[GHC] #8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi-line input
#8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi- line input ------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- As mentioned in ticket:8047#comment:1 GHCi exhibits a line-numbering offset bug when multi-line input is evaluated. Morever, when `:set +m` is active, `:{`-entered multi-input may trigger multi-line input continuation, e.g.: {{{ Prelude> :set +m Prelude> :{ Prelude| let x = () Prelude| y = () Prelude| :} Prelude| z = () Prelude| Prelude> }}} The attached patch fixes both issues, but does so in an admittedly hacky way... -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8051> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi- line input -------------------------------------+------------------------------------ Reporter: hvr | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by hvr): Btw, here's a minor fixlet for HEAD, which doesn't honor `prompt2` for `:set +m` multi-line input: {{{ #!diff diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 4bac5ad..7b10b65 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -790,7 +790,7 @@ checkInputForLayout stmt getStmt = do _other -> do st1 <- lift getGHCiState let p = prompt st1 - lift $ setGHCiState st1{ prompt = "%s| " } + lift $ setGHCiState st1{ prompt = prompt2 st1 } mb_stmt <- ghciHandle (\ex -> case fromException ex of Just UserInterrupt -> return Nothing _ -> case fromException ex of }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8051#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi- line input -------------------------------------+------------------------------------ Reporter: hvr | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by igloo): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8051#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi- line input -------------------------------------+------------------------------------ Reporter: hvr | Owner: Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: GHCi | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by thoughtpolice): * priority: normal => highest * version: 7.6.3 => 7.7 * milestone: => 7.8.1 Comment: Herbert, after attempting to merge this patch, it causes two `./validate` failures for me: {{{ $ make TEST="ghci023 ghci047" =====> ghci023(ghci) 2660 of 3765 [0, 0, 0] cd ./ghci/scripts && HC='/home/a/ghc/ghc-pristine/inplace/bin/ghc-stage2' HC_OPTS='-dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-history ' '/home/a/ghc/ghc-pristine/inplace/bin/ghc- stage2' --interactive -v0 -ignore-dot-ghci -dcore-lint -dcmm-lint -dno- debug-output -no-user-package-db -rtsopts -fno-ghci-history <ghci023.script >ghci023.run.stdout 2>ghci023.run.stderr Actual stderr output differs from expected: --- /dev/null 2013-08-15 19:58:16.771097011 -0500 +++ ./ghci/scripts/ghci023.run.stderr 2013-08-28 20:06:58.525350140 -0500 @@ -0,0 +1,4 @@ + +<interactive>:14:1: parse error on input `:' + +<interactive>:16:1: parse error on input `:' Actual stdout output differs from expected: --- ./ghci/scripts/ghci023.stdout 2013-08-22 11:29:40.617737462 -0500 +++ ./ghci/scripts/ghci023.run.stdout 2013-08-28 20:06:58.525350140 -0500 @@ -1,16 +1,5 @@ -- testing ghci multiline commands :{ .. :} -- via stdin (1,2,3) -data Maybe a = Nothing | Just a -Data.Maybe.catMaybes :: [Maybe a] -> [a] -Data.Maybe.fromJust :: Maybe a -> a -Data.Maybe.fromMaybe :: a -> Maybe a -> a -Data.Maybe.isJust :: Maybe a -> Bool -Data.Maybe.isNothing :: Maybe a -> Bool -Data.Maybe.listToMaybe :: [a] -> Maybe a -Data.Maybe.mapMaybe :: (a -> Maybe b) -> [a] -> [b] -maybe :: b -> (a -> b) -> Maybe a -> b -Data.Maybe.maybeToList :: Maybe a -> [a] -- via readFile (True,False) -id :: a -> a *** unexpected failure for ghci023(ghci) =====> ghci047(ghci) 2684 of 3765 [0, 1, 0] cd ./ghci/scripts && HC='/home/a/ghc/ghc-pristine/inplace/bin/ghc-stage2' HC_OPTS='-dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-history ' '/home/a/ghc/ghc-pristine/inplace/bin/ghc- stage2' --interactive -v0 -ignore-dot-ghci -dcore-lint -dcmm-lint -dno- debug-output -no-user-package-db -rtsopts -fno-ghci-history <ghci047.script >ghci047.run.stdout 2>ghci047.run.stderr Actual stderr output differs from expected: --- ./ghci/scripts/ghci047.stderr 2013-08-22 11:29:40.617737462 -0500 +++ ./ghci/scripts/ghci047.run.stderr 2013-08-28 20:06:58.701349185 -0500 @@ -1,16 +1,29 @@ -<interactive>:38:1: - Couldn't match type ‛HFalse’ with ‛HTrue’ - Expected type: HTrue - Actual type: Or HFalse HFalse - In the expression: f - In the expression: f $ Baz 'a' - In an equation for ‛it’: it = f $ Baz 'a' - -<interactive>:39:1: - Couldn't match type ‛HFalse’ with ‛HTrue’ - Expected type: HTrue - Actual type: Or HFalse HFalse - In the expression: f - In the expression: f $ Quz - In an equation for ‛it’: it = f $ Quz +<interactive>:14:1: parse error on input `data' + +<interactive>:35:58: + Not in scope: type constructor or class ‛ABorC’ + +<interactive>:36:1: Not in scope: ‛f’ + +<interactive>:36:5: Not in scope: data constructor ‛Foo’ + +<interactive>:37:1: Not in scope: ‛f’ + +<interactive>:37:5: Not in scope: data constructor ‛Bar’ + +<interactive>:38:1: Not in scope: ‛f’ + +<interactive>:38:5: Not in scope: data constructor ‛Baz’ + +<interactive>:39:1: Not in scope: ‛f’ + +<interactive>:39:5: Not in scope: data constructor ‛Quz’ + +<interactive>:40:1: Not in scope: ‛f’ + +<interactive>:40:5: Not in scope: data constructor ‛Yud’ + +<interactive>:41:1: Not in scope: ‛f’ + +<interactive>:41:5: Not in scope: data constructor ‛Myp’ Actual stdout output differs from expected: --- ./ghci/scripts/ghci047.stdout 2013-08-22 11:29:40.617737462 -0500 +++ ./ghci/scripts/ghci047.run.stdout 2013-08-28 20:06:58.585349815 -0500 @@ -1,4 +0,0 @@ -1 -1 -1 -1 *** unexpected failure for ghci047(ghci) Unexpected results from: TEST="ghci023 ghci047" OVERALL SUMMARY for test run started at Wed Aug 28 20:06:57 CDT 2013 3765 total tests, which gave rise to 14933 test cases, of which 14931 were skipped 0 had missing libraries 0 expected passes 0 expected failures 0 caused framework failures 0 unexpected passes 2 unexpected failures Unexpected failures: ghci/scripts ghci023 [bad stderr] (ghci) ghci/scripts ghci047 [bad stderr] (ghci) }}} Can you examine please? The failure to parse `data A` in `ghci047.script` seems to indicate to me this is a real failure or some very strange behavioral difference I don't understand at a glance. This bug also needs to be fixed for 7.8.1 for certain. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8051#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi- line input -------------------------------------+------------------------------------ Reporter: hvr | Owner: Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: GHCi | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:43111a0b58f5b2b4cf77b4119bef7b5f3b69d0b3/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="43111a0b58f5b2b4cf77b4119bef7b5f3b69d0b3" GHCi: Fix multi-line input line/column-number refs This commit addresses #8051 by fixing - Incorrect column indices reported in error messages for single-line and multi-line input, - incorrect line numbers reported in error messages for expressions entered in multi-line input, and - inhibiting the confusing interaction between `:{` and `:set +m` causing the triggering of implicit multi-line continuation mode right after `:}` terminates the multi-line entry block. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8051#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8051: GHCi: confusing `:set +m`/`:{` interaction & wrong line-numbers in multi- line input -------------------------------------+------------------------------------ Reporter: hvr | Owner: Type: bug | Status: closed Priority: highest | Milestone: 7.8.1 Component: GHCi | Version: 7.7 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Thanks for fixing this Herbert! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8051#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC