We also need to retypecheck before when we do parallel make.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Sat, 14 May 2016 02:32:37 +0000 (19:32 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Sun, 21 Aug 2016 07:53:21 +0000 (00:53 -0700)
Summary:
Kept this seperate from the previous patch for clarity.
Comes with a test.

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/D2220

GHC Trac Issues: #12035

compiler/main/GhcMake.hs
testsuite/driver/extra_files.py
testsuite/tests/typecheck/should_fail/T12035j.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

index 1130d6f..d67a120 100644 (file)
@@ -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
 
                 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.
                 -- 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
                 return (Just mod_info)
 
         case mb_mod_info of
index 49cf901..acf4802 100644 (file)
@@ -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'],
   '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'],
   '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/T12035j.stderr b/testsuite/tests/typecheck/should_fail/T12035j.stderr
new file mode 100644 (file)
index 0000000..c05966e
--- /dev/null
@@ -0,0 +1,6 @@
+
+T12035.hs:3:1: error:
+    Type constructor â€˜T’ has conflicting definitions in the module
+    and its hs-boot file
+    Main module: type T = Bool
+    Boot file:   abstract T
index 37d74c6..dda2a7d 100644 (file)
@@ -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('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, [''])
 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, [''])