[GHC] #13102: orphan family instances can leak through the EPS in --make mode
GHC
ghc-devs at haskell.org
Tue Jan 10 22:26:33 UTC 2017
#13102: orphan family instances can leak through the EPS in --make mode
-------------------------------------+-------------------------------------
Reporter: rwbarton | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
In --make mode there is a single EPS whose `eps_fam_inst_env` holds all
type family instances that have been read from interface files from
external packages for any reason. The type checker uses this field
pervasively via `tcGetFamInstEnvs`.
When compiling multiple files it's fairly easy to set up a situation in
which
1. the first module to be compiled `A` loads an interface file `O.hi` from
another package containing an orphan family instance (say, because it
imports the module directly);
2. a later module `B` uses this instance to reduce a type, even though `B`
has no dependency at all on the module `O` defining the instance.
(The only tricky bit in arranging this is that since `B` cannot depend on
`A`, a little good fortune is needed for GHC to decide to compile `B`
after `A`.)
Now another module could import `B` and obtain a function whose definition
relies on a type family instance that is not visible from `B` at all,
compromising type safety.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13102>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list