[Git][ghc/ghc][wip/T25647] limit WildCardTv to only HM_FamPat

Patrick (@soulomoon) gitlab at gitlab.haskell.org
Sat Feb 8 18:11:19 UTC 2025



Patrick pushed to branch wip/T25647 at Glasgow Haskell Compiler / GHC


Commits:
cb24202e by Patrick at 2025-02-09T02:11:09+08:00
limit WildCardTv to only HM_FamPat

- - - - -


2 changed files:

- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Utils/TcType.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -2212,7 +2212,7 @@ tcAnonWildCardOcc is_extra (TcTyMode { mode_holes = Just (hole_lvl, hole_mode) }
     --           esp the bullet on nested forall types
   = do { kv_details <- newTauTvDetailsAtLevel hole_lvl
        ; kv_name    <- newMetaTyVarName (fsLit "k")
-       ; wc_details <- newWildCardTvDetailsAtLevel hole_lvl
+       ; wc_details <- mk_wc_details hole_lvl
        ; wc_name    <- newMetaTyVarName wc_nm
        ; let kv      = mkTcTyVar kv_name liftedTypeKind kv_details
              wc_kind = mkTyVarTy kv
@@ -2231,11 +2231,11 @@ tcAnonWildCardOcc is_extra (TcTyMode { mode_holes = Just (hole_lvl, hole_mode) }
        ; checkExpectedKind ty (mkTyVarTy wc_tv) wc_kind exp_kind }
   where
      -- See Note [Wildcard names]
-     wc_nm = case hole_mode of
-               HM_Sig      -> fsLit "w"
-               HM_FamPat   -> fsLit "_"
-               HM_VTA      -> fsLit "w"
-               HM_TyAppPat -> fsLit "_"
+     (wc_nm, mk_wc_details) = case hole_mode of
+               HM_Sig      -> (fsLit "w", newTauTvDetailsAtLevel)
+               HM_FamPat   -> (fsLit "_", newWildCardTvDetailsAtLevel)
+               HM_VTA      -> (fsLit "w", newTauTvDetailsAtLevel)
+               HM_TyAppPat -> (fsLit "_", newTauTvDetailsAtLevel)
 
      emit_holes = case hole_mode of
                      HM_Sig     -> True
@@ -2402,8 +2402,7 @@ kcCheckDeclHeader_cusk name flav
              -- skolemise and then quantify over.  We do not include spec_req_tvs
              -- because they are /already/ skolems
 
-       ; inferred <- quantifyTyVars skol_info DefaultNonStandardTyVars $
-                     candidates `delCandidates` spec_req_tkvs
+       ; inferred <- quantifyTyVars skol_info $ candidates `delCandidates` spec_req_tkvs
                      -- NB: 'inferred' comes back sorted in dependency order
 
        ; (scoped_kvs, tc_bndrs, res_kind) <- liftZonkM $


=====================================
compiler/GHC/Tc/Utils/TcType.hs
=====================================
@@ -641,7 +641,7 @@ data MetaInfo
    = TauTv         -- ^ This MetaTv is an ordinary unification variable
                    -- A TauTv is always filled in with a tau-type, which
                    -- never contains any ForAlls.
-   | WildCardTv    -- ^ A variant of TauTv, except that is should not be
+   | WildCardTv    -- ^ A variant of TauTv, except that it should not be
                    -- defaulted.
    | TyVarTv       -- ^ A variant of TauTv, except that it should not be
                    --   unified with a type, only with a type variable



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cb24202e1123e81baf8aa1895dcf025ee3f63e93
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/20250208/c220dfc7/attachment-0001.html>


More information about the ghc-commits mailing list