diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2022-05-16 13:33:12 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2022-05-16 14:14:13 +0100 |
commit | 93a8f26c29ccb220ce12f0087eb464920097e128 (patch) | |
tree | d9f37f02373a17d534baed098f73eacb94cfc210 /compiler/GHC/Core | |
parent | aed356e1b68b2201fa6e3c5bf14079f3f3366b44 (diff) | |
download | haskell-wip/T21575.tar.gz |
Fix bad interaction between withDict and the Specialiserwip/T21575
This MR fixes a bad bug, where the withDict was inlined too
vigorously, which in turn made the type-class Specialiser generate
a bogus specialisation, because it saw the same overloaded function
applied to two /different/ dictionaries.
Solution: inline `withDict` later. See (WD8) of Note [withDict]
in GHC.HsToCore.Expr
See #21575, which is fixed by this change.
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r-- | compiler/GHC/Core/Coercion.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Core/TyCon.hs | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Coercion.hs b/compiler/GHC/Core/Coercion.hs index 235e8c65fb..98aa337026 100644 --- a/compiler/GHC/Core/Coercion.hs +++ b/compiler/GHC/Core/Coercion.hs @@ -1708,9 +1708,8 @@ has to do in its full generality. See #18413. %************************************************************************ -} --- | If @co :: T ts ~ rep_ty@ then: --- --- > instNewTyCon_maybe T ts = Just (rep_ty, co) +-- | If `instNewTyCon_maybe T ts = Just (rep_ty, co)` +-- then `co :: T ts ~R# rep_ty` -- -- Checks for a newtype, and for being saturated instNewTyCon_maybe :: TyCon -> [Type] -> Maybe (Type, Coercion) diff --git a/compiler/GHC/Core/TyCon.hs b/compiler/GHC/Core/TyCon.hs index e50751c2a0..6514b68aaf 100644 --- a/compiler/GHC/Core/TyCon.hs +++ b/compiler/GHC/Core/TyCon.hs @@ -1184,7 +1184,9 @@ data AlgTyConRhs -- See Note [Newtype eta] nt_co :: CoAxiom Unbranched, -- The axiom coercion that creates the @newtype@ - -- from the representation 'Type'. + -- from the representation 'Type'. The axiom witnesses + -- a representational coercion: + -- nt_co :: N ty1 ~R# rep_tys -- See Note [Newtype coercions] -- Invariant: arity = #tvs in nt_etad_rhs; |