[project @ 2003-02-20 13:21:15 by simonpj]
-------------------------------------
Generate correct dependencies when reading External Core
-------------------------------------
We have to be more careful than I realised when doing strongly-connected
component analysis of type/class decls when reading External Core.
Here's the relevant new comment:
-- Building edges for SCC analysis
--
-- When building the edges, we treat the 'main name' of the declaration as the
-- key for the node, but when dealing with External Core we may come across
-- references to one of the implicit names for the declaration. For example:
-- class Eq a where ....
-- data :TSig a = :TSig (:TEq a) ....
-- The first decl is sucked in from an interface file; the second
-- is in an External Core file, generated from a class decl for Sig.
-- We have to recognise that the reference to :TEq represents a
-- dependency on the class Eq declaration, else the SCC stuff won't work right.
--
-- This complication can only happen when consuming an External Core file
--
-- Solution: keep an "EdgeMap" (bad name) that maps :TEq -> Eq.
-- Don't worry about data constructors, because we're only building
-- SCCs for type and class declarations here. So the tiresome mapping
-- is need only to map [class tycon -> class]