Opened 2 years ago

Closed 2 years ago

#6120 closed bug (fixed)

GHC 7.4 improperly parses DEPRECATED pragma as ambiguous (regression)

Reported by: jmillikin Owned by: simonpj
Priority: normal Milestone:
Component: Compiler Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Difficulty: Unknown
Test Case: rename/should_compile/T6120 Blocked By:
Blocking: Related Tickets:

Description

According to http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/pragmas.html#warning-deprecated-pragma , a DEPRECATED pragma's name only refers to top-level symbols in the module being compiled. It appears that GHC 7.4 , this is no longer working correctly.

The following module works in GHC 6.10 through 7.2, but fails in 7.4.

module Main where

{-# DEPRECATED fail "fail is deprecated" #-}
fail :: String -> String
fail = id
$ /opt/ghc_7.2.2/bin/ghci deprecated.hs 
GHCi, version 7.2.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main             ( deprecated.hs, interpreted )
Ok, modules loaded: Main.
*Main> 
$ /opt/ghc_7.4.1/bin/ghci deprecated.hs 
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( deprecated.hs, interpreted )

deprecated.hs:3:16:
    Ambiguous occurrence `fail'
    It could refer to either `Main.fail', defined at deprecated.hs:5:1
                          or `Prelude.fail',
                             imported from `Prelude' at deprecated.hs:1:8-11
                             (and originally defined in `GHC.Base')
Failed, modules loaded: none.
Prelude> 

Change History (3)

comment:1 Changed 2 years ago by simonpj

  • Difficulty set to Unknown
  • Owner set to simonpj

I'm looking at this.

comment:2 Changed 2 years ago by simonpj@…

commit bc188bbdc506ac898092c87d2db3ff5f96ab4b92

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Thu May 24 12:28:58 2012 +0100

    Tidy up the treatment of signatures (incl fixity)
    
    This fixes Trac #6120.  I've added comments to explain.
    Turns out there was another lurking bug, also fixed,
    and tested in (an extended version of) th/T2713.

 compiler/rename/RnBinds.lhs  |   14 +++---
 compiler/rename/RnEnv.lhs    |   89 +++++++++++++++++++++++++++++-------------
 compiler/rename/RnSource.lhs |   22 +++++++----
 3 files changed, 83 insertions(+), 42 deletions(-)

comment:3 Changed 2 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to rename/should_compile/T6120

Thanks for pointing this out. Now fixed.

Note: See TracTickets for help on using tickets.