diff options
Diffstat (limited to 'compiler/GHC')
-rw-r--r-- | compiler/GHC/Builtin/Types.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/CoreToIface.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Iface/Type.hs | 13 |
3 files changed, 17 insertions, 4 deletions
diff --git a/compiler/GHC/Builtin/Types.hs b/compiler/GHC/Builtin/Types.hs index d9cf158ef6..055ca17c97 100644 --- a/compiler/GHC/Builtin/Types.hs +++ b/compiler/GHC/Builtin/Types.hs @@ -1018,7 +1018,9 @@ mk_tuple Unboxed arity = (tycon, tuple_con) UnboxedTuple flavour -- See Note [Unboxed tuple RuntimeRep vars] in GHC.Core.TyCon - -- Kind: forall (k1:RuntimeRep) (k2:RuntimeRep). TYPE k1 -> TYPE k2 -> # + -- Example: the kind of (#,#) is + -- forall (k1::RuntimeRep) (k2::RuntimeRep). TYPE k1 -> TYPE k2 -> + -- TYPE (TupleRep '[k1, k2]) tc_binders = mkTemplateTyConBinders (replicate arity runtimeRepTy) (\ks -> map tYPE ks) diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs index a65e89853c..e05741d11b 100644 --- a/compiler/GHC/CoreToIface.hs +++ b/compiler/GHC/CoreToIface.hs @@ -189,8 +189,8 @@ toIfaceTypeX fr (TyConApp tc tys) | Just dc <- isPromotedDataCon_maybe tc , isBoxedTupleDataCon dc - , n_tys == 2*arity - = IfaceTupleTy BoxedTuple IsPromoted (toIfaceTcArgsX fr tc (drop arity tys)) + , n_tys == arity + = IfaceTupleTy BoxedTuple IsPromoted (toIfaceTcArgsX fr tc tys) | tc `elem` [ eqPrimTyCon, eqReprPrimTyCon, heqTyCon ] , (k1:k2:_) <- tys diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs index 57c31920b4..3438d3f5e2 100644 --- a/compiler/GHC/Iface/Type.hs +++ b/compiler/GHC/Iface/Type.hs @@ -1573,7 +1573,18 @@ pprTuple ctxt_prec sort promoted args = case promoted of IsPromoted -> let tys = appArgsIfaceTypes args - args' = drop (length tys `div` 2) tys + -- For promoted boxed tuples, drop half of the type arguments: + -- display '(,) @Type @(Type -> Type) Int Maybe + -- as '(Int, Maybe) + -- For promoted unboxed tuples, additionally drop RuntimeRep vars; + -- display '(#,#) @LiftedRep @LiftedRep @Type @(Type -> Type) Int Maybe + -- as '(# Int, Maybe #) + -- See Note [Unboxed tuple RuntimeRep vars] in GHC.Core.TyCon + -- and ticket #18653 + toDrop = case sort of + UnboxedTuple -> 2 * length tys `div` 3 + _ -> length tys `div` 2 + args' = drop toDrop tys spaceIfPromoted = case args' of arg0:_ -> pprSpaceIfPromotedTyCon arg0 _ -> id |