Ticket #7469 (closed bug: invalid)

Opened 6 months ago

Last modified 6 months ago

GHC does not report name clashes in export lists

Reported by: Feuerbach Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Cc: roma@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

module A where

a = undefined

module B (a, module A) where

import qualified A

a = undefined

There is a name clash here which GHC does not report.

Change History

Changed 6 months ago by diatchki

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

This is not a bug: exports of the form module A have slightly complex semantics. They only export entities that are in scope with both a qualified and an unqualified name. In this case A is imported qualified, so there are no unqualified names for its entities and thus the module A exports nothing, so there is no conflict. Indeed, if you load the program with -Wall GHC warns that export A exports nothing.

For the full description take a look at Section 5.2 of the Haskell report or the paper "A Formal Specification Of the Haskell 98 Module System".

Cheers, Iavor

Changed 6 months ago by Feuerbach

Wow. I read the standard, but obviously didn't pay enough attention to the details. Thanks a lot, Iavor!

Note: See TracTickets for help on using tickets.