• Simon Peyton Jones's avatar
    Improve typechecking of let-bindings · 15b9bf4b
    Simon Peyton Jones authored
    This major commit was initially triggered by #11339, but it spiraled
    into a major review of the way in which type signatures for bindings
    are handled, especially partial type signatures.  On the way I fixed a
    number of other bugs, namely
       #12069
       #12033
       #11700
       #11339
       #11670
    
    The main change is that I completely reorganised the way in which type
    signatures in bindings are handled. The new story is in TcSigs
    Note [Overview of type signatures].  Some specific:
    
    * Changes in the data types for signatures in TcRnTypes:
      TcIdSigInfo and new TcIdSigInst
    
    * New module TcSigs deals with typechecking type signatures
      and pragmas. It contains code mostly moved from TcBinds,
      which is already too big
    
    * HsTypes: I swapped the nesting of HsWildCardBndrs
      and HsImplicitBndsrs, so that the wildcards are on the
      oustide not the insidde in a LHsSigWcType.  This is just
      a matter of convenient, nothing deep.
    
    There are a host of other changes as knock-on effects, and
    it all took FAR longer than I anticipated :-).  But it is
    a significant improvement, I think.
    
    Lots of error messages changed slightly, some just variants but
    some modest improvements.
    
    New tests
    
    * typecheck/should_compile
        * SigTyVars: a scoped-tyvar test
        * ExPat, ExPatFail: existential pattern bindings
        * T12069
        * T11700
        * T11339
    
    * partial-sigs/should_compile
        * T12033
        * T11339a
        * T11670
    
    One thing to check:
    
    * Small change to output from ghc-api/landmines.
      Need to check with Alan Zimmerman
    15b9bf4b
HsUtils.hs 45.6 KB