diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-04-30 12:43:00 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-04 16:00:48 -0400 |
commit | 6acadb79afe685c635fd255f90551a0fbfcbe3dc (patch) | |
tree | 2523292fab1447c3af2bcec3e3ae1deac9d37ecc /compiler/GHC/Iface | |
parent | 39020600da32a3207e83f056f16ac42bcc617dc4 (diff) | |
download | haskell-6acadb79afe685c635fd255f90551a0fbfcbe3dc.tar.gz |
Persist CorePrepProv into IfaceUnivCoProv
CorePrepProv is only created in CorePrep, so I thought it wouldn't be
needed in IfaceUnivCoProv. But actually IfaceSyn is used during
pretty-printing, and we can certainly pretty-print things after
CorePrep as #19768 showed.
So the simplest thing is to represent CorePrepProv in IfaceSyn.
To improve what Lint can do I also added a boolean to CorePrepProv, to
record whether it is homogeneously kinded or not. It is introduced in
two distinct ways (see Note [Unsafe coercions] in GHC.CoreToStg.Prep),
one of which may be hetero-kinded (e.g. Int ~ Int#) beause it is
casting a divergent expression; but the other is not. The boolean
keeps track.
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r-- | compiler/GHC/Iface/Syntax.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Iface/Type.hs | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs index dfc39fb244..fe1fa6a58f 100644 --- a/compiler/GHC/Iface/Syntax.hs +++ b/compiler/GHC/Iface/Syntax.hs @@ -1690,6 +1690,7 @@ freeNamesIfProv :: IfaceUnivCoProv -> NameSet freeNamesIfProv (IfacePhantomProv co) = freeNamesIfCoercion co freeNamesIfProv (IfaceProofIrrelProv co) = freeNamesIfCoercion co freeNamesIfProv (IfacePluginProv _) = emptyNameSet +freeNamesIfProv (IfaceCorePrepProv _) = emptyNameSet freeNamesIfVarBndr :: VarBndr IfaceBndr vis -> NameSet freeNamesIfVarBndr (Bndr bndr _) = freeNamesIfBndr bndr diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs index b90676f062..034198bd9a 100644 --- a/compiler/GHC/Iface/Type.hs +++ b/compiler/GHC/Iface/Type.hs @@ -396,6 +396,7 @@ data IfaceUnivCoProv = IfacePhantomProv IfaceCoercion | IfaceProofIrrelProv IfaceCoercion | IfacePluginProv String + | IfaceCorePrepProv Bool -- See defn of CorePrepProv {- Note [Holes in IfaceCoercion] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -595,7 +596,8 @@ substIfaceType env ty go_prov (IfacePhantomProv co) = IfacePhantomProv (go_co co) go_prov (IfaceProofIrrelProv co) = IfaceProofIrrelProv (go_co co) - go_prov (IfacePluginProv str) = IfacePluginProv str + go_prov co@(IfacePluginProv _) = co + go_prov co@(IfaceCorePrepProv _) = co substIfaceAppArgs :: IfaceTySubst -> IfaceAppArgs -> IfaceAppArgs substIfaceAppArgs env args @@ -1744,6 +1746,8 @@ pprIfaceUnivCoProv (IfaceProofIrrelProv co) = text "irrel" <+> pprParendIfaceCoercion co pprIfaceUnivCoProv (IfacePluginProv s) = text "plugin" <+> doubleQuotes (text s) +pprIfaceUnivCoProv (IfaceCorePrepProv _) + = text "CorePrep" ------------------- instance Outputable IfaceTyCon where @@ -2101,6 +2105,9 @@ instance Binary IfaceUnivCoProv where put_ bh (IfacePluginProv a) = do putByte bh 3 put_ bh a + put_ bh (IfaceCorePrepProv a) = do + putByte bh 4 + put_ bh a get bh = do tag <- getByte bh @@ -2111,6 +2118,8 @@ instance Binary IfaceUnivCoProv where return $ IfaceProofIrrelProv a 3 -> do a <- get bh return $ IfacePluginProv a + 4 -> do a <- get bh + return (IfaceCorePrepProv a) _ -> panic ("get IfaceUnivCoProv " ++ show tag) |