Ticket #7164 (closed bug: fixed)

Opened 9 months ago

Last modified 9 months ago

Confusing "not a (visible) method" warning when method name clashes with another definition

Reported by: joeyadams Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Difficulty: Unknown
Test Case: rename/should_fail/T7164 Blocked By:
Blocking: Related Tickets:

Description

Given this code:

class Foo m where
    herp :: (a -> a) -> m b -> m b
    derp :: m a

derp :: Int
derp = 123

GHC 7.4.1, 7.4.2, and 7.6.0.20120810 (rc1) produce the following output:

not-visible-method.hs:3:5:
    `derp' is not a (visible) method of class `Foo'

not-visible-method.hs:6:1:
    Multiple declarations of `derp'
    Declared at: not-visible-method.hs:3:5
                 not-visible-method.hs:6:1

The second error makes sense, but the first one is bogus. I'm defining class Foo! If I remove the clashing derp, the module compiles.

GHC 7.0.3 and 7.2.2 produce the correct output.

Change History

Changed 9 months ago by simonpj@…

commit 2c6d11fa17ff5cab7d62e6dbea3fc9e501fce7f3

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Tue Aug 21 14:35:12 2012 +0100

    Re-jig the reporting of names bound multiple times
    
    Fixes Trac #7164

 compiler/basicTypes/RdrName.lhs |   21 ++++++++++-----------
 compiler/main/HscTypes.lhs      |    3 ++-
 compiler/rename/RnEnv.lhs       |    7 +++++--
 compiler/rename/RnNames.lhs     |    5 +++--
 4 files changed, 20 insertions(+), 16 deletions(-)

Changed 9 months ago by simonpj

  • status changed from new to merge
  • difficulty set to Unknown
  • testcase set to rename/should_fail/T7164

Changed 9 months ago by pcapriotti

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

Merged as 87511d1ca0f4be6df208287c2a6c84aa85f45b70.

Note: See TracTickets for help on using tickets.