@@ -115,16 +115,29 @@ p_hsType = \case
115115 Promoted -> txt "'"
116116 NotPromoted -> return ()
117117 brackets $ do
118− case xs of
119− ((L _ (HsTyVar _ Promoted _)):_) -> space
118+ -- If both this list itself and the first element is promoted,
119+ -- we need to put a space in between or it fails to parse.
120+ case (p, xs) of
121+ (Promoted, ((L _ t):_)) | isPromoted t -> space
120122 _ -> return ()
121123 sitcc $ sep (comma >> breakpoint) (sitcc . located' p_hsType) xs
122124 HsExplicitTupleTy NoExt xs -> do
123125 txt "'"
124− parens $ sep (comma >> breakpoint) (located' p_hsType) xs
126+ parens $ do
127+ case xs of
128+ ((L _ t):_) | isPromoted t -> space
129+ _ -> return ()
130+ sep (comma >> breakpoint) (located' p_hsType) xs
125131 HsTyLit NoExt t -> atom t
126132 HsWildCardTy NoExt -> txt "_"
127133 XHsType (NHsCoreTy t) -> atom t
134+ where
135+ isPromoted = \case
136+ HsTyVar _ Promoted _ -> True
137+ HsExplicitListTy _ _ _ -> True
138+ HsExplicitTupleTy _ _ -> True
139+ _ -> False
140+
128141
129142p_hsContext :: HsContext GhcPs -> R ()
130143p_hsContext = \case