• Ryan Scott's avatar
    Fix #16002 by moving a validity check to the renamer · 28f41f1a
    Ryan Scott authored
    Summary:
    The validity check which rejected things like:
    
    ```lang=haskell
    type family B x where
      A x = x
    ```
    
    Used to live in the typechecker. But it turns out that this validity
    check was //only// being run on closed type families without CUSKs!
    This meant that GHC would silently accept something like this:
    
    ```lang=haskell
    type family B (x :: *) :: * where
      A x = x
    ```
    
    This patch fixes the issue by moving this validity check to the
    renamer, where we can be sure that the check will //always// be run.
    
    Test Plan: make test TEST=T16002
    
    Reviewers: simonpj, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: goldfire, rwbarton, carter
    
    GHC Trac Issues: #16002
    
    Differential Revision: https://phabricator.haskell.org/D5420
    28f41f1a
TcTyClsDecls.hs 162 KB