Commit 22dba98f authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Fix recompilation tracking on signatures.



Summary:
Previously we weren't tracking these dependencies at all,
because we couldn't "find" the interface for {A.H}.  Now
we've associated hole names to the correct module identity
so we will pick them up.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie, snowleopard

Differential Revision: https://phabricator.haskell.org/D3131
parent ca543154
......@@ -119,11 +119,16 @@ mk_mod_usage_info pit hsc_env this_mod direct_imports used_names
Nothing -> ASSERT2( isSystemName name, ppr name ) mv_map
-- See Note [Internal used_names]
Just mod -> -- This lambda function is really just a
-- specialised (++); originally came about to
-- avoid quadratic behaviour (trac #2680)
extendModuleEnvWith (\_ xs -> occ:xs) mv_map mod [occ]
where occ = nameOccName name
Just mod ->
-- See Note [Identity versus semantic module]
let mod' = if isHoleModule mod
then mkModule this_pkg (moduleName mod)
else mod
-- This lambda function is really just a
-- specialised (++); originally came about to
-- avoid quadratic behaviour (trac #2680)
in extendModuleEnvWith (\_ xs -> occ:xs) mv_map mod' [occ]
where occ = nameOccName name
-- We want to create a Usage for a home module if
-- a) we used something from it; has something in used_names
......
......@@ -475,6 +475,10 @@ data FrontendResult
-- in the home library we are compiling. (See LoadIface.)
-- Similarly, in RnNames we check for self-imports using
-- identity modules, to allow signatures to import their implementor.
--
-- - For recompilation avoidance, you want the identity module,
-- since that will actually say the specific interface you
-- want to track (and recompile if it changes)
-- | 'TcGblEnv' describes the top-level of the module at the
......
......@@ -162,6 +162,7 @@ extra_src_files = {
'bkpcabal02': ['p', 'q', 'bkpcabal02.cabal', 'Setup.hs'],
'bkpcabal03': ['asig1', 'asig2', 'bkpcabal03.cabal.in1', 'bkpcabal03.cabal.in2', 'Setup.hs', 'Mod.hs'],
'bkpcabal04': ['p','q','bkpcabal04.cabal.in1','bkpcabal04.cabal.in2','Setup.hs'],
'bkpcabal05': ['bkpcabal05.cabal','A.hsig.in1','A.hsig.in2','M.hs','Setup.hs'],
'break001': ['../Test2.hs'],
'break002': ['../Test2.hs'],
'break003': ['../Test3.hs'],
......
signature A where
data T
instance Show T
module M where
import A
f :: T -> String
f = show
TOP=../../../..
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'
bkpcabal05: clean
$(MAKE) -s --no-print-directory clean
'$(GHC_PKG)' init tmp.d
'$(TEST_HC)' -v0 --make Setup
$(CONFIGURE)
cp A.hsig.in1 A.hsig
# typecheck
$(SETUP) build
cp A.hsig.in2 A.hsig
! $(SETUP) build
ifneq "$(CLEANUP)" ""
$(MAKE) -s --no-print-directory clean
endif
clean :
$(RM) -rf tmp.d inst dist Setup$(exeext) A.hsig
import Distribution.Simple
main = defaultMain
if config.cleanup:
cleanup = 'CLEANUP=1'
else:
cleanup = 'CLEANUP=0'
test('bkpcabal05',
normal,
run_command,
['$MAKE -s --no-print-directory bkpcabal05 ' + cleanup])
name: bkpcabal05
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Simple
cabal-version: >=1.25
library
signatures: A
exposed-modules: M
build-depends: base
M.hs:4:5: error:
• No instance for (Show T) arising from a use of ‘show’
• In the expression: show
In an equation for ‘f’: f = show
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment