#12091: 'Variable not in scope" when using GHCi with `-fobject-code` -------------------------------------+------------------------------------- Reporter: thomie | Owner: (none) Type: bug | Status: patch Priority: high | Milestone: Component: GHCi | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #7253, #14108 | Differential Rev(s): Phab:D3849 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"ddb870bf7055ccc8ff8b86c161f31aad81d01add/ghc" ddb870b/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="ddb870bf7055ccc8ff8b86c161f31aad81d01add" Don't drop GHCi-defined functions with -fobject-code enabled The desugarer was using `targetRetainsAllBindings` as a litmus test for determining if a function was defined in interactive mode (and thus should be exported). However, there is a corner case where one can be in interactive mode and have `targetRetainsAllBindings` return `False`: if `-fobject-code` is enabled (since the target will no longer be `HscInteractive`). In such a scenario, we should fall back on a different test for determining if we are in a GHCi session. I chose to use `isInteractiveModule`, which appears to do the trick. Test Plan: make test TEST=T12091 Reviewers: austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #12091 Differential Revision: https://phabricator.haskell.org/D3849 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12091#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler