summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@cs.brynmawr.edu>2018-11-01 15:07:36 -0400
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-11-01 17:34:47 -0400
commit255d2e323a8879a7296a5ab94e6cc49023e2c86e (patch)
treeed7de96fa0c938998128d560799ddb9497ef269f
parent82a716431cc680392e332bc2b1a1fd0d7faa4cd8 (diff)
downloadhaskell-255d2e323a8879a7296a5ab94e6cc49023e2c86e.tar.gz
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.
-rw-r--r--compiler/iface/IfaceSyn.hs2
-rw-r--r--compiler/types/TyCon.hs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs
index 3266c5aec1..7d1e697cdf 100644
--- a/compiler/iface/IfaceSyn.hs
+++ b/compiler/iface/IfaceSyn.hs
@@ -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
diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index c96cb6beb8..eeebf8b9cf 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -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