diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2019-05-29 13:29:21 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-19 09:03:19 -0400 |
commit | c3eaaca63c81b3164e35b65d7b508bf2e8cb5fc6 (patch) | |
tree | 3290186f3ca97756db4ced593143c5ecc60e131b /compiler/simplCore/Simplify.hs | |
parent | c77fc3b20e93ba3215791d8d087a096853c4dd67 (diff) | |
download | haskell-c3eaaca63c81b3164e35b65d7b508bf2e8cb5fc6.tar.gz |
Add a missing update of sc_hole_ty (#16312)
In simplCast I totally failed to keep the sc_hole_ty field of
ApplyToTy (see Note [The hole type in ApplyToTy]) up to date.
When a cast goes by, of course the hole type changes.
Amazingly this has not bitten us before, but #16312 finally
triggered it. Fortunately the fix is simple.
Fixes #16312.
Diffstat (limited to 'compiler/simplCore/Simplify.hs')
-rw-r--r-- | compiler/simplCore/Simplify.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 6e13ddf59b..753cce3104 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1304,9 +1304,13 @@ simplCast env body co0 cont0 addCoerce co cont@(ApplyToTy { sc_arg_ty = arg_ty, sc_cont = tail }) | Just (arg_ty', m_co') <- pushCoTyArg co arg_ty + , Pair hole_ty _ <- coercionKind co = {-#SCC "addCoerce-pushCoTyArg" #-} do { tail' <- addCoerceM m_co' tail - ; return (cont { sc_arg_ty = arg_ty', sc_cont = tail' }) } + ; return (cont { sc_arg_ty = arg_ty' + , sc_hole_ty = hole_ty -- NB! As the cast goes past, the + -- type of the hole changes (#16312) + , sc_cont = tail' }) } addCoerce co cont@(ApplyToVal { sc_arg = arg, sc_env = arg_se , sc_dup = dup, sc_cont = tail }) |