[Git][ghc/ghc][master] Add a missing tidy in UnivCo

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sun Oct 27 19:10:43 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
9f02dfb5 by Simon Peyton Jones at 2024-10-27T15:10:08-04:00
Add a missing tidy in UnivCo

We were failing to tidy the argument coercions of a UnivCo, which
led directly to #25391.

The fix is, happily, trivial.

I don't have a small repro case (it came up when building horde-ad,
which uses typechecker plugins).  It should be possible to make a
repro case, by using a plugin (which builds a UnivCo) but I decided
it was not worth the bother. The bug is egregious and easily fixed.

- - - - -


1 changed file:

- compiler/GHC/Core/TyCo/Tidy.hs


Changes:

=====================================
compiler/GHC/Core/TyCo/Tidy.hs
=====================================
@@ -336,16 +336,18 @@ tidyCo env co
     go (AppCo co1 co2)       = (AppCo $! go co1) $! go co2
     go (ForAllCo tv visL visR h co)
       = ((((ForAllCo $! tvp) $! visL) $! visR) $! (go h)) $! (tidyCo envp co)
-                               where (envp, tvp) = tidyVarBndr env tv
+      where (envp, tvp) = tidyVarBndr env tv
             -- the case above duplicates a bit of work in tidying h and the kind
             -- of tv. But the alternative is to use coercionKind, which seems worse.
     go (FunCo r afl afr w co1 co2) = ((FunCo r afl afr $! go w) $! go co1) $! go co2
     go (CoVarCo cv)          = CoVarCo $! go_cv cv
     go (HoleCo h)            = HoleCo $! go_hole h
     go (AxiomCo ax cos)      = AxiomCo ax $ strictMap go cos
-    go co@(UnivCo { uco_lty  = t1, uco_rty = t2 })
-                             = co { uco_lty = tidyType env t1, uco_rty = tidyType env t2 }
-                               -- Don't bother to tidy the uco_deps field
+    go (UnivCo prov role t1 t2 cos)
+                             = ((UnivCo prov role
+                                $! tidyType env t1)
+                                $! tidyType env t2)
+                                $! strictMap go cos
     go (SymCo co)            = SymCo $! go co
     go (TransCo co1 co2)     = (TransCo $! go co1) $! go co2
     go (SelCo d co)          = SelCo d $! go co



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9f02dfb502dda37fc50c66ce7ebd55cc36350a45
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/20241027/c57427bd/attachment-0001.html>


More information about the ghc-commits mailing list