forked from ghc/ghc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #15594 (--abi-hash with Backpack sometimes fails)
Summary: For holes, its necessary to "see through" the instantiation of the hole to get accurate family instance dependencies. For example, if B imports <A>, and <A> is instantiated with F, we must grab and include all of the dep_finsts from F to have an accurate transitive dep_finsts list. However, we MUST NOT do this for regular modules. First, for efficiency reasons, doing this bloats the the dep_finsts list, because we *already* had those modules in the list (it wasn't a hole module, after all). But there's a second, more important correctness consideration: we perform module renaming when running --abi-hash. In this case, GHC's contract to the user is that it will NOT go and read out interfaces of any dependencies (haskell/cabal#3633); the point of --abi-hash is just to get a hash of the on-disk interfaces for this *specific* package. If we go off and tug on the interface for /everything/ in dep_finsts, we're gonna have a bad time. (It's safe to do do this for hole modules, though, because the hmap for --abi-hash is always trivial, so the interface we request is local. Though, maybe we ought not to do it in this case either...) Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: validate Reviewers: alexbiehl, goldfire, bgamari Subscribers: ppk, shlevy, rwbarton, carter GHC Trac Issues: #15594 Differential Revision: https://phabricator.haskell.org/D5123
- Loading branch information
Showing
8 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TOP=/home/ezyang/Dev/ghc-known-nat/testsuite | ||
include $(TOP)/mk/boilerplate.mk | ||
include $(TOP)/mk/test.mk | ||
|
||
SETUP='$(PWD)/Setup' -v0 | ||
CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' | ||
|
||
T15594: clean | ||
'$(GHC_PKG)' init tmp.d | ||
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup | ||
$(CONFIGURE) | ||
$(SETUP) build | ||
$(SETUP) copy | ||
$(SETUP) register | ||
ifneq "$(CLEANUP)" "" | ||
$(MAKE) -s --no-print-directory clean | ||
endif | ||
|
||
clean : | ||
$(RM) -rf tmp.d inst dist Setup$(exeext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
signature Sig where | ||
|
||
foo :: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{-# LANGUAGE TypeFamilies #-} | ||
module Stuff where | ||
|
||
data family T a | ||
|
||
data instance T Int = T Int | ||
|
||
test :: String | ||
test = | ||
"test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if config.cleanup: | ||
cleanup = 'CLEANUP=1' | ||
else: | ||
cleanup = 'CLEANUP=0' | ||
|
||
test('T15594', | ||
extra_files(['Setup.hs', 'Stuff.hs', 'Sig.hsig', 'pkg.cabal', 'src']), | ||
run_command, | ||
['$MAKE -s --no-print-directory T15594 ' + cleanup]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cabal-version: 2.0 | ||
name: backpack-trans | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
author: Alex Biehl | ||
maintainer: [email protected] | ||
build-type: Simple | ||
|
||
library indef | ||
signatures: Sig | ||
exposed-modules: Stuff | ||
build-depends: base | ||
default-language: Haskell2010 | ||
|
||
library | ||
exposed-modules: Lib | ||
build-depends: base, indef | ||
default-language: Haskell2010 | ||
hs-source-dirs: src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Lib where | ||
|
||
import Stuff | ||
|
||
doSomeStuff :: String | ||
doSomeStuff = | ||
test |