Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

4 changed files:

Changes:

  • changelog.d/T27639
    1
    +section: compiler
    
    2
    +issues: #27639
    
    3
    +mrs: !16474
    
    4
    +synopsis:
    
    5
    +  Stop representation-polymorphism checks from producing a coercion that fails
    
    6
    +  Core Lint.
    
    7
    +description:
    
    8
    +  The representation-polymorphism check that is done when subsumption performs
    
    9
    +  eta-expansion now composes the coercions it builds in the correct order,
    
    10
    +  avoiding a Core Lint failure.

  • compiler/GHC/Tc/Utils/Unify.hs
    ... ... @@ -2359,7 +2359,7 @@ mkWpFun_FRR (mb_tc_fun, pos) sub_mult act_af act_mult act_arg act_res exp_af exp
    2359 2359
                      act_arg_co
    
    2360 2360
                      (mkNomReflCo act_res)
    
    2361 2361
                 arg_wrap_frr =    -- exp_arg_frr ~~> act_arg_frr
    
    2362
    -              mkWpCastN (mkSymCo exp_arg_co) <.> arg_wrap <.> mkWpCastN act_arg_co
    
    2362
    +              mkWpCastN act_arg_co <.> arg_wrap <.> mkWpCastN (mkSymCo exp_arg_co)
    
    2363 2363
     
    
    2364 2364
            ; traceTc "mkWpFun_FRR: WpFun" $
    
    2365 2365
                vcat [ text "act_mult:" <+> ppr act_mult
    

  • testsuite/tests/rep-poly/T27639.hs
    1
    +{-# LANGUAGE DeepSubsumption, RankNTypes, PolyKinds, DataKinds, GADTs, TypeOperators, ScopedTypeVariables #-}
    
    2
    +module T27639 where
    
    3
    +
    
    4
    +import GHC.Exts
    
    5
    +import Data.Type.Equality
    
    6
    +
    
    7
    +h :: forall r (a :: TYPE r) (b :: TYPE r).
    
    8
    +     (r :~: LiftedRep) -> (a :~: b) -> ()
    
    9
    +h Refl Refl =
    
    10
    +  let
    
    11
    +    v :: a -> (Int -> Int) -> Int
    
    12
    +    v = undefined
    
    13
    +    u :: b -> (forall c. c -> c) -> Int
    
    14
    +    u = v
    
    15
    +  in ()

  • testsuite/tests/rep-poly/all.T
    ... ... @@ -43,6 +43,7 @@ test('T23883c', normal, compile_fail, [''])
    43 43
     test('T23903', normal, compile_fail, [''])
    
    44 44
     test('T26107', js_broken(22364), compile, ['-O'])
    
    45 45
     test('T26528', normal, compile, [''])
    
    46
    +test('T27639', normal, compile, [''])
    
    46 47
     
    
    47 48
     test('EtaExpandDataCon', normal, compile, ['-O'])
    
    48 49
     test('EtaExpandStupid1', normal, compile, ['-Wno-deprecated-flags'])