Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#8274 closed bug (fixed)

Core pretty-printer doesn't print # on unboxed literals

Reported by: jstolarek Owned by:
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.7
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case: simplCore/should_compile/T8274
Blocked By: Blocking:
Related Tickets: #10104 Differential Rev(s): Phab:D678
Wiki Page:


I just noticed that Core pretty printer produces something like this (this is part of expected output for T3772 in testsuite):

    case GHC.Prim.<=# n# 0 of _ {
      __DEFAULT -> xs n#;
      1 -> GHC.Tuple.()

Both 0 (in scrutinee) and 1 (one of branch alternatives) are unboxed values, so they should be printed as 0# and 1# respectively. I haven't checked whether unboxed literals of other types (Word, Double, Float) are printed in that way, but I would guess that yes.

Change History (10)

comment:1 Changed 6 years ago by simonpj

The counter-argument would be that Core has no boxed literals, so the # is redundant. But I don't mind either way.

So, by all means make it so, if you think it woudl be helpful. Thanks.


comment:2 Changed 6 years ago by jstolarek

Type: bugfeature request

comment:3 Changed 5 years ago by jstolarek

Keywords: newcomer added

comment:4 Changed 5 years ago by detrumi

Owner: set to detrumi

comment:5 Changed 5 years ago by detrumi

Owner: detrumi deleted

comment:6 Changed 5 years ago by thomie

comment:7 Changed 5 years ago by thomie

Differential Rev(s): Phab:D678
Milestone: 7.12.1
Status: newpatch
Test Case: simplCore/should_compile/T8274
Type: feature requestbug

There is one small design decision to be made, and that is how to pretty print Integers.

Currently, unboxed Ints are printed as is, and Integers are prepended with __integer.

In my patch, I changed this to: unboxed Ints are appended with '#', and Integers are printed as is.

comment:8 Changed 5 years ago by Austin Seipp <austin@…>

In 89458eba5721de1b6b3378415f26e110bab8cc0f/ghc:

Pretty-print # on unboxed literals in core

Ticket #10104 dealt with showing the '#'s on types with unboxed fields. This
commit pretty prints the '#'s on unboxed literals in core output.

Test Plan: simplCore/should_compile/T8274

Reviewers: jstolarek, simonpj, austin

Reviewed By: simonpj, austin

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #8274

comment:9 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged, thanks!

comment:10 Changed 4 years ago by thoughtpolice


Milestone renamed

Note: See TracTickets for help on using tickets.