[GHC] #9914: Inconsistent handling of leading whitespace in GHCi
#9914: Inconsistent handling of leading whitespace in GHCi -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Parser) | Version: 7.8.3 Keywords: GHCi | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: GHC Blocked By: | rejects valid program Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- In GHCi, the following three lines all work as expected: {{{ λ» let x = 1 λ» x 1 λ» let x = 2 -- Note leading whitespace λ» x 2 λ» data Foo = Foo λ» :i Foo data Foo = Foo -- Defined at <interactive>:6:1 }}} However, this fails: {{{ λ» data Bar = Bar -- Note leading whitespace <interactive>:8:2: parse error on input ‘data’ }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9914> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9914: Inconsistent handling of leading whitespace in GHCi -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Parser) | Keywords: GHCi Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): A simple fix would be to change {{{`isPrefixOf` stmt}}} to {{{`isPrefixOf` removeSpaces stmt}}} (or just `dropWhile isSpace`) in two places in `InteractiveUI.runStmt`. It may be nicer to `removeSpaces` before calling to `runStmt`, but that might not work for multiline commands, not sure what kind of layout rules those have. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9914#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9914: Inconsistent handling of leading whitespace in GHCi -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Parser) | Keywords: GHCi Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Dr. ERDI Gergo <gergo@…>): In [changeset:"707fb3aa2b058cb4245708d6a63019b3e32f795c/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="707fb3aa2b058cb4245708d6a63019b3e32f795c" Strip leading whitespace before checking if a statement looks like a declaration (fixes #9914) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9914#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9914: Inconsistent handling of leading whitespace in GHCi -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (Parser) | Keywords: GHCi Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by cactus): * status: new => merge * milestone: => 7.8.4 Comment: That's exactly what I ended up doing. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9914#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9914: Inconsistent handling of leading whitespace in GHCi -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.3 (Parser) | Keywords: GHCi Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * milestone: 7.8.4 => 7.10.1 Comment: 7.8.4 is already done; closing. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9914#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9914: Inconsistent handling of leading whitespace in GHCi -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.3 (Parser) | Keywords: GHCi Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9914#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC