[Git][ghc/ghc][wip/T25647] Revert "use TyVarTv for wildcard in HM_FamPat"

Patrick (@soulomoon) gitlab at gitlab.haskell.org
Wed Feb 12 17:45:39 UTC 2025



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


Commits:
3a756702 by Patrick at 2025-02-13T01:45:25+08:00
Revert "use TyVarTv for wildcard in HM_FamPat"

This reverts commit 638d6763d0b972f3c9a0e2c4218d8c7ce34dc800.

- - - - -


3 changed files:

- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- testsuite/tests/typecheck/should_compile/T25647a.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -2233,7 +2233,7 @@ tcAnonWildCardOcc is_extra (TcTyMode { mode_holes = Just (hole_lvl, hole_mode) }
      -- See Note [Wildcard names]
      (wc_nm, mk_wc_details) = case hole_mode of
                HM_Sig      -> (fsLit "w", newTauTvDetailsAtLevel)
-               HM_FamPat   -> (fsLit "_", newTyVarTvDetailsAtLevel)
+               HM_FamPat   -> (fsLit "_", newNoDefTauTvDetailsAtLevel)
                HM_VTA      -> (fsLit "w", newTauTvDetailsAtLevel)
                HM_TyAppPat -> (fsLit "_", newTauTvDetailsAtLevel)
 


=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -34,7 +34,7 @@ module GHC.Tc.Utils.TcMType (
 
   newMultiplicityVar,
   readMetaTyVar, writeMetaTyVar, writeMetaTyVarRef,
-  newTyVarTvDetailsAtLevel, newTauTvDetailsAtLevel,
+  newNoDefTauTvDetailsAtLevel, newTauTvDetailsAtLevel,
   newMetaDetails, newMetaTyVarName,
   isFilledMetaTyVar_maybe, isFilledMetaTyVar, isUnfilledMetaTyVar,
 
@@ -901,10 +901,10 @@ newTauTvDetailsAtLevel tclvl
                         , mtv_ref   = ref
                         , mtv_tclvl = tclvl }) }
 
-newTyVarTvDetailsAtLevel :: TcLevel -> TcM TcTyVarDetails
-newTyVarTvDetailsAtLevel tclvl
+newNoDefTauTvDetailsAtLevel :: TcLevel -> TcM TcTyVarDetails
+newNoDefTauTvDetailsAtLevel tclvl
   = do { ref <- newMutVar Flexi
-       ; return (MetaTv { mtv_info  = TyVarTv
+       ; return (MetaTv { mtv_info  = NoDefTauTv
                         , mtv_ref   = ref
                         , mtv_tclvl = tclvl }) }
 


=====================================
testsuite/tests/typecheck/should_compile/T25647a.hs
=====================================
@@ -94,23 +94,5 @@ dix9 (Dix9 x) = x
 -- anonymous wildcard should work
 class DixC10 a where
   type Dix10 a
--- instance DixC10 Int where -- type is not allowed to match against a wildcard
-instance DixC10 a where
+instance DixC10 Int where
   type Dix10 _ = Bool
-
--- wildcard can match with type variable however
-data Tree a = Leaf a | Node (Tree (G a a)) (Tree (G a a))
-class D a where
-  type G a b
-
-class C a where { type T a b }
-
-instance C (p,p) where
-    type T (_,_) b = Int
-
-instance C (Maybe [a]) where
-  type T (Maybe [a]) _ = a->a
-
-instance C (Tree a) where
-  type T (Tree _) b = b->b
-



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3a7567028f207ce5f4bc874501953a8a0b4faa41
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/20250212/020e4358/attachment-0001.html>


More information about the ghc-commits mailing list