Ticket #4085 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

minor External Core prettyprinter bug

Reported by: tim Owned by: igloo
Priority: normal Milestone:
Component: External Core Version: 6.12.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The ext-core pretty printer was printing out rational literals like:

((-1)/5)

which isn't valid External Core. The correct way to print a negative rational is:

(-1/5)

I've attached a patch. I would normally commit this myself, but my GHC build tree isn't up to date.

Thanks!

Change History

Changed 3 years ago by tim

trac wouldn't let me attach the patch since the change history is too big, but it's at:

http://cs.pdx.edu/~tjc/Patches/core-prettyprinter.dpatch

and the full text of the relevant change itself is:

Tue May  4 10:56:04 PDT 2010  Tim Chevalier <chevalier@alum.wellesley.edu>
  * Core prettyprinter fixes
    {
    hunk ./compiler/coreSyn/PprExternalCore.lhs 11
    +import Data.Ratio
    hunk ./compiler/coreSyn/PprExternalCore.lhs 192
    --- we use (text (show r)) because "(rational r)" was printing out things
    +-- we use (text (show (numerator r))) (and the same for denominator)
    +-- because "(rational r)" was printing out things
    hunk ./compiler/coreSyn/PprExternalCore.lhs 195
    -plit (Lrational r t) = parens (text (show r) <>  text "::" <> pty t)
    +plit (Lrational r t) = parens (text (show (numerator r)) <+> char '%'
    +   <+> text (show (denominator r)) <>  text "::" <> pty t)
    }

Changed 3 years ago by simonpj

  • status changed from new to patch

Thanks. Changing status to 'patch'.

S

Changed 3 years ago by igloo

  • owner set to igloo

Changed 3 years ago by igloo

  • status changed from patch to closed
  • resolution set to fixed

Thanks, I've applied the patch - but it looks like you recorded it against the 6.10 branch, so I've re-recorded it against the HEAD.

Note: See TracTickets for help on using tickets.