Skip to content
  • Simon Marlow's avatar
    Fix a bug in SRT generation · d424d4a4
    Simon Marlow authored
    Summary:
    I had good intentions, but they were not being followed. In particular,
    this comment:
    
    ```
    ---  - we never resolve a reference to a CAF to the contents of its SRT, since
    ---    the point of SRTs is to keep CAFs alive.
    ```
    
    was not true, because we updated the srtMap after generating the SRT
    for a CAF. Therefore it was possible for another CAF to refer to an
    earlier CAF, and the reference to the earlier CAF would be shortcutted
    to refer to its SRT instead of pointing to the CAF itself.
    
    The fix is just to not update the srtMap when generating the SRT for a
    CAF, but I also refactored the code and comments around this to be a bit
    better organised.
    
    Test Plan: Harbourmaster
    
    Reviewers: bgamari, michalt, simonpj, erikd
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #15173, #15168
    
    Differential Revision: https://phabricator.haskell.org/D4721
    d424d4a4