[commit: ghc] master: OptCoercion: Ensure we use new UnivCo provenance to construct optimised cos. (f1b097f)

git at git.haskell.org git at git.haskell.org
Thu Jun 14 14:03:59 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f1b097f9b4798a7f92b176517896dba1ce90736a/ghc

>---------------------------------------------------------------

commit f1b097f9b4798a7f92b176517896dba1ce90736a
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue Jun 12 13:31:08 2018 -0400

    OptCoercion: Ensure we use new UnivCo provenance to construct optimised cos.
    
    @goldfire noticed that there were several points in OptOercion.opt_univ where
    we constructed the optimised coercion using the untransformed provenance.


>---------------------------------------------------------------

f1b097f9b4798a7f92b176517896dba1ce90736a
 compiler/types/OptCoercion.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/types/OptCoercion.hs b/compiler/types/OptCoercion.hs
index e862271..ccad41b 100644
--- a/compiler/types/OptCoercion.hs
+++ b/compiler/types/OptCoercion.hs
@@ -434,7 +434,7 @@ opt_univ env sym prov role oty1 oty2
       -- NB: prov must not be the two interesting ones (ProofIrrel & Phantom);
       -- Phantom is already taken care of, and ProofIrrel doesn't relate tyconapps
   = let roles    = tyConRolesX role tc1
-        arg_cos  = zipWith3 (mkUnivCo prov) roles tys1 tys2
+        arg_cos  = zipWith3 (mkUnivCo prov') roles tys1 tys2
         arg_cos' = zipWith (opt_co4 env sym False) roles arg_cos
     in
     mkTyConAppCo role tc1 arg_cos'
@@ -446,13 +446,13 @@ opt_univ env sym prov role oty1 oty2
       -- NB: prov isn't interesting here either
   = let k1   = tyVarKind tv1
         k2   = tyVarKind tv2
-        eta  = mkUnivCo prov Nominal k1 k2
+        eta  = mkUnivCo prov' Nominal k1 k2
           -- eta gets opt'ed soon, but not yet.
         ty2' = substTyWith [tv2] [TyVarTy tv1 `mkCastTy` eta] ty2
 
         (env', tv1', eta') = optForAllCoBndr env sym tv1 eta
     in
-    mkForAllCo tv1' eta' (opt_univ env' sym prov role ty1 ty2')
+    mkForAllCo tv1' eta' (opt_univ env' sym prov' role ty1 ty2')
 
   | otherwise
   = let ty1 = substTyUnchecked (lcSubstLeft  env) oty1



More information about the ghc-commits mailing list