Opened 2 years ago

Last modified 10 months ago

#10854 new task

Remove recursive uses of `pprParendHsExpr` from `HsExpr.ppr_expr`

Reported by: goldfire Owned by: kseo
Priority: normal Milestone:
Component: Compiler Version: 7.10.2
Keywords: newcomer Cc: alanz
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #13238 Differential Rev(s):
Wiki Page:

Description

An HsExpr should look exactly as a user wrote some Haskell code. Its pretty printer should therefore be quite dumb. Just print out the code! But a few places in GHC create HsExprs and aren't scrupulous with regard to adding HsPar nodes where source syntax would need them. Thus, well-meaning souls have added pprParendExpr calls to the HsExpr pretty-printer to try to cover these cases.

Simon and I think that we should remove all recursive uses of pprParendExpr from the HsExpr pretty-printer and instead add the HsPars where necessary.

It was recently reported that the following test cases break when simply removing pprParendExpr:

Unexpected failures:
   deriving/should_fail          T4846 [stderr mismatch] (normal)
   generics                      GenDerivOutput [stderr mismatch] (normal)
   generics                      GenDerivOutput1_0 [stderr mismatch] (normal)
   generics                      GenDerivOutput1_1 [stderr mismatch] (normal)
   ghci/scripts                  T10248 [bad stderr] (ghci)
   indexed-types/should_compile  PushedInAsGivens [stderr mismatch] (normal)
   safeHaskell/safeLanguage      SafeLang10 [stderr mismatch] (normal)
   safeHaskell/safeLanguage      SafeLang17 [stderr mismatch] (normal)
   typecheck/should_fail         T8603 [stderr mismatch] (normal)
   typecheck/should_fail         tcfail177 [stderr mismatch] (normal)

See also considerable commentary on Phab:D1114.

Change History (3)

comment:1 Changed 2 years ago by kseo

Owner: set to kseo

comment:2 Changed 10 months ago by bgamari

Cc: alanz added

Adding alanz who has done some work in this area.

comment:3 Changed 10 months ago by alanz

Note: See TracTickets for help on using tickets.