[Git][ghc/ghc][wip/cfuneqcan-refactor] Expand synonyms that mention families, obvs

Richard Eisenberg gitlab at gitlab.haskell.org
Sun Oct 11 15:21:51 UTC 2020



Richard Eisenberg pushed to branch wip/cfuneqcan-refactor at Glasgow Haskell Compiler / GHC


Commits:
16e56ac1 by Richard Eisenberg at 2020-10-11T11:21:36-04:00
Expand synonyms that mention families, obvs

- - - - -


1 changed file:

- compiler/GHC/Tc/Solver/Flatten.hs


Changes:

=====================================
compiler/GHC/Tc/Solver/Flatten.hs
=====================================
@@ -1126,8 +1126,8 @@ flatten_one (AppTy ty1 ty2)
 flatten_one ty@(TyConApp tc tys)
   -- Expand type synonyms that mention type families
   -- on the RHS; see Note [Flattening synonyms]
-  | isForgetfulSynTyCon tc
-  , Just expanded_ty <- tcView ty  -- should always succeed
+  | isForgetfulSynTyCon tc || not (isFamFreeTyCon tc)
+  , Just expanded_ty <- tcView ty
   = flatten_one expanded_ty
 
   -- Otherwise, it's a type function application, and we have to
@@ -1309,6 +1309,9 @@ synonyms, but not others.
 One nice consequence is that we never have to occCheckExpand flattened
 types, as any forgetful synonyms are already expanded.
 
+We also, of course, must expand type synonyms that mention type families,
+so those families can get reduced.
+
 Note [Flattening under a forall]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Under a forall, we



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16e56ac19b1b72223093b95bb462875c73289554

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16e56ac19b1b72223093b95bb462875c73289554
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/20201011/5941d48f/attachment.html>


More information about the ghc-commits mailing list