
#16288: Core Lint error: Occurrence is GlobalId, but binding is LocalId -------------------------------------+------------------------------------- Reporter: monoidal | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: 15840 Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by aspiwack): My understanding is that the issue occurs in this subexpression {{{#!haskell let { pretV_r3 :: Doc [LclId] pretV_r3 = wild_Xd } in pretV; }}} The two `pretV` are displayed differently but have actually the same `Unique` (they differ by there locality tag though). What I think happened here is that the simplifier saw an expression of the form {{{#!haskell case u of x { pat -> rhs } }}} And decided to rewrite it to {{{#!haskell case u of x { pat -> let u = x in rhs } }}} Where the new `u` has the same unique as the other `u`, so as to shadow it, and avoid pushing a substitution through. Fair enough. Now the problem is that the new `u` is, as expected, a `LclId`. However, the ''original'' `u` happened to be a `GblId`, hence so are all the occurrences of `u` in the `rhs`! Now, I'm not sure what the appropriate solution is, here. Don't perform this transformation when the scrutinee is a global identifier? Or something more elaborate. As a matter of fact, I haven't been able to locate the part of the simplifier which does this transformation. This is a blocker for #15840. Which happened to reveal this issue in a very particular set of circumstances (involving the latest version of cabal), where it breaks core-lint when building the compiler. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16288#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler