Fix #15941 by only special-casing visible infix applications
ClosedPublic

Authored by RyanGlScott on Nov 24 2018, 6:47 AM.

Details

Summary

The iface pretty-printer had a special case for an
application of an infix type constructor to two arguments. But this
didn't take the visibilities of the arguments into account, which
could lead to strange output like @{LiftedRep} -> @{LiftedRep} when
-fprint-explicit-kinds was enabled (Trac #15941). The fix is relatively
straightforward: simply plumb through the visibilities of each
argument, and only trigger the special case for infix applications
if both arguments are visible (i.e., required).

Test Plan

make test TEST=T15941

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott created this revision.Nov 24 2018, 6:47 AM
monoidal accepted this revision.Nov 24 2018, 8:37 AM
This revision is now accepted and ready to land.Nov 24 2018, 8:37 AM
goldfire accepted this revision.Nov 24 2018, 12:06 PM

LGTM.

We might want to update this approach if/when Trac #12363 ever gets implemented.

simonpj added inline comments.
compiler/iface/IfaceType.hs
1342

We are trying to re-use ppr_iface_tc_app.

1345

Add

Polymorphic, because used for printing

* Types, call from `pprTyTcApp'`

* Coercions, call from `pprIfaceCoTcApp` above
This revision was automatically updated to reflect the committed changes.
RyanGlScott marked 2 inline comments as done.