• eir@cis.upenn.edu's avatar
    Reshuffle levity polymorphism checks. · 8906e7b7
    eir@cis.upenn.edu authored
    Previously, GHC checked for bad levity polymorphism to the left of all
    arrows in data constructors. This was wrong, as reported in #12911
    (where an example is also shown). The solution is to check each
    individual argument for bad levity polymorphism.  Thus the check has
    been moved from TcValidity to TcTyClsDecls.
    
    A similar situation exists with pattern synonyms, also fixed here.
    
    This patch also nabs #12819 while I was in town.
    
    Test cases: typecheck/should_compile/T12911, patsyn/should_fail/T12819
    
    Test Plan: ./validate
    
    Reviewers: simonpj, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2783
    
    GHC Trac Issues: #12819, #12911
    8906e7b7
TcSigs.hs 29.4 KB