summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser.y
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-04-30 11:07:15 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-04 04:34:42 -0400
commit32a4ae90b50cc56f2955f489ad0cf8c7ff5e131a (patch)
tree274e86d49420a09eb8400bc3751c55f827ed4e56 /compiler/GHC/Parser.y
parentcb5c31b51b021ce86890bba73276fe6f7405f5d3 (diff)
downloadhaskell-32a4ae90b50cc56f2955f489ad0cf8c7ff5e131a.tar.gz
Clean up boot vs non-boot disambiguating types
We often have (ModuleName, Bool) or (Module, Bool) pairs for "extended" module names (without or with a unit id) disambiguating boot and normal modules. We think this is important enough across the compiler that it deserves a new nominal product type. We do this with synnoyms and a functor named with a `Gen` prefix, matching other newly created definitions. It was also requested that we keep custom `IsBoot` / `NotBoot` sum type. So we have it too. This means changing many the many bools to use that instead. Updates `haddock` submodule.
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r--compiler/GHC/Parser.y14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index a9bb4fa87d..50459c673e 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -51,7 +51,7 @@ import qualified Prelude
import GHC.Hs
import GHC.Driver.Phases ( HscSource(..) )
-import GHC.Driver.Types ( IsBootInterface, WarningTxt(..) )
+import GHC.Driver.Types ( IsBootInterface(..), WarningTxt(..) )
import GHC.Driver.Session
import GHC.Driver.Backpack.Syntax
import GHC.Unit.Info
@@ -722,8 +722,8 @@ unitdecl :: { LHsUnitDecl PackageName }
-- XXX not accurate
{ sL1 $2 $ DeclD
(case snd $3 of
- False -> HsSrcFile
- True -> HsBootFile)
+ NotBoot -> HsSrcFile
+ IsBoot -> HsBootFile)
$4
(Just $ sL1 $2 (HsModule (Just $4) $6 (fst $ snd $8) (snd $ snd $8) $5 $1)) }
| maybedocheader 'signature' modid maybemodwarning maybeexports 'where' body
@@ -735,8 +735,8 @@ unitdecl :: { LHsUnitDecl PackageName }
-- will prevent us from parsing both forms.
| maybedocheader 'module' maybe_src modid
{ sL1 $2 $ DeclD (case snd $3 of
- False -> HsSrcFile
- True -> HsBootFile) $4 Nothing }
+ NotBoot -> HsSrcFile
+ IsBoot -> HsBootFile) $4 Nothing }
| maybedocheader 'signature' modid
{ sL1 $2 $ DeclD HsigFile $3 Nothing }
| 'dependency' unitid mayberns
@@ -985,8 +985,8 @@ importdecl :: { LImportDecl GhcPs }
maybe_src :: { (([AddAnn],SourceText),IsBootInterface) }
: '{-# SOURCE' '#-}' { (([mo $1,mc $2],getSOURCE_PRAGs $1)
- , True) }
- | {- empty -} { (([],NoSourceText),False) }
+ , IsBoot) }
+ | {- empty -} { (([],NoSourceText),NotBoot) }
maybe_safe :: { ([AddAnn],Bool) }
: 'safe' { ([mj AnnSafe $1],True) }