[commit: ghc] master: We also need to retypecheck before when we do parallel make. (e528061)

git at git.haskell.org git at git.haskell.org
Sun Aug 21 09:46:45 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e528061e2779ce475927f44d817eaf15a02cbac7/ghc

>---------------------------------------------------------------

commit e528061e2779ce475927f44d817eaf15a02cbac7
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Fri May 13 19:32:37 2016 -0700

    We also need to retypecheck before when we do parallel make.
    
    Summary:
    Kept this seperate from the previous patch for clarity.
    Comes with a test.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: simonpj, austin, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2220
    
    GHC Trac Issues: #12035


>---------------------------------------------------------------

e528061e2779ce475927f44d817eaf15a02cbac7
 compiler/main/GhcMake.hs                                    | 13 +++++++++++--
 testsuite/driver/extra_files.py                             |  1 +
 .../typecheck/should_fail/{T12035.stderr => T12035j.stderr} |  2 +-
 testsuite/tests/typecheck/should_fail/all.T                 |  2 ++
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 1130d6f..d67a120 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -1048,9 +1048,18 @@ parUpsweep_one mod home_mod_map comp_graph_loops lcl_dflags cleanup par_sem
                 let lcl_mod = localize_mod mod
                 let lcl_hsc_env = localize_hsc_env hsc_env
 
+                -- Re-typecheck the loop
+                type_env_var <- liftIO $ newIORef emptyNameEnv
+                let lcl_hsc_env' = lcl_hsc_env { hsc_type_env_var =
+                                    Just (ms_mod lcl_mod, type_env_var) }
+                lcl_hsc_env'' <- case finish_loop of
+                    Nothing   -> return lcl_hsc_env'
+                    Just loop -> typecheckLoop lcl_dflags lcl_hsc_env' $
+                                 map (moduleName . fst) loop
+
                 -- Compile the module.
-                mod_info <- upsweep_mod lcl_hsc_env old_hpt stable_mods lcl_mod
-                                        mod_index num_mods
+                mod_info <- upsweep_mod lcl_hsc_env'' old_hpt stable_mods
+                                        lcl_mod mod_index num_mods
                 return (Just mod_info)
 
         case mb_mod_info of
diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py
index 49cf901..acf4802 100644
--- a/testsuite/driver/extra_files.py
+++ b/testsuite/driver/extra_files.py
@@ -83,6 +83,7 @@ extra_src_files = {
   'T11824': ['TyCon.hs', 'Type.hs', 'Type.hs-boot', 'Unbound/'],
   'T11827': ['A.hs', 'A.hs-boot', 'B.hs'],
   'T12062': ['A.hs', 'A.hs-boot', 'C.hs'],
+  'T12035j': ['T12035.hs', 'T12035a.hs', 'T12035.hs-boot'],
   'T1372': ['p1/', 'p2/'],
   'T1407': ['A.c'],
   'T1959': ['B.hs', 'C.hs', 'D.hs', 'E1.hs', 'E2.hs'],
diff --git a/testsuite/tests/typecheck/should_fail/T12035.stderr b/testsuite/tests/typecheck/should_fail/T12035j.stderr
similarity index 85%
copy from testsuite/tests/typecheck/should_fail/T12035.stderr
copy to testsuite/tests/typecheck/should_fail/T12035j.stderr
index 7086785..c05966e 100644
--- a/testsuite/tests/typecheck/should_fail/T12035.stderr
+++ b/testsuite/tests/typecheck/should_fail/T12035j.stderr
@@ -1,5 +1,5 @@
 
-T12035.hs-boot:2:1: error:
+T12035.hs:3:1: error:
     Type constructor ‘T’ has conflicting definitions in the module
     and its hs-boot file
     Main module: type T = Bool
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 37d74c6..dda2a7d 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -420,6 +420,8 @@ test('T11990a', normal, compile_fail, [''])
 test('T11990b', normal, compile_fail, [''])
 test('T12035', extra_clean(['T12035.hi-boot', 'T12035.o-boot', 'T12035a.hi', 'T12035a.o']),
      multimod_compile_fail, ['T12035', '-v0'])
+test('T12035j', extra_clean(['T12035.hi-boot', 'T12035.o-boot', 'T12035a.hi', 'T12035a.o']),
+     multimod_compile_fail, ['T12035', '-j2 -v0'])
 test('T12063', [ expect_broken(12063), extra_clean(['T12063.hi-boot', 'T12063.o-boot', 'T12063a.hi', 'T12063a.o']) ],
      multimod_compile_fail, ['T12063', '-v0'])
 test('T11974b', normal, compile_fail, [''])



More information about the ghc-commits mailing list