Skip to content
  • Richard Eisenberg's avatar
    Refactor kindGeneralize and friends · d9c6b86e
    Richard Eisenberg authored and Marge Bot's avatar Marge Bot committed
    This commit should have no change in behavior.(*)
    
    The observation was that Note [Recipe for checking a signature]
    says that every metavariable in a type-checked type must either
      (A) be generalized
      (B) be promoted
      (C) be zapped.
    Yet the code paths for doing these were all somewhat separate.
    This led to some steps being skipped. This commit shores this
    all up. The key innovation is TcHsType.kindGeneralizeSome, with
    appropriate commentary.
    
    This commit also sets the stage for #15809, by turning the
    WARNing about bad level-numbers in generalisation into an
    ASSERTion. The actual fix for #15809 will be in a separate
    commit.
    
    Other changes:
     * zonkPromoteType is now replaced by kindGeneralizeNone.
       This might have a small performance degradation, because
       zonkPromoteType zonked and promoted all at once. The new
       code path promotes first, and then zonks.
    
     * A call to kindGeneralizeNone was added in tcHsPartialSigType.
       I think this was a lurking bug, because it ...
    d9c6b86e