Matthew Pickering pushed to branch wip/t26088 at Glasgow Haskell Compiler / GHC
Commits:
-
1ad84037
by Matthew Pickering at 2025-07-08T10:17:54+01:00
-
5e0405b9
by Matthew Pickering at 2025-07-08T10:17:54+01:00
9 changed files:
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Unit/Module/Graph.hs
- + testsuite/tests/splice-imports/T26087.stderr
- + testsuite/tests/splice-imports/T26087A.hs
- + testsuite/tests/splice-imports/T26087B.hs
- + testsuite/tests/splice-imports/T26088.stderr
- + testsuite/tests/splice-imports/T26088A.hs
- + testsuite/tests/splice-imports/T26088B.hs
- testsuite/tests/splice-imports/all.T
Changes:
... | ... | @@ -35,6 +35,7 @@ import GHC.Rename.Pat ( rnPat ) |
35 | 35 | import GHC.Types.Error
|
36 | 36 | import GHC.Types.Basic ( TopLevelFlag, isTopLevel, maxPrec )
|
37 | 37 | import GHC.Types.SourceText ( SourceText(..) )
|
38 | +import GHC.Types.ThLevelIndex
|
|
38 | 39 | import GHC.Utils.Outputable
|
39 | 40 | import GHC.Unit.Module
|
40 | 41 | import GHC.Types.SrcLoc
|
... | ... | @@ -1001,7 +1002,7 @@ checkCrossLevelLifting dflags reason top_lvl is_local allow_lifting bind_lvl use |
1001 | 1002 | , xopt LangExt.ImplicitStagePersistence dflags = when (isExternalName name) (keepAlive name) >> return (HsVar noExtField name_var)
|
1002 | 1003 | -- 4. Name is in a bracket, and lifting is allowed
|
1003 | 1004 | | Brack _ pending <- use_lvl
|
1004 | - , any (use_lvl_idx >=) (Set.toList bind_lvl)
|
|
1005 | + , any (\bind_idx -> use_lvl_idx == incThLevelIndex bind_idx) (Set.toList bind_lvl)
|
|
1005 | 1006 | , allow_lifting
|
1006 | 1007 | = do
|
1007 | 1008 | let mgre = case reason of
|
... | ... | @@ -866,7 +866,7 @@ mkTransZeroDeps = first graphReachability {- module graph is acyclic -} . module |
866 | 866 | |
867 | 867 | -- | Transitive dependencies, but with the stage that each module is required at.
|
868 | 868 | mkStageDeps :: [ModuleGraphNode] -> (ReachabilityIndex StageSummaryNode, (NodeKey, ModuleStage) -> Maybe StageSummaryNode)
|
869 | -mkStageDeps = first graphReachability . moduleGraphNodesStages
|
|
869 | +mkStageDeps = first cyclicGraphReachability . moduleGraphNodesStages
|
|
870 | 870 | |
871 | 871 | type ZeroSummaryNode = Node Int ZeroScopeKey
|
872 | 872 |
1 | +./T26087B.hs: error: [GHC-92213]
|
|
2 | + Module graph contains a cycle:
|
|
3 | + module ‘main:T26087B’ (./T26087B.hs)
|
|
4 | + imports module ‘main:T26087A’ (T26087A.hs)
|
|
5 | + which imports module ‘main:T26087B’ (./T26087B.hs)
|
|
6 | + |
1 | +{-# LANGUAGE ExplicitLevelImports #-}
|
|
2 | +module T26087A where
|
|
3 | + |
|
4 | +import quote T26087B |
1 | +{-# LANGUAGE ExplicitLevelImports, TemplateHaskell #-}
|
|
2 | +module T26087B where
|
|
3 | + |
|
4 | +import T26087A |
1 | +T26088A.hs:8:8: error: [GHC-28914]
|
|
2 | + • Level error: ‘a’ is bound at level -1 but used at level 1
|
|
3 | + • Available from the imports:
|
|
4 | + • imported from ‘T26088B’ at -1 at T26088A.hs:4:1-21
|
|
5 | + • In the Template Haskell quotation: [| a |]
|
|
6 | + |
1 | +{-# LANGUAGE ExplicitLevelImports, TemplateHaskell #-}
|
|
2 | +module T26088A where
|
|
3 | + |
|
4 | +import splice T26088B
|
|
5 | +import Language.Haskell.TH.Syntax
|
|
6 | + |
|
7 | +x :: Q Exp
|
|
8 | +x = [| a |] |
1 | +module T26088B where
|
|
2 | + |
|
3 | +a = () |
... | ... | @@ -46,3 +46,5 @@ test('SI35', |
46 | 46 | compile_and_run,
|
47 | 47 | ['-package ghc'])
|
48 | 48 | test('SI36', [extra_files(["SI36_A.hs", "SI36_B1.hs", "SI36_B2.hs", "SI36_B3.hs", "SI36_C1.hs", "SI36_C2.hs", "SI36_C3.hs"])], multimod_compile_fail, ['SI36', '-v0'])
|
49 | +test('T26087', [], multimod_compile_fail, ['T26087A', ''])
|
|
50 | +test('T26088', [], multimod_compile_fail, ['T26088A', '-v0']) |