Commit 255d2e32 authored by Richard Eisenberg's avatar Richard Eisenberg
Browse files

Fix embarrassing, egregious bug in roles of (->)

Previously, I had inexplicably decided that (->)'s roles
were all Representational. But, of course, its first two
parameters are *dependent* RuntimeReps. All dependent parameters
have a Nominal role, because all roles in kinds are Nominal.

Fix is easy, but I have no idea how the world hasn't come
crashing down before now.

This was found while investigating #15801, which requires
visible type application in types to observe. Hence, the test
case will come with the main patch for #12045.
parent 82a71643
......@@ -903,7 +903,7 @@ pprRoles :: (Role -> Bool) -> SDoc -> [IfaceTyConBinder]
pprRoles suppress_if tyCon bndrs roles
= sdocWithDynFlags $ \dflags ->
let froles = suppressIfaceInvisibles dflags bndrs roles
in ppUnless (all suppress_if roles || null froles) $
in ppUnless (all suppress_if froles || null froles) $
text "type role" <+> tyCon <+> hsep (map ppr froles)
pprInfixIfDeclBndr :: ShowHowMuch -> OccName -> SDoc
......
......@@ -2259,7 +2259,7 @@ tyConRoles :: TyCon -> [Role]
-- See also Note [TyCon Role signatures]
tyConRoles tc
= case tc of
{ FunTyCon {} -> const_role Representational
{ FunTyCon {} -> [Nominal, Nominal, Representational, Representational]
; AlgTyCon { tcRoles = roles } -> roles
; SynonymTyCon { tcRoles = roles } -> roles
; FamilyTyCon {} -> const_role Nominal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment