[GHC] #11751: Parse error with case in where

#11751: Parse error with case in where ----------------------------------------+--------------------------------- Reporter: samuela | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: ----------------------------------------+--------------------------------- The following code produces a peculiar parse error: {{{#!hs subtype = 0 where (x, y) = case (1, 2) of (a, b) -> (3, 4) }}} `parse_error.hs:3:5: parse error on input ‘(’` -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11751 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11751: Parse error with case in where -------------------------------------+------------------------------------- Reporter: samuela | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * failure: None/Unknown => Incorrect warning at compile-time * component: Compiler => Compiler (Parser) Comment: Thanks for the report. That being said, I'm not sure I see why do you say it's peculiar. It seems like quite a reasonable error to me: The `case` alternative falls outside of the virtual close-bracket delimiting the `where` clause due to its indentation. In particular, the fragment `(a, b) -> (3, 4)` * cannot be parsed as a case alternative (due to being "outside" of the `case` expression) * cannot be parsed as a binding (since it also falls outside of the `where` clause (again, since it has decreasing indentation) * cannot be a top-level binding (due to the `->`) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11751#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11751: Parse error with case in where -------------------------------------+------------------------------------- Reporter: samuela | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by samuela): Ah, I understand now. Sorry for the confusion! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11751#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11751: Parse error with case in where -------------------------------------+------------------------------------- Reporter: samuela | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: invalid | Keywords: Operating System: MacOS X | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by samuela): * status: new => closed * resolution: => invalid -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11751#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC