[Git][ghc/ghc][wip/T23051] Wibble

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Mar 15 17:30:21 UTC 2023



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


Commits:
129f8925 by Simon Peyton Jones at 2023-03-15T17:30:25+00:00
Wibble

- - - - -


2 changed files:

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


Changes:

=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -3547,8 +3547,12 @@ kindGeneralizeSome skol_info wanted kind_or_type
          -- here will already have all type variables quantified;
          -- thus, every free variable is really a kv, never a tv.
        ; dvs <- candidateQTyVarsOfKind kind_or_type
-       ; dvs <- filterConstrainedCandidates wanted dvs
-       ; quantifyTyVars skol_info DefaultNonStandardTyVars dvs }
+       ; filtered_dvs <- filterConstrainedCandidates wanted dvs
+       ; traceTc "kindGeneralizeSome" $
+         vcat [ text "type:" <+> ppr kind_or_type
+              , text "dvs:" <+> ppr dvs
+              , text "filtered_dvs:" <+> ppr filtered_dvs ]
+       ; quantifyTyVars skol_info DefaultNonStandardTyVars filtered_dvs }
 
 filterConstrainedCandidates
   :: WantedConstraints    -- Don't quantify over variables free in these


=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -1443,10 +1443,14 @@ collect_cand_qtvs orig_ty is_dep cur_lvl bound dvs ty
       = return dv   -- This variable is from an outer context; skip
                     -- See Note [Use level numbers for quantification]
 
---                | case tcTyVarDetails tv of
---                     SkolemTv _ lvl _ -> lvl > pushTcLevel cur_lvl
---                     _                -> False
---                -> return dv  -- Skip inner skolems; ToDo: explain
+      | case tcTyVarDetails tv of
+          SkolemTv _ lvl _ -> True  -- lvl > pushTcLevel cur_lvl
+          _                -> False
+      = return dv  -- Skip inner skolems
+        -- This only happens for erroneous program with bad telescopes
+        -- e.g. BadTelescope2:  forall a k (b :: k). SameKind a b
+        --      We have (a::k), and at the outer we don't want to quantify
+        --      over the already-quantified skolem k.
 
       | tv `elemDVarSet` kvs
       = return dv  -- We have met this tyvar already



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/129f8925ad710a57a9ecde766eafdcda24d6c071
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/20230315/0a5056c8/attachment-0001.html>


More information about the ghc-commits mailing list