Skip to content
  • Ryan Scott's avatar
    Make typeToLHsType produce kind signatures for tycon applications · ebf8e076
    Ryan Scott authored
    Summary:
    `GeneralizedNewtypeDeriving` generates calls to `coerce`
    which take visible type arguments. These types must be produced by
    way of `typeToLHsType`, which converts a `Type` to an `LHsType`.
    However, `typeToLHsType` was leaving off important kind information
    when a `Type` contained a poly-kinded tycon application, leading to
    incorrectly generated code in #14579.
    
    This fixes the issue by tweaking `typeToLHsType` to generate
    explicit kind signatures for tycon applications. This makes the
    generated code noisier, but at least the program from #14579 now
    works correctly.
    
    Test Plan: make test TEST=T14579
    
    Reviewers: simonpj, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #14579
    
    Differential Revision: https://phabricator.haskell.org/D4264
    
    (cherry picked from commit 649e7772)
    ebf8e076