summaryrefslogtreecommitdiff
path: root/compiler/iface/LoadIface.hs
Commit message (Collapse)AuthorAgeFilesLines
...
* Unify hsig and hs-boot; add preliminary "hs-boot" merging.Edward Z. Yang2015-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch drops the file level distinction between hs-boot and hsig; we figure out which one we are compiling based on whether or not there is a corresponding hs file lying around. To make the "import A" syntax continue to work for bare hs-boot files, we also introduce hs-boot merging, which takes an A.hi-boot and converts it to an A.hi when there is no A.hs file in scope. This will be generalized in Backpack to merge multiple A.hi files together; which means we can jettison the "load multiple interface files" functionality. This works automatically for --make, but for one-shot compilation we need a new mode: ghc --merge-requirements A will generate an A.hi/A.o from a local A.hi-boot file; Backpack will extend this mechanism further. Has Haddock submodule update to deal with change in msHsFilePath behavior. - This commit drops support for the hsig extension. Can we support it? It's annoying because the finder code is written with the assumption that where there's an hs-boot file, there's always an hs file too. To support hsig, you'd have to probe two locations. Easier to just not support it. - #10333 affects us, modifying an hs-boot still doesn't trigger recomp. - See compiler/main/Finder.hs: this diff is very skeevy, but it seems to work. - This code cunningly doesn't drop hs-boot files from the "drop hs-boot files" module graph, if they don't have a corresponding hs file. I have no idea if this actually is useful. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari, spinda Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1098
* Revert "Revert "Revert "Change loadSrcInterface to return a list of ModIface"""Edward Z. Yang2015-09-211-44/+6
| | | | This reverts commit 0c6c015d42c2bd0ee008f790c7c0cb4c5b78ca6b.
* Revert "Revert "Revert "Support for multiple signature files in scope."""Edward Z. Yang2015-09-211-12/+6
| | | | This reverts commit 214596de224afa576a9c295bcf53c6941d6892e0.
* Comments and white spaceSimon Peyton Jones2015-08-261-1/+2
|
* Use lookupIfaceTop for loading IfaceDecls.Edward Z. Yang2015-07-221-6/+4
| | | | | | | | | | | | | | | | Summary: It's shorter! And then when Backpack overrides lookupIfaceTop everyone will see the right information. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1090
* Switch from recording IsBootInterface to recording full HscSource.Edward Z. Yang2015-07-221-3/+4
| | | | | | Note: ModIface format change is BC, no need to recompile. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Revert "Revert "Support for multiple signature files in scope.""Edward Z. Yang2015-07-201-6/+12
| | | | | | | This reverts commit bac927b9770ff769128b66d13a3e72bf5a9bc514. As it turns out, we need these commits for separate compilation and accurate dependency tracking. So back in they go!
* Revert "Revert "Change loadSrcInterface to return a list of ModIface""Edward Z. Yang2015-07-201-6/+44
| | | | This reverts commit c60704fc405149407c155e297433f1cc299ae58a.
* Filter orphan rules based on imports, fixes #10294 and #10420.Edward Z. Yang2015-06-201-26/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If we have an orphan rule in our database, don't apply it unless the defining module is transitively imported by the module we are processing. We do this by defining a new RuleEnv data type which includes both the RuleBase as well as the set of visible orphan modules, and threading this through the relevant environments (CoreReader, RuleCheckEnv and ScEnv). This is analogous to the instances fix we applied in #2182 4c834fdddf4d44d12039da4d6a2c63a660975b95, but done for RULES. An important knock-on effect is that we can remove some buggy code in LoadInterface which tried to avoid loading interfaces that were loaded by plugins (which sometimes caused instances and rules to NEVER become visible). One note about tests: I renamed the old plugins07 test to T10420 and replaced plugins07 with a test to ensure that a plugin import did not cause new rules to be loaded in. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, goldfire Subscribers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D950 GHC Trac Issues: #10420
* Revert "Change loadSrcInterface to return a list of ModIface"Edward Z. Yang2015-06-111-44/+6
| | | | | | | | As it turns out, in our new design these changes are no longer needed. The code is simpler without returning a list of ModIface, so let's do it! This reverts commit 8c7d20d8c7e63a1123755aae69cfa825c749e9e8.
* Revert "Support for multiple signature files in scope."Edward Z. Yang2015-06-111-12/+6
| | | | This reverts commit a7524eaed33324e2155c47d4a705bef1d70a2b5b.
* Fix #10182 by disallowing/avoiding self {-# SOURCE #-} importsEdward Z. Yang2015-04-221-1/+10
| | | | | | | | | | | | | | | | | | | | | Summary: hs-boot declarations were leaking into the EPS due to self {-# SOURCE #-} imports, and interface loading induced by orphan instances. For the former, we simply disallow self {-# SOURCE #-} imports; for the latter, we simply just don't load an interface if it would be ourself. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D860 GHC Trac Issues: #10182
* Support for multiple signature files in scope.Edward Z. Yang2015-04-071-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A common pattern when programming with signatures is to combine multiple signatures together (signature linking). We achieve this by making it not-an-error to have multiple, distinct interface files for the same module name, as long as they have the same backing implementation. When a user imports a module name, they get ALL matching signatures dumped into their scope. On the way, I refactored the module finder code, which now distinguishes between exact finds (when you had a 'Module') and regular finds (when you had a 'ModuleName'). I also refactored the package finder code to use a Monoid instance on LookupResult to collect together various results. ToDo: At the moment, if a signature is declared in the local package, it completely overrides any remote signatures. Eventually, we'll want to also pull in the remote signatures (or even override the local signature, if the full implementation is available.) There are bunch of ToDos in the code for what to do once this is done. ToDo: At the moment, whenever a module name lookup occurs in GHCi and we would have seen a signature, we instead continue and return the Module for the backing implementation. This is correct for most cases, but there might be some situations where we want something a little more fine-grained (e.g. :browse should only list identifiers which are available through the in-scope signatures, and not ALL of them.) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, hvr, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D790 GHC Trac Issues: #9252
* Fake (->) fixity declaration (#10145)Oleg Grenrus2015-04-021-0/+2
| | | | | | Reviewed By: simonpj, austin Differential Revision: https://phabricator.haskell.org/D741
* nameIsLocalOrFrom should include interactive modulesSimon Peyton Jones2015-02-111-9/+7
| | | | | | | | | The provoking cause was Trac #10019, but it revealed that nameIsLocalOrFrom should really include all interactive modules (ones from the 'interactive' package). Previously we had some ad-hoc 'isInteractiveModule' tests with some (but not all) the calls to nameIsLocalOrFrom. See the new comments with Name.nameIsLocalOrFrom.
* Replace .lhs with .hs in compiler commentsYuri de Wit2015-02-091-1/+1
| | | | | | | | | | | | | | Summary: It looks like during .lhs -> .hs switch the comments were not updated. So doing exactly that. Reviewers: austin, jstolarek, hvr, goldfire Reviewed By: austin, jstolarek Subscribers: thomie, goldfire Differential Revision: https://phabricator.haskell.org/D621 GHC Trac Issues: #9986
* Make Core Lint check for locally-bound GlobalIdsSimon Peyton Jones2014-12-151-0/+156
| | | | | | | | | | | | | | | | | | There should be no bindings in this module for a GlobalId; except after CoreTidy, when top-level bindings are globalised. To check for this, I had to make the CoreToDo pass part of the environment that Core Lint caries. But CoreToDo is defined in CoreMonad, which (before this patch) called CoreLint. So I had to do quite a bit of refactoring, moving some lint-invoking code into CoreLint itself. Crucially, I also more tcLookupImported_maybe, importDecl, and checkwiredInTyCon from TcIface (which use CoreLint) to LoadIface (which doesn't). This is probably better structure anyway. So most of this patch is refactoring. The actual check for GlobalIds is in CoreLint.lintAndScopeId
* compiler: de-lhs iface/Austin Seipp2014-12-031-0/+939
Signed-off-by: Austin Seipp <austin@well-typed.com>