[Git][ghc/ghc][wip/T24868] More wibbles

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Jun 5 16:48:22 UTC 2024



Simon Peyton Jones pushed to branch wip/T24868 at Glasgow Haskell Compiler / GHC


Commits:
f2e10a2c by Simon Peyton Jones at 2024-06-05T17:48:02+01:00
More wibbles

- - - - -


19 changed files:

- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/Ppr.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Runtime/Debugger.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- testsuite/tests/typecheck/should_compile/tc214.stderr
- testsuite/tests/typecheck/should_fail/T10709.stderr
- testsuite/tests/typecheck/should_fail/T10709b.stderr
- testsuite/tests/typecheck/should_fail/T13909.stderr
- testsuite/tests/typecheck/should_fail/tcfail201.stderr


Changes:

=====================================
compiler/GHC/Core/TyCo/FVs.hs
=====================================
@@ -290,16 +290,19 @@ runTyCoVars f = appEndo f emptyVarSet
 ********************************************************************* -}
 
 tyCoVarsOfType :: Type -> TyCoVarSet
+-- The "deep" TyCoVars of the the type
 tyCoVarsOfType ty = runTyCoVars (deep_ty ty)
 -- Alternative:
 --   tyCoVarsOfType ty = closeOverKinds (shallowTyCoVarsOfType ty)
 
 tyCoVarsOfTypes :: [Type] -> TyCoVarSet
+-- The "deep" TyCoVars of the the type
 tyCoVarsOfTypes tys = runTyCoVars (deep_tys tys)
 -- Alternative:
 --   tyCoVarsOfTypes tys = closeOverKinds (shallowTyCoVarsOfTypes tys)
 
 tyCoVarsOfCo :: Coercion -> TyCoVarSet
+-- The "deep" TyCoVars of the the coercion
 -- See Note [Free variables of types]
 tyCoVarsOfCo co = runTyCoVars (deep_co co)
 


=====================================
compiler/GHC/Core/TyCo/Ppr.hs
=====================================
@@ -93,6 +93,13 @@ pprPrecTypeX env prec ty
     -- NB: debug-style is used for -dppr-debug
     --     dump-style  is used for -ddump-tc-trace etc
 
+tidyToIfaceTypeStyX :: TidyEnv -> Type -> PprStyle -> IfaceType
+tidyToIfaceTypeStyX env ty sty
+  | userStyle sty = tidyToIfaceTypeX env ty
+  | otherwise     = toIfaceTypeX (tyCoVarsOfType ty) ty
+     -- in latter case, don't tidy, as we'll be printing uniques.
+
+
 pprTyLit :: TyLit -> SDoc
 pprTyLit = pprIfaceTyLit . toIfaceTyLit
 
@@ -100,12 +107,6 @@ pprKind, pprParendKind :: Kind -> SDoc
 pprKind       = pprType
 pprParendKind = pprParendType
 
-tidyToIfaceTypeStyX :: TidyEnv -> Type -> PprStyle -> IfaceType
-tidyToIfaceTypeStyX env ty sty
-  | userStyle sty = tidyToIfaceTypeX env ty
-  | otherwise     = toIfaceTypeX (tyCoVarsOfType ty) ty
-     -- in latter case, don't tidy, as we'll be printing uniques.
-
 tidyToIfaceType :: Type -> IfaceType
 tidyToIfaceType = tidyToIfaceTypeX emptyTidyEnv
 


=====================================
compiler/GHC/Core/TyCo/Tidy.hs
=====================================
@@ -4,14 +4,18 @@
 module GHC.Core.TyCo.Tidy
   (
         -- * Tidying type related things up for printing
-        tidyType,      tidyTypes,
-        tidyOpenType,  tidyOpenTypes,
-        tidyVarBndr, tidyVarBndrs, tidyFreeTyCoVars, avoidNameClashes,
-        tidyOpenTyCoVar, tidyOpenTyCoVars, tidyAvoiding,
-        tidyTyCoVarOcc,
+        tidyType, tidyTypes,
+        tidyCo,   tidyCos,
         tidyTopType,
-        tidyCo, tidyCos,
-        tidyForAllTyBinder, tidyForAllTyBinders
+
+        tidyOpenType,  tidyOpenTypes,
+        tidyOpenTypeX, tidyOpenTypesX,
+        tidyFreeTyCoVars, tidyFreeTyCoVarX, tidyFreeTyCoVarsX,
+
+        tidyAvoiding,
+        tidyVarBndr, tidyVarBndrs, avoidNameClashes,
+        tidyForAllTyBinder, tidyForAllTyBinders,
+        tidyTyCoVarOcc
   ) where
 
 import GHC.Prelude
@@ -94,24 +98,27 @@ tidyForAllTyBinders tidy_env tvbs
 tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv
 -- ^ Add the free 'TyVar's to the env in tidy form,
 -- so that we can tidy the type they are free in
-tidyFreeTyCoVars tidy_env tyvars
-  = fst (tidyOpenTyCoVars tidy_env tyvars)
+-- Precondition: input free vars are
+--               (a) closed over kinds and
+--               (b) scope-sorted
+tidyFreeTyCoVars tidy_env tyvars = fst (tidyFreeTyCoVarsX tidy_env tyvars)
 
 ---------------
-tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
-tidyOpenTyCoVars env tyvars = mapAccumL tidyOpenTyCoVar env tyvars
+tidyFreeTyCoVarsX :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
+-- Precondition: input free vars are
+--               (a) closed over kinds and
+--               (b) scope-sorted
+tidyFreeTyCoVarsX env tyvars = mapAccumL tidyFreeTyCoVarX env tyvars
 
 ---------------
-tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
+tidyFreeTyCoVarX :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
 -- ^ Treat a new 'TyCoVar' as a binder, and give it a fresh tidy name
 -- using the environment if one has not already been allocated. See
 -- also 'tidyVarBndr'
-tidyOpenTyCoVar env@(_, subst) tyvar
+tidyFreeTyCoVarX env@(_, subst) tyvar
   = case lookupVarEnv subst tyvar of
-        Just tyvar' -> (env, tyvar')              -- Already substituted
-        Nothing     ->
-          let env' = tidyFreeTyCoVars env (tyCoVarsOfTypeList (tyVarKind tyvar))
-          in tidyVarBndr env' tyvar  -- Treat it as a binder
+        Just tyvar' -> (env, tyvar')           -- Already substituted
+        Nothing     -> tidyVarBndr env tyvar  -- Treat it as a binder
 
 ---------------
 tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
@@ -171,8 +178,13 @@ tidyType env (ty@(ForAllTy{}))      = tidyForAllType env ty
 
 
 tidyForAllType :: TidyEnv -> Type -> Type
-tidyForAllType (occ_env, var_env) ty
+tidyForAllType env ty
    = (mkForAllTys' $! (zip tcvs' vis)) $! tidyType body_env body_ty
+  where
+    (tcvs, vis, body_ty) = splitForAllTyCoVars' ty
+    (body_env, tcvs') = tidyVarBndrs env tcvs
+
+{-
   where
     (tcvs, vis, body_ty) = splitForAllTyCoVars' ty
     free_tcvs            = tyCoVarsOfType ty
@@ -188,7 +200,7 @@ tidyForAllType (occ_env, var_env) ty
         occ = case lookupVarEnv var_env var of
                 Just var' -> getOccName var'
                 Nothing   -> getOccName var
-
+-}
 
 -- The following two functions differ from mkForAllTys and splitForAllTyCoVars in that
 -- they expect/preserve the ForAllTyFlag argument. These belong to "GHC.Core.Type", but
@@ -258,23 +270,39 @@ We can see:
 Ideally we'd like to do this at every forall, but we make do with doing it
 once at the top level of `tidyOpenTypes`, and that turns out quite well.
 -}
+---------------
+trimTidyEnv :: TidyEnv -> [TyCoVar] -> TidyEnv
+trimTidyEnv (occ_env, var_env) tcvs
+  = (trimTidyOccEnv occ_env (map getOccName tcvs), var_env)
+
 ---------------
 -- | Grabs the free type variables, tidies them
 -- and then uses 'tidyType' to work over the type itself
-tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
-tidyOpenTypes env tys
-  = (env', tidyTypes inner_env tys)
+tidyOpenTypesX :: TidyEnv -> [Type] -> (TidyEnv, [Type])
+tidyOpenTypesX env tys
+  = (env1, tidyTypes inner_env tys)
   where
-    free_tvs = tyCoVarsOfTypesWellScoped tys
-    (env'@(occ_env, var_env), _) = tidyOpenTyCoVars env free_tvs
-    trimmed_occ_env = trimTidyOccEnv occ_env (map getOccName free_tvs)
-    inner_env = (trimmed_occ_env, var_env)
+    free_tcvs :: [TyCoVar] -- Closed over kinds, scope-sorted
+    free_tcvs = tyCoVarsOfTypesWellScoped tys
+    (env1, free_tcvs') = tidyFreeTyCoVarsX env free_tcvs
+    inner_env          = trimTidyEnv env1 free_tcvs'
     -- inner_env: see Note [Tidying open types]
 
 ---------------
-tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
-tidyOpenType env ty = let (env', [ty']) = tidyOpenTypes env [ty] in
-                      (env', ty')
+tidyOpenTypeX :: TidyEnv -> Type -> (TidyEnv, Type)
+tidyOpenTypeX env ty
+  = (env1, tidyType inner_env ty)
+  where
+    free_tcvs = tyCoVarsOfTypeWellScoped ty
+    (env1, free_tcvs') = tidyFreeTyCoVarsX env free_tcvs
+    inner_env          = trimTidyEnv env1 free_tcvs'
+
+---------------
+tidyOpenTypes :: TidyEnv -> [Type] -> [Type]
+tidyOpenTypes env ty = snd (tidyOpenTypesX env ty)
+
+tidyOpenType :: TidyEnv -> Type -> Type
+tidyOpenType env ty = snd (tidyOpenTypeX env ty)
 
 ---------------
 -- | Calls 'tidyType' on a top-level type (i.e. with an empty tidying environment)


=====================================
compiler/GHC/Core/Type.hs
=====================================
@@ -226,8 +226,10 @@ module GHC.Core.Type (
         -- * Tidying type related things up for printing
         tidyType,      tidyTypes,
         tidyOpenType,  tidyOpenTypes,
-        tidyVarBndr, tidyVarBndrs, tidyFreeTyCoVars,
-        tidyOpenTyCoVar, tidyOpenTyCoVars,
+        tidyOpenTypeX, tidyOpenTypesX,
+        tidyVarBndr, tidyVarBndrs,
+        tidyFreeTyCoVars,
+        tidyFreeTyCoVarX, tidyFreeTyCoVarsX,
         tidyTyCoVarOcc,
         tidyTopType,
         tidyForAllTyBinder, tidyForAllTyBinders,


=====================================
compiler/GHC/Rename/Names.hs
=====================================
@@ -1758,7 +1758,7 @@ warnMissingSignatures gbl_env
              add_binding_warn id =
                when (not_ghc_generated name) $
                do { env <- liftZonkM $ tcInitTidyEnv -- Why not use emptyTidyEnv?
-                  ; let (_, ty) = tidyOpenType env (idType id)
+                  ; let ty = tidyOpenType env (idType id)
                         missing = MissingTopLevelBindingSig name ty
                         diag = TcRnMissingSignature missing exported
                   ; addDiagnosticAt (getSrcSpan name) diag }


=====================================
compiler/GHC/Runtime/Debugger.hs
=====================================
@@ -138,7 +138,7 @@ pprintClosureCommand bindThings force str = do
            -- It's OK to use nonDetEltsUniqSet here because initTidyOccEnv
            -- forgets the ordering immediately by creating an env
                         , getUniqSet $ env_tvs `intersectVarSet` my_tvs)
-     return $ mapTermType (snd . tidyOpenType tidyEnv) t
+     return $ mapTermType (tidyOpenType tidyEnv) t
 
 -- | Give names, and bind in the interactive environment, to all the suspensions
 --   included (inductively) in a term


=====================================
compiler/GHC/Runtime/Eval.hs
=====================================
@@ -597,8 +597,8 @@ bindLocalsAtBreakpoint hsc_env apStack_fhv (Just ibi) = do
    let tv_subst     = newTyVars us free_tvs
        (filtered_ids, occs'') = unzip         -- again, sync the occ-names
           [ (id, occ) | (id, Just _hv, occ) <- zip3 ids mb_hValues occs' ]
-       (_,tidy_tys) = tidyOpenTypes emptyTidyEnv $
-                      map (substTy tv_subst . idType) filtered_ids
+       tidy_tys = tidyOpenTypes emptyTidyEnv $
+                  map (substTy tv_subst . idType) filtered_ids
 
    new_ids     <- zipWith3M mkNewId occs'' tidy_tys filtered_ids
    result_name <- newInteractiveBinder hsc_env (mkVarOccFS result_fs) span


=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -3393,7 +3393,7 @@ format_frr_err :: Type  -- ^ the type which doesn't have a fixed runtime represe
 format_frr_err ty
   = (bullet <+> ppr tidy_ty <+> dcolon <+> ppr tidy_ki)
   where
-    (tidy_env, tidy_ty) = tidyOpenType emptyTidyEnv ty
+    (tidy_env, tidy_ty) = tidyOpenTypeX emptyTidyEnv ty
     tidy_ki             = tidyType tidy_env (typeKind ty)
 
 pprField :: (FieldLabelString, TcType) -> SDoc


=====================================
compiler/GHC/Tc/Gen/Bind.hs
=====================================
@@ -59,7 +59,7 @@ import GHC.Core.Multiplicity
 import GHC.Core.FamInstEnv( normaliseType )
 import GHC.Core.Class   ( Class )
 import GHC.Core.Coercion( mkSymCo )
-import GHC.Core.Type (mkStrLitTy, tidyOpenType, mkCastTy)
+import GHC.Core.Type (mkStrLitTy, tidyOpenTypeX, mkCastTy)
 import GHC.Core.TyCo.Ppr( pprTyVars )
 
 import GHC.Builtin.Types ( mkConstraintTupleTy, multiplicityTy, oneDataConTy  )
@@ -1179,7 +1179,7 @@ localSigWarn id mb_sig
 warnMissingSignatures :: Id -> TcM ()
 warnMissingSignatures id
   = do  { env0 <- liftZonkM $ tcInitTidyEnv
-        ; let (env1, tidy_ty) = tidyOpenType env0 (idType id)
+        ; let (env1, tidy_ty) = tidyOpenTypeX env0 (idType id)
         ; let dia = TcRnPolymorphicBinderMissingSig (idName id) tidy_ty
         ; addDiagnosticTcM (env1, dia) }
 


=====================================
compiler/GHC/Tc/Solver/Monad.hs
=====================================
@@ -1889,8 +1889,8 @@ solverDepthError loc ty
            do { ty   <- TcM.zonkTcType ty
               ; env0 <- TcM.tcInitTidyEnv
               ; return (ty, env0) }
-       ; let tidy_env     = tidyFreeTyCoVars env0 (tyCoVarsOfTypeList ty)
-             tidy_ty      = tidyType tidy_env ty
+       ; let tidy_env = tidyFreeTyCoVars env0 (tyCoVarsOfTypeList ty)
+             tidy_ty  = tidyType tidy_env ty
              msg = TcRnSolverDepthError tidy_ty depth
        ; TcM.failWithTcM (tidy_env, msg) }
   where


=====================================
compiler/GHC/Tc/Types/Origin.hs
=====================================
@@ -392,7 +392,8 @@ pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
 -- The type is already tidied
 pprSigSkolInfo ctxt ty
   = case ctxt of
-       FunSigCtxt f _ -> vcat [ text "the type signature for:"
+       FunSigCtxt f _ -> pprTrace "ppse" (ppr (tyCoVarsOfType ty)) $
+                         vcat [ text "the type signature for:"
                               , nest 2 (pprPrefixOcc f <+> dcolon <+> ppr ty) ]
        PatSynCtxt {}  -> pprUserTypeCtxt ctxt  -- See Note [Skolem info for pattern synonyms]
        _              -> vcat [ pprUserTypeCtxt ctxt <> colon


=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -1914,7 +1914,8 @@ defaultTyVar def_strat tv
            ; liftZonkM $ writeMetaTyVar kv liftedTypeKind
            ; return True }
       | otherwise
-      = do { addErr $ TcRnCannotDefaultKindVar kv' (tyVarKind kv')
+      = do { let (tidy_env, kv') = tidyFreeTyCoVarX emptyTidyEnv kv
+           ; addErrTcM $ (tidy_env, TcRnCannotDefaultKindVar kv' (tyVarKind kv'))
            -- We failed to default it, so return False to say so.
            -- Hence, it'll get skolemised.  That might seem odd, but we must either
            -- promote, skolemise, or zap-to-Any, to satisfy GHC.Tc.Gen.HsType
@@ -1923,8 +1924,6 @@ defaultTyVar def_strat tv
            -- because we are in an error situation anyway.
            ; return False
         }
-      where
-        (_, kv') = tidyOpenTyCoVar emptyTidyEnv kv
 
 -- | Default some unconstrained type variables, as specified
 -- by the defaulting options:
@@ -2130,7 +2129,7 @@ doNotQuantifyTyVars dvs where_found
           -- are OK
        ; let leftover_metas = filter isMetaTyVar undefaulted
        ; unless (null leftover_metas) $
-         do { let (tidy_env1, tidied_tvs) = tidyOpenTyCoVars emptyTidyEnv leftover_metas
+         do { let (tidy_env1, tidied_tvs) = tidyFreeTyCoVarsX emptyTidyEnv leftover_metas
             ; (tidy_env2, where_doc) <- liftZonkM $ where_found tidy_env1
             ; let msg = TcRnUninferrableTyVar tidied_tvs where_doc
             ; failWithTcM (tidy_env2, msg) }


=====================================
compiler/GHC/Tc/Validity.hs
=====================================
@@ -290,7 +290,7 @@ checkUserTypeError ctxt ty
 
   | Just msg <- deepUserTypeError_maybe ty
   = do { env0 <- liftZonkM tcInitTidyEnv
-       ; let (env1, tidy_msg) = tidyOpenType env0 msg
+       ; let (env1, tidy_msg) = tidyOpenTypeX env0 msg
        ; failWithTcM (env1, TcRnUserTypeError tidy_msg) }
   | otherwise
   = return ()
@@ -793,7 +793,9 @@ check_type ve@(ValidityEnv{ ve_tidy_env = env
                           , ve_rank = rank, ve_expand = expand }) ty
   | not (null tvbs && null theta)
   = do  { traceTc "check_type" (ppr ty $$ ppr rank)
-        ; checkTcM (forAllAllowed rank) (env, TcRnForAllRankErr rank (tidyType env ty))
+        ; checkTcM (forAllAllowed rank) $
+          let (env1, tidy_ty) = tidyOpenTypeX env ty
+          in  (env1, TcRnForAllRankErr rank tidy_ty)
                 -- Reject e.g. (Maybe (?x::Int => Int)),
                 -- with a decent error message
 


=====================================
compiler/GHC/Tc/Zonk/TcType.hs
=====================================
@@ -560,12 +560,11 @@ tcInitTidyEnv
 tcInitOpenTidyEnv :: [TyCoVar] -> ZonkM TidyEnv
 tcInitOpenTidyEnv tvs
   = do { env1 <- tcInitTidyEnv
-       ; let env2 = tidyFreeTyCoVars env1 tvs
-       ; return env2 }
+       ; return (tidyFreeTyCoVars env1 tvs) }
 
 zonkTidyTcType :: TidyEnv -> TcType -> ZonkM (TidyEnv, TcType)
 zonkTidyTcType env ty = do { ty' <- zonkTcType ty
-                           ; return (tidyOpenType env ty') }
+                           ; return (tidyOpenTypeX env ty') }
 
 zonkTidyTcTypes :: TidyEnv -> [TcType] -> ZonkM (TidyEnv, [TcType])
 zonkTidyTcTypes = zonkTidyTcTypes' []
@@ -642,7 +641,7 @@ zonkTidyFRRInfos = go []
 
     go_mb_not_conc env Nothing = return (env, Nothing)
     go_mb_not_conc env (Just (tv, ty))
-      = do { (env, tv) <- return $ tidyOpenTyCoVar env tv
+      = do { (env, tv) <- return $ tidyFreeTyCoVarX env tv
            ; (env, ty) <- zonkTidyTcType env ty
            ; return (env, Just (tv, ty)) }
 
@@ -654,12 +653,12 @@ tidyCt env = updCtEvidence (tidyCtEvidence env)
 tidyCtEvidence :: TidyEnv -> CtEvidence -> CtEvidence
      -- NB: we do not tidy the ctev_evar field because we don't
      --     show it in error messages
-tidyCtEvidence env ctev = ctev { ctev_pred = tidyType env ty }
+tidyCtEvidence env ctev = ctev { ctev_pred = tidyOpenType env ty }
   where
     ty  = ctev_pred ctev
 
 tidyHole :: TidyEnv -> Hole -> Hole
-tidyHole env h@(Hole { hole_ty = ty }) = h { hole_ty = tidyType env ty }
+tidyHole env h@(Hole { hole_ty = ty }) = h { hole_ty = tidyOpenType env ty }
 
 tidyDelayedError :: TidyEnv -> DelayedError -> DelayedError
 tidyDelayedError env (DE_Hole hole)


=====================================
testsuite/tests/typecheck/should_compile/tc214.stderr
=====================================
@@ -6,9 +6,9 @@ tc214.hs:19:7: warning: [GHC-40564] [-Winaccessible-code (in -Wdefault)]
     • Inaccessible code in
         a pattern with constructor: F2 :: forall a. a -> Foo2 [a],
         in an equation for ‘bar2’
-      Couldn't match type ‘a’ with ‘forall a. a’
+      Couldn't match type ‘a’ with ‘forall a1. a1’
       Cannot equate type variable ‘a’
-      with a type involving polytypes: forall a. a
+      with a type involving polytypes: forall a1. a1
       ‘a’ is a rigid type variable bound by
         a pattern with constructor: F2 :: forall a. a -> Foo2 [a],
         in an equation for ‘bar2’


=====================================
testsuite/tests/typecheck/should_fail/T10709.stderr
=====================================
@@ -14,22 +14,26 @@ T10709.hs:6:21: error: [GHC-91028]
         x1 :: a2 -> IO [a3] (bound at T10709.hs:6:1)
 
 T10709.hs:7:22: error: [GHC-91028]
-    • Couldn't match type ‘a1’ with ‘(forall a. IO a -> IO a) -> IO a’
+    • Couldn't match type ‘a1’
+                     with ‘(forall a2. IO a2 -> IO a2) -> IO a’
       Expected: a1 -> IO a
-        Actual: ((forall a. IO a -> IO a) -> IO a) -> IO a
+        Actual: ((forall a1. IO a1 -> IO a1) -> IO a) -> IO a
       Cannot instantiate unification variable ‘a1’
-      with a type involving polytypes: (forall a. IO a -> IO a) -> IO a
+      with a type involving polytypes:
+        (forall a2. IO a2 -> IO a2) -> IO a
     • In the second argument of ‘(.)’, namely ‘mask’
       In the expression: (replicateM 2 . mask) undefined
       In an equation for ‘x2’: x2 = (replicateM 2 . mask) undefined
     • Relevant bindings include x2 :: IO [a] (bound at T10709.hs:7:1)
 
 T10709.hs:8:22: error: [GHC-91028]
-    • Couldn't match type ‘a0’ with ‘(forall a. IO a -> IO a) -> IO a’
+    • Couldn't match type ‘a0’
+                     with ‘(forall a1. IO a1 -> IO a1) -> IO a’
       Expected: a0 -> IO a
-        Actual: ((forall a. IO a -> IO a) -> IO a) -> IO a
+        Actual: ((forall a1. IO a1 -> IO a1) -> IO a) -> IO a
       Cannot instantiate unification variable ‘a0’
-      with a type involving polytypes: (forall a. IO a -> IO a) -> IO a
+      with a type involving polytypes:
+        (forall a1. IO a1 -> IO a1) -> IO a
     • In the second argument of ‘(.)’, namely ‘mask’
       In the first argument of ‘($)’, namely ‘(replicateM 2 . mask)’
       In the expression: (replicateM 2 . mask) $ undefined


=====================================
testsuite/tests/typecheck/should_fail/T10709b.stderr
=====================================
@@ -12,7 +12,7 @@ T10709b.hs:6:22: error: [GHC-91028]
 T10709b.hs:7:22: error: [GHC-91028]
     • Couldn't match type ‘t1’ with ‘forall a. IO a -> IO a’
       Expected: (t1 -> IO a) -> IO a
-        Actual: ((forall a. IO a -> IO a) -> IO a) -> IO a
+        Actual: ((forall a1. IO a1 -> IO a1) -> IO a) -> IO a
       Cannot instantiate unification variable ‘t1’
       with a type involving polytypes: forall a. IO a -> IO a
     • In the second argument of ‘(.)’, namely ‘mask’
@@ -23,7 +23,7 @@ T10709b.hs:7:22: error: [GHC-91028]
 T10709b.hs:8:22: error: [GHC-91028]
     • Couldn't match type ‘t0’ with ‘forall a. IO a -> IO a’
       Expected: (t0 -> IO a) -> IO a
-        Actual: ((forall a. IO a -> IO a) -> IO a) -> IO a
+        Actual: ((forall a1. IO a1 -> IO a1) -> IO a) -> IO a
       Cannot instantiate unification variable ‘t0’
       with a type involving polytypes: forall a. IO a -> IO a
     • In the second argument of ‘(.)’, namely ‘mask’
@@ -34,7 +34,7 @@ T10709b.hs:8:22: error: [GHC-91028]
 T10709b.hs:9:22: error: [GHC-91028]
     • Couldn't match type ‘b0’ with ‘forall a. IO a -> IO a’
       Expected: (b0 -> IO a) -> IO a
-        Actual: ((forall a. IO a -> IO a) -> IO a) -> IO a
+        Actual: ((forall a1. IO a1 -> IO a1) -> IO a) -> IO a
       Cannot instantiate unification variable ‘b0’
       with a type involving polytypes: forall a. IO a -> IO a
     • In the second argument of ‘(.)’, namely ‘mask’
@@ -45,7 +45,7 @@ T10709b.hs:9:22: error: [GHC-91028]
 T10709b.hs:10:22: error: [GHC-91028]
     • Couldn't match type ‘a0’ with ‘forall a. IO a -> IO a’
       Expected: (a0 -> IO a) -> IO a
-        Actual: ((forall a. IO a -> IO a) -> IO a) -> IO a
+        Actual: ((forall a1. IO a1 -> IO a1) -> IO a) -> IO a
       Cannot instantiate unification variable ‘a0’
       with a type involving polytypes: forall a. IO a -> IO a
     • In the second argument of ‘(.)’, namely ‘mask’


=====================================
testsuite/tests/typecheck/should_fail/T13909.stderr
=====================================
@@ -2,7 +2,7 @@ T13909.hs:11:18: error: [GHC-91028]
     • Expecting two more arguments to ‘Hm’
       Expected kind ‘k’, but ‘Hm’ has kind ‘forall k -> k -> *’
       Cannot equate type variable ‘k’
-      with a kind involving polytypes: forall k -> k -> *
+      with a kind involving polytypes: forall k1 -> k1 -> *
       ‘k’ is a rigid type variable bound by
         an instance declaration
         at T13909.hs:11:10-19


=====================================
testsuite/tests/typecheck/should_fail/tcfail201.stderr
=====================================
@@ -3,7 +3,7 @@ tcfail201.hs:17:27: error: [GHC-25897]
       ‘a’ is a rigid type variable bound by
         the type signature for:
           gfoldl' :: forall (c :: * -> *) a.
-                     (forall a b. c (a -> b) -> a -> c b)
+                     (forall a1 b. c (a1 -> b) -> a1 -> c b)
                      -> (forall g. g -> c g) -> a -> c a
         at tcfail201.hs:15:1-85
     • In the pattern: DocEmpty
@@ -11,7 +11,7 @@ tcfail201.hs:17:27: error: [GHC-25897]
       In the expression: case hsDoc of DocEmpty -> z DocEmpty
     • Relevant bindings include
         hsDoc :: a (bound at tcfail201.hs:16:13)
-        gfoldl' :: (forall a b. c (a -> b) -> a -> c b)
+        gfoldl' :: (forall a1 b. c (a1 -> b) -> a1 -> c b)
                    -> (forall g. g -> c g) -> a -> c a
           (bound at tcfail201.hs:16:1)
 



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f2e10a2ca9132a1670256a1ca9ab6eb2d1177e50
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/20240605/64fde65a/attachment-0001.html>


More information about the ghc-commits mailing list