• Rik Steenkamp's avatar
    Add `PatSynSigSkol` and modify `PatSynCtxt` · 997312b0
    Rik Steenkamp authored
    As the type of a pattern synonym cannot in general be represented by a
    value of type Type, we cannot use a value `SigSkol (PatSynCtxt n) (Check
    ty)` to represent the signature of a pattern synonym (this causes
    incorrect signatures to be printed in error messages). Therefore we now
    represent it by a value `PatSynSigSkol n` (instead of incorrect
    signatures we simply print no explicit signature).
    
    Furthermore, we rename `PatSynCtxt` to `PatSynBuilderCtxt`, and use
    `SigSkol (PatSynBuilderCtxt n) (Check ty)` to represent the type of a
    bidirectional pattern synonym when used in an expression context.
    Before, this type was represented by a value `SigSkol (PatSynCtxt n)
    (Check ty)`, which caused incorrect error messages.
    
    Also, in `mk_dict_err` of `typecheck\TcErrors.hs` we now distinguish
    between all enclosing implications and "useful" enclosing implications,
    for better error messages concerning pattern synonyms. See `Note [Useful
    implications]`.
    
    See the Phabricator page for examples.
    
    Reviewers: mpickering, goldfire, simonpj, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1967
    
    GHC Trac Issues: #11667
    997312b0
TcSimplify.hs 86.6 KB