Opened 13 months ago

Last modified 9 months ago

#15849 merge bug

Error message: "Perhaps you need a let in a do block", when there is no do block.

Reported by: cdsmith Owned by: nineonine
Priority: normal Milestone: 8.8.1
Component: Compiler Version: 8.4.3
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: parser/should_fail/T15849
Blocked By: Blocking:
Related Tickets: Differential Rev(s): https://gitlab.haskell.org/ghc/ghc/merge_requests/330
Wiki Page:

Description

This code:

main = return ()
 foo = return ()

Gives the error message:

parse error on input ‘=’
    Perhaps you need a 'let' in a 'do' block?
    e.g. 'let x = 5' instead of 'x = 5'

But this isn't in a do block. It would be awesome if GHC checked whether there's a do block before giving a suggestion that depends on there being a do block.

Change History (5)

comment:1 Changed 13 months ago by bgamari

Keywords: newcomer added

comment:2 Changed 10 months ago by nineonine

Differential Rev(s): https://gitlab.haskell.org/ghc/ghc/merge_requests/330
Owner: set to nineonine

comment:3 Changed 10 months ago by nineonine

Status: newpatch

comment:4 Changed 10 months ago by RyanGlScott

Milestone: 8.8.1
Status: patchmerge
Test Case: parser/should_fail/T15849

Landed in a08f463bcc9727d91cec4c6e952ad0f5bbc3fbf9, marking as a merge candidate for 8.8.

comment:5 Changed 9 months ago by Marge Bot <ben+marge-bot@…>

In a08f463b/ghc:

Fix #15849 by checking whether there's a do block
Note: See TracTickets for help on using tickets.