[project @ 2003-02-20 13:21:15 by simonpj]
authorsimonpj <unknown>
Thu, 20 Feb 2003 13:21:15 +0000 (13:21 +0000)
committersimonpj <unknown>
Thu, 20 Feb 2003 13:21:15 +0000 (13:21 +0000)
commit72c98446f1a74a1e1072ed115662a56a1e2769b4
treed2aa98af7dded8bb3fd5e98e90d8bffa99b0a131
parent97958a3981cf8eb79e93ed644ae45d6e272a8b74
[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]
ghc/compiler/typecheck/TcTyClsDecls.lhs