Fix wrong role in mkSelCo_maybe
In the Lint failure in #23938, we start with a coercion Refl :: T a ~R T a, and call mkSelCo (SelTyCon 1 nominal) Refl. The function incorrectly returned Refl :: a ~R a. The returned role should be nominal, according to the SelCo rule: co : (T s1..sn) ~r0 (T t1..tn) r = tyConRole tc r0 i ---------------------------------- SelCo (SelTyCon i r) : si ~r ti In this test case, r is nominal while r0 is representational.
Showing
- compiler/GHC/Core/Coercion.hs 6 additions, 2 deletionscompiler/GHC/Core/Coercion.hs
- testsuite/tests/simplCore/should_compile/T23938.hs 8 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T23938.hs
- testsuite/tests/simplCore/should_compile/T23938A.hs 60 additions, 0 deletionstestsuite/tests/simplCore/should_compile/T23938A.hs
- testsuite/tests/simplCore/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/simplCore/should_compile/all.T
Loading
Please register or sign in to comment