Fix optimisation of InstCo
It turned out (#25387) that the fix to #15725 was not quite right: commit 48efbc04 Date: Mon Oct 15 10:25:02 2018 +0200 Fix #15725 with an extra Sym Optimising InstCo is quite subtle, and the invariants surrounding the LiftingContext in the coercion optimiser were not stated explicitly. This patch refactors the InstCo optimisation, and documents these invariants. See * Note [Optimising InstCo] * Note [The LiftingContext in optCoercion] I also did some refactoring of course: * Instead of a Bool swap-flag, I am not using GHC.Types.Basic.SwapFlag * I added some invariant-checking the coercion-construction functions in GHC.Core.Coercion.Opt. (Sadly these invariants don't hold during typechecking, becuase the types are un-zonked, so I can't put these checks in GHC.Core.Coercion.)
Showing
- compiler/GHC/Core/Coercion.hs 47 additions, 24 deletionscompiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot 1 addition, 1 deletioncompiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Opt.hs 279 additions, 161 deletionscompiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/TyCo/Subst.hs 18 additions, 13 deletionscompiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/Type.hs 1 addition, 1 deletioncompiler/GHC/Core/Type.hs
- compiler/GHC/HsToCore.hs 1 addition, 1 deletioncompiler/GHC/HsToCore.hs
- compiler/GHC/Types/Basic.hs 10 additions, 1 deletioncompiler/GHC/Types/Basic.hs
- testsuite/tests/dependent/should_compile/T25387.hs 36 additions, 0 deletionstestsuite/tests/dependent/should_compile/T25387.hs
- testsuite/tests/dependent/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/dependent/should_compile/all.T
Loading
Please register or sign in to comment