[Git][ghc/ghc][wip/T18389] Restore Note that I accidentally deleted

Ryan Scott gitlab at gitlab.haskell.org
Sun Oct 25 11:28:52 UTC 2020



Ryan Scott pushed to branch wip/T18389 at Glasgow Haskell Compiler / GHC


Commits:
1bc50b8c by Ryan Scott at 2020-10-25T07:25:16-04:00
Restore Note that I accidentally deleted

- - - - -


1 changed file:

- compiler/GHC/Tc/TyCl.hs


Changes:

=====================================
compiler/GHC/Tc/TyCl.hs
=====================================
@@ -3310,6 +3310,7 @@ tcConDecl rep_tycon tag_map tmpl_bndrs _res_kind res_tmpl new_or_data
               do { ctxt <- tcHsMbContext cxt
                  ; btys <- tcConArgs hs_args
                  ; (res_ty, res_kind) <- tcInferLHsTypeKind hs_res_ty
+                         -- See Note [GADT return kinds]
                  ; let (arg_tys, stricts) = unzip btys
                  ; dflags <- getDynFlags
                  ; final_arg_tys <- unifyNewtypeKind dflags new_or_data
@@ -3368,6 +3369,20 @@ tcConDecl rep_tycon tag_map tmpl_bndrs _res_kind res_tmpl new_or_data
   where
     skol_info = DataConSkol (unLoc (head names))
 
+{- Note [GADT return kinds]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Consider
+   type family Star where Star = Type
+   data T :: Type where
+      MkT :: Int -> T
+
+If, for some stupid reason, tcInferLHsTypeKind on the return type of
+MkT returned (T |> ax, Star), then the return-type check in
+checkValidDataCon would reject the decl (although of course there is
+nothing wrong with it).  We are implicitly requiring tha
+tcInferLHsTypeKind doesn't any gratuitous top-level casts.
+-}
+
 tcConIsInfixH98 :: Name
              -> HsConDetails a b
              -> TcM Bool



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bc50b8c6b188870734ec49ab2edd51f734986a6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1bc50b8c6b188870734ec49ab2edd51f734986a6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201025/e799b948/attachment-0001.html>


More information about the ghc-commits mailing list