Opened 3 years ago

Closed 10 months ago

#12525 closed bug (fixed)

Internal identifiers creeping into :show bindings

Reported by: mniip Owned by: RolandSenn
Priority: low Milestone: 8.8.1
Component: GHCi Version: 8.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case: make test TEST=T12525
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D5326
Wiki Page:

Description

When binding variables the "new" way, or defining typeclasses, some things that are better left unseen manage to creep into the :show Bindings list.

GHCi, version 8.1.20160725: http://www.haskell.org/ghc/  :? for help
> :show bindings
> x = ()
> :show bindings
$trModule :: GHC.Types.Module = _
x :: () = _
> class Foo a
> :show bindings
x :: () = _
class Foo a
$tcFoo :: GHC.Types.TyCon = _
$tc'C:Foo :: GHC.Types.TyCon = _
$trModule :: GHC.Types.Module = _

Change History (5)

comment:1 Changed 3 years ago by simonpj

Ugh. The underlying problem is that the GHCi InteractiveContext doesn't make a proper distinction between

  • things lexically in scope (ic_rn_gbl_env :: GlobalRdrEnv)
  • things that the typechecker might need (ic_tythings :: [TyThing])

Instead the former is (more or less, I think) generated from the latter. But that's problematic for these internal identifiers.

We came across this before: #11051. Easiest fix is to use the same solution for showBindings, namely to use isDerivedOccName to filter out the internal ones. See Note [What to show to users] in InteractiveEval.hs.

comment:2 Changed 10 months ago by RolandSenn

Owner: set to RolandSenn

comment:3 Changed 10 months ago by RolandSenn

Differential Rev(s): Phab:D5326
Milestone: 8.8.1
Status: newpatch
Test Case: make test TEST=T12525

@simonpj: Many thanks for your kind and helpful hint in comment 1.

comment:4 Changed 10 months ago by Krzysztof Gogolewski <krz.gogolewski@…>

In 921fd89/ghc:

Fix #12525: Remove derived bindings from the TyThings from getBindings

Summary:
Remove derived OccNames from the list of TyThings returned by the function GHC.getBindings.
Therefore the output of the `:show bindings `command will not contain names generated by GHC.

Test Plan: make test TEST=T12525

Reviewers: austin, hvr, alanz, angerman, thomie, bgamari, osa1

Reviewed By: osa1

Subscribers: simonpj, osa1, rwbarton, carter

GHC Trac Issues: #12525

Differential Revision: https://phabricator.haskell.org/D5326

comment:5 Changed 10 months ago by monoidal

Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.