Opened 4 years ago

Closed 4 years ago

#4055 closed bug (duplicate)

Incorrect parsing of declarations

Reported by: diatchki Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 6.12.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

GHC's parser seems to accept incorrect Haskell programs, which leads to very confusing error messages. Here is an example:

f x = T
 
g 1 = 10
g x

data T = T

When trying to compile this GHC reports:

test.hs:1:6: Not in scope: data constructor `T'

This happened in much larger module, where I had forgotten to complete one of the equations for a function, but ended up looking for what is wrong with the (completely unrelated) "data" declaration.

This might be related to Template Haskell because a smaller example---a file containing only the literal 1---results in complaints about some template Haskell type not being in the Num class.

I am compiling the module without any pragmas or flags, so I would not think that TH is enabled.

Change History (1)

comment:1 Changed 4 years ago by simonpj

  • Resolution set to duplicate
  • Status changed from new to closed

Yes, this is a dup of #4042, which I fixed last week. It's because the naked (g x) is taken as a splice. Now fixed

Simon

Note: See TracTickets for help on using tickets.