Skip to content
  • Edward Z. Yang's avatar
    Deduplicate one-shot/make compile paths. · 427f8a15
    Edward Z. Yang authored
    
    
    Summary:
    We had a duplicate copy of the code for --make and for -c
    which was a pain.  The call graph looked something like this:
    
        compileOne -> genericHscCompileGetFrontendResult -> genericHscFrontend
                                       hscCompileOneShot ---^
    
    with genericHscCompileGetFrontendResult and hscCompileOneShot
    duplicating logic for deciding whether or not recompilation
    was needed.
    
    This patchset fixes it, so now everything goes through this call-chain:
    
        compileOne (--make entry point)
            Calls hscIncrementCompile, invokes the pipeline to do codegen
            and sets up linkables.
        hscIncrementalCompile (-c entry point)
            Calls hscIncrementalFrontend, and then simplifying,
            desugaring, and writing out the interface.
        hscIncrementalFrontend
            Performs recompilation avoidance, if recompilation needed,
            does parses typechecking.
    
    I also cleaned up some of the MergeBoot nonsense by introducing
    a FrontendResult type.
    
    NB: this BREAKS #8101 again, because I can't unconditionally desugar
    due to Haddock barfing on lint, see #10600
    
    Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: simonpj, bgamari, simonmar, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1302
    427f8a15