[GHC] #16097: Bad error message for a misaligned case block in a do-let expression

#16097: Bad error message for a misaligned case block in a do-let expression -------------------------------------+------------------------------------- Reporter: kanetw | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider the following code: {{{#!hs main = do code <- getCode let value = case code of 1 -> 2 3 -> 4 _ -> 5 print value }}} This is a parse error, as the indent of the case statements is under the indent introduced by let. However, the error message on 8.6 onwards is very misleading: {{{ /home/dkr/example/Bad.hs:2:8: error: Unexpected do block in function application: do code <- getCode let value = ... You could write it with parentheses Or perhaps you meant to enable BlockArguments? | 2 | main = do | ^^... }}} Compare this with 8.4, which is a bit less bad: {{{ /home/dkr/example/Bad.hs:5:6: error: parse error on input ‘1’ | 5 | 1 -> 2 | ^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16097 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16097: Bad error message for a misaligned case block in a do-let expression -------------------------------------+------------------------------------- Reporter: kanetw | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): I suspect (but haven't verified) that this is caused by the block arguments patch: be84823b956f0aa09c58d94d1901f2dff13546b4 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16097#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16097: Bad error message for a misaligned case block in a do-let expression -------------------------------------+------------------------------------- Reporter: kanetw | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by svenpanne): Replying to [comment:1 osa1]:
I suspect (but haven't verified) that this is caused by the block arguments patch: be84823b956f0aa09c58d94d1901f2dff13546b4
Well, confusion is the price you have to pay when you try to give more or less every sequence of characters a meaning... Introducing tons of conflicts into the parser should have been a clear warning sign that BlockArguments and quite a few of the recent "improvements" to the syntax are a bad idea. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16097#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16097: Bad error message for a misaligned case block in a do-let expression -------------------------------------+------------------------------------- Reporter: kanetw | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by j.waldmann): The error message ("in function application") is wrong? The underlined part (the "do") is not an application. Agree with svenpanne. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16097#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC