diff options
author | Adam Gundry <adam@well-typed.com> | 2020-10-02 20:23:27 +0100 |
---|---|---|
committer | Adam Gundry <adam@well-typed.com> | 2020-12-23 21:40:27 +0000 |
commit | 4a551438faa6c6311ca951f994801ea18313a68e (patch) | |
tree | f7b490e9f80f4ba6e3b7fb84456c00806f95c1d2 /compiler/GHC/Parser/PostProcess.hs | |
parent | 79d41f93a98d1a331f7c2dfee55da9c1fea01380 (diff) | |
download | haskell-wip/amg/renamer-refactor.tar.gz |
Refactor renamer datastructureswip/amg/renamer-refactor
This patch significantly refactors key renamer datastructures (primarily Avail
and GlobalRdrElt) in order to treat DuplicateRecordFields in a more robust way.
In particular it allows the extension to be used with pattern synonyms (fixes
where mangled record selector names could be printed instead of field labels
(e.g. with -Wpartial-fields or hole fits, see new tests).
The key idea is the introduction of a new type GreName for names that may
represent either normal entities or field labels. This is then used in
GlobalRdrElt and AvailInfo, in place of the old way of representing fields
using FldParent (yuck) and an extra list in AvailTC.
Updates the haddock submodule.
Diffstat (limited to 'compiler/GHC/Parser/PostProcess.hs')
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 6071956e1b..59280962d3 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -2335,7 +2335,7 @@ mkModuleImpExp (L l specname) subs = ImpExpAll -> IEThingAll noExtField . L l <$> nameT ImpExpList xs -> (\newName -> IEThingWith noExtField (L l newName) - NoIEWildcard (wrapped xs) []) <$> nameT + NoIEWildcard (wrapped xs)) <$> nameT ImpExpAllWith xs -> do allowed <- getBit PatternSynonymsBit if allowed @@ -2345,7 +2345,7 @@ mkModuleImpExp (L l specname) subs = (findIndex isImpExpQcWildcard withs) ies = wrapped $ filter (not . isImpExpQcWildcard . unLoc) xs in (\newName - -> IEThingWith noExtField (L l newName) pos ies []) + -> IEThingWith noExtField (L l newName) pos ies) <$> nameT else addFatalError $ PsError PsErrIllegalPatSynExport [] l where @@ -2374,7 +2374,7 @@ mkTypeImpExp name = checkImportSpec :: Located [LIE GhcPs] -> P (Located [LIE GhcPs]) checkImportSpec ie@(L _ specs) = - case [l | (L l (IEThingWith _ _ (IEWildcard _) _ _)) <- specs] of + case [l | (L l (IEThingWith _ _ (IEWildcard _) _)) <- specs] of [] -> return ie (l:_) -> importSpecError l where |