Ticket #2993 (closed merge: fixed)

Opened 4 years ago

Last modified 4 years ago

Precedence errors are reported for undefined operators

Reported by: Olathe Owned by: igloo
Priority: normal Milestone:
Component: Compiler Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: rename/should_fail/T2993 Blocked By:
Blocking: Related Tickets:

Description

I found a misleading error message.

If I add the import for (<$>), but I forget to save the file

-- other imports
-- import Control.Applicative ((<$>))
main = print $ (+1).(+2) <$> Just 5

I get the error

    precedence parsing error
        cannot mix `(.)' [infixr 9] and `(<$>)' [infixl 9] in the same infix expression

which is rather hard to debug, since it makes it seem that the problem is either with Control.Applicative's precedence definitions or that I've somehow imported (<$>) with a different precedence from somewhere else.

It would be nice if it would report instead that (<$>) wasn't defined yet.

Change History

Changed 4 years ago by Olathe

It appears that (<$>) being undefined is reported in a later error message. I usually fix the first error reported, then move on to others, so it would be nice if it reported that it left out the precedence error for undefined operators entirely.

Changed 4 years ago by simonpj

  • owner set to igloo
  • difficulty set to Unknown
  • type changed from feature request to merge
  • testcase set to rename/should_fail/T2993

A good idea for a snowy day

Mon Feb  2 16:44:50 GMT 2009  simonpj@microsoft.com
  * Improve error reporting for precedence errors

Possibly worth merging. But watch out... TypeRep now exports funTyConName so there's an import patch to Haddock that must go too:

Mon Feb  2 16:47:42 GMT 2009  simonpj@microsoft.com
  * Hide funTyConName, now exported by TypeRep

Simon

Changed 4 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Both merged.

Note: See TracTickets for help on using tickets.