[Git][ghc/ghc][wip/T18302] WIP on #18302
Krzysztof Gogolewski
gitlab at gitlab.haskell.org
Sat Sep 12 21:53:31 UTC 2020
Krzysztof Gogolewski pushed to branch wip/T18302 at Glasgow Haskell Compiler / GHC
Commits:
5f15edd2 by Krzysztof Gogolewski at 2020-09-12T23:52:48+02:00
WIP on #18302
Culprit:
pickGREsModExp :: ModuleName -> [GlobalRdrElt] -> [(GlobalRdrElt,GlobalRdrElt)]
-- ^ Pick GREs that are in scope *both* qualified *and* unqualified
-- Return each GRE that is, as a pair
-- (qual_gre, unqual_gre)
-- These two GREs are the original GRE with imports filtered to express how
-- it is in scope qualified an unqualified respectively
--
-- Used only for the 'module M' item in export list;
-- see 'GHC.Tc.Gen.Export.exports_from_avail'
pickGREsModExp mod gres = mapMaybe (pickBothGRE mod) gres
pickBothGRE :: ModuleName -> GlobalRdrElt -> Maybe (GlobalRdrElt, GlobalRdrElt)
pickBothGRE mod gre@(GRE { gre_name = n })
| isBuiltInSyntax n = Nothing
| Just gre1 <- pickQualGRE mod gre
, Just gre2 <- pickUnqualGRE gre = Just (gre1, gre2)
| otherwise = Nothing
where
-- isBuiltInSyntax filter out names for built-in syntax They
-- just clutter up the environment (esp tuples), and the
-- parser will generate Exact RdrNames for them, so the
-- cluttered envt is no use. Really, it's only useful for
-- GHC.Base and GHC.Tuple.
- - - - -
2 changed files:
- compiler/GHC/Builtin/Types/Prim.hs
- libraries/base/Unsafe/Coerce.hs
Changes:
=====================================
compiler/GHC/Builtin/Types/Prim.hs
=====================================
@@ -11,8 +11,6 @@ Wired-in knowledge about primitive types
-- | This module defines TyCons that can't be expressed in Haskell.
-- They are all, therefore, wired-in TyCons. C.f module "GHC.Builtin.Types"
module GHC.Builtin.Types.Prim(
- mkPrimTyConName, -- For implicit parameters in GHC.Builtin.Types only
-
mkTemplateKindVars, mkTemplateTyVars, mkTemplateTyVarsFrom,
mkTemplateKiTyVars, mkTemplateKiTyVar,
@@ -402,7 +400,7 @@ multiplicityTyVar = mkTemplateTyVars (repeat multiplicityTy) !! 13 -- selects '
-}
funTyConName :: Name
-funTyConName = mkPrimTyConName (fsLit "FUN") funTyConKey funTyCon
+funTyConName = mkPrimTcName UserSyntax (fsLit "FUN") funTyConKey funTyCon
-- | The @FUN@ type constructor.
--
@@ -536,12 +534,7 @@ tYPETyCon = mkKindTyCon tYPETyConName
-- If you edit these, you may need to update the GHC formalism
-- See Note [GHC Formalism] in GHC.Core.Lint
-tYPETyConName = mkPrimTyConName (fsLit "TYPE") tYPETyConKey tYPETyCon
-
-mkPrimTyConName :: FastString -> Unique -> TyCon -> Name
-mkPrimTyConName = mkPrimTcName BuiltInSyntax
- -- All of the super kinds and kinds are defined in Prim,
- -- and use BuiltInSyntax, because they are never in scope in the source
+tYPETyConName = mkPrimTcName UserSyntax (fsLit "TYPE") tYPETyConKey tYPETyCon
mkPrimTcName :: BuiltInSyntax -> FastString -> Unique -> TyCon -> Name
mkPrimTcName built_in_syntax occ key tycon
=====================================
libraries/base/Unsafe/Coerce.hs
=====================================
@@ -24,8 +24,6 @@ import GHC.Arr (amap) -- For amap/unsafeCoerce rule
import GHC.Base
import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Base
-import GHC.Types
-
{- Note [Implementing unsafeCoerce]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The implementation of unsafeCoerce is surprisingly subtle.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f15edd28eafd5a6bf74d429a85785dbf092eb20
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f15edd28eafd5a6bf74d429a85785dbf092eb20
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200912/013bba6f/attachment-0001.html>
More information about the ghc-commits
mailing list