Changes between Version 61 and Version 62 of Records/OverloadedRecordFields/Implementation


Ignore:
Timestamp:
Sep 3, 2013 4:35:21 PM (7 months ago)
Author:
adamgundry
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Implementation

    v61 v62  
    137137== Unused imports == 
    138138 
    139 Unused imports and generation of the minimal import list (`RnNames.warnUnusedImportDecls`) use a map from selector names to labels, in order to print fields correctly. However, fields may currently be reported as unused even if the corresponding Has instance is used. Consider the following: 
     139Unused imports and generation of the minimal import list (`RnNames.warnUnusedImportDecls`) use a map from selector names to labels, in order to print fields correctly. Moreover, consider the following: 
    140140 
    141141{{{ 
     
    156156Now, do we expect to report the 'x' in S(x) import as unused?  Actually the entire 'import B' is unused.  Only the typechecker will eventually know that. 
    157157 
    158 '''AMG''' How can we get this information out of the typechecker? 
     158To record this, I've added a new field `tcg_used_selectors :: TcRef NameSet` to the `TcGblEnv`, which records the selector names for fields that are encountered during typechecking (when looking up a `Has` instance etc.). This set is used to calculate the import usage and unused top-level bindings. Thus a field will be counted as used if it is needed by the typechecker, regardless of whether any definitions it appears in are themselves used. 
     159 
     160'''AMG''' One problem remains: typechecking the instances generated for a field counts as a use of that field! So all locally defined overloaded fields will be counted as used. 
     161 
    159162 
    160163 
     
    232235== Outstanding bugs == 
    233236 
    234 * generics/GenDerivOutput, GenDerivOutput1_0, GenDerivOutput1_1 (revert changed behaviour of `-ddump-deriv`) 
    235237* typechecker/should_fail/tcfail102 (changed error message) 
    236238 
     
    241243* Add `HsVarOut RdrName id` instead of `HsSingleRecFld` (or perhaps rename `HsVar` to `HsVarIn`)? This would also be useful to recall how the user referred to something. 
    242244 
    243 * Support virtual fields or forbid them? 
    244 * Sort out reporting of unused imports. 
     245* Fix reporting of unused local field definitions. 
     246* Only do magic instance lookup when the extension is enabled? 
    245247* Haddock omits fields from HTML index and prints selector names in LaTeX exports list. 
    246248