Changes between Version 6 and Version 7 of Commentary/Compiler/Renamer
- Timestamp:
- 09/11/07 02:27:16 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Compiler/Renamer
v6 v7 44 44 -- An (OccEnv a) is a mapping from OccName to a 45 45 46 data GlobalRdrElt = GRE { gre_name :: Name, gre_prov :: Provenance } 46 data GlobalRdrElt = GRE { gre_name :: Name 47 , gre_prov :: Provenance 48 , gre_par :: Parent } 47 49 48 50 data Provenance = LocalDef | Imported [ImportSpec] 49 51 50 52 data ImportSpec = ImpSpec { is_decl :: ImpDeclSpec, is_item :: ImpItemSpec } 53 54 data Parent = NoParent | ParentIs Name 51 55 }}} 52 56 Here is how to understand these types: 53 57 * The environment (`GlobalRdrEnv`) maps an {{{OccName}}} to a list of all entities with that occurence name that are in scope (in any way). 58 54 59 * Each of these is represented by a {{{GlobalRdrElt}}}, which gives the entity's {{{Name}}} plus a specification of how it is in scope, its {{{Provenance}}}. 60 55 61 * The {{{Provenance}}} has one of two forms. Either it is in scope because it is defined in this module ({{{LocalDef}}}), or because it is imported. In the latter case, the {{{[ImportSpec]}}} describes all the import statements that bring it into scope. 62 56 63 * An {{{ImportSpec}}} has two components: 57 64 * An {{{ImpDeclSpec}}} that describes the entire import declaration. This is shared between all entities brought into scope by a particular import declaration. … … 62 69 }}} 63 70 the {{{ImpDeclSpec}}} would describe the {{{qualified}}} and {{{as}}} part, while the {{{ImpItemSpec}}} describes the {{{T(g)}}} part. You can look in {{{RdrName.lhs}}} to see what an {{{ImportDeclSpec}}} and {{{ImpItemSpec}}} are like! 71 * The {{{Parent}}} of an entity is the {{{Name}}} under which it is grouped when the forms `T(..)` or `T(C,D)` are used in an export or import list. In the `T(..)` form, all the things whose {{{Parent}}} is `T` are chosen. In the `T(C,D)` form, it is required that `C` and `D` have `T` as parents. 72 For example, 73 * The `Parent` of a data constructor is its data type 74 * The `Parent` of a record field selector is its data type 75 * The `Parent` of a class operation is its class 64 76 65 77 With all that information, we can give good error messages, especially in the case where an occurrence "f" is ambiguous (i.e. different entities, both called "f", were imported by diffferent import statements).
