Opened 4 years ago

Closed 4 years ago

#8841 closed bug (fixed)

PatternSynonyms error gives wrong source locations

Reported by: Iceland_jack Owned by:
Priority: low Milestone: 7.8.1
Component: Compiler Version: 7.8.1-rc2
Keywords: PatternSynonyms Cc:
Operating System: Linux Architecture: x86
Type of failure: Incorrect warning at compile-time Test Case: patsyn/unidir
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Using an example from the GHC user's guide but omitting the argument to Maybe

{-# LANGUAGE PatternSynonyms #-}

data Type = App String [Type]

pattern Maybe = App "Maybe" [t]

gives the following error without the correct source locations

ghci> :load /tmp/failure.hs 
[1 of 1] Compiling Main             ( /tmp/failure.hs, interpreted )

/tmp/failure.hs:1:1:
    Right-hand side of bidirectional pattern synonym cannot be used as an expression
      App "Maybe" [t]
Failed, modules loaded: none.

Attachments (1)

failure.hs (98 bytes) - added by Iceland_jack 4 years ago.

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by Iceland_jack

Attachment: failure.hs added

comment:1 Changed 4 years ago by simonpj

Test Case: patsyn/unidir

comment:2 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In 96daafc3305a691590b88c1175a8f45e5d327471/ghc:

Attach the right location to pattern synonym error message (fixes Trac #8841)

comment:3 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In bf9bf602399eca30ca522ae5bae52d4f3ec1ab88/ghc:

Test for Trac #8841 now works

comment:4 Changed 4 years ago by simonpj

Status: newmerge

Easy fix, happily.

comment:5 Changed 4 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed

Merged in 7.8.

Note: See TracTickets for help on using tickets.