Simon Peyton Jones pushed to branch wip/T20264 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Core/Lint.hs
    ... ... @@ -3775,9 +3775,10 @@ checkBndrOccCompatibility in_bndr v_occ
    3775 3775
     
    
    3776 3776
            -- Check that binder and occurrence have same type
    
    3777 3777
            -- See Note [Occurrence should have the same type as binder]
    
    3778
    -       ;  checkL (pickyEqType occ_ty in_bndr_ty) $  -- Compares InTypes
    
    3779
    -          hang (text "Mismatch in type between binder and occurrence")
    
    3780
    -             2 extra_info
    
    3778
    +--        ;  checkL (pickyEqType occ_ty in_bndr_ty) $  -- Compares InTypes
    
    3779
    +       ; ensureEqTys occ_ty in_bndr_ty $
    
    3780
    +         hang (text "Mismatch in type between binder and occurrence")
    
    3781
    +            2 extra_info
    
    3781 3782
     
    
    3782 3783
            ; checkLM (sameUnfolding in_bndr v_occ) $
    
    3783 3784
              hang (text "Mismatch in type-let unfolding between binder and occurrence")
    

  • compiler/GHC/Core/Utils.hs
    ... ... @@ -3360,14 +3360,14 @@ So:
    3360 3360
     
    
    3361 3361
     * `AbsVars` is a list of free variables, in dependency order, to abstract.
    
    3362 3362
       Some of them may be tyvars-with-unfoldings. For example
    
    3363
    -      vs = [a, b=[a], x:b]
    
    3363
    +      vs = [a, b{=[a]}, x:b{=[a]}]
    
    3364 3364
     
    
    3365 3365
     * When we make an AbsVars list, we close over the free vars of the unfoldings
    
    3366
    -  of any tyvars in it.  So if `b{=Maybe a}` is in the list then so is `a`
    
    3366
    +  of any tyvars in it.  So if `b{=[a]}` is in the list then so is `a`
    
    3367 3367
     
    
    3368 3368
     * `mkCoreAbsLams` (more generally `mkPolyAbsLams`) forms a lambda abstraction
    
    3369 3369
        pushing the tyvar bindings into the body:
    
    3370
    -      mkCoreAbsLams [a, b=[a], x:b] body
    
    3370
    +      mkCoreAbsLams [a, b{=[a]}, x:b{=[a]}] body
    
    3371 3371
              = \a. \(x:[a]). let @b = [a] in
    
    3372 3372
                              let x:b = x in   -- See (AFV1)
    
    3373 3373
                              body
    
    ... ... @@ -3389,7 +3389,7 @@ Wrinkles
    3389 3389
       Why do we need that funny (non-recursive!) `x:b = x` binding?
    
    3390 3390
       Answer: without it we'd have this:
    
    3391 3391
              = \a. \(x:[a]). let @b = [a] in
    
    3392
    -                         reverse (x:b)
    
    3392
    +                         reverse (x:b{=[a]})
    
    3393 3393
       where the /occurrence/ Var (x:b) has a different type to the /binding/ x:[a].
    
    3394 3394
     -}
    
    3395 3395
     
    
    ... ... @@ -3423,13 +3423,13 @@ mkPolyAbsLams (getter,setter) bndrs body
    3423 3423
     
    
    3424 3424
           | isTyVar var, change_ty
    
    3425 3425
           , let binds' | isDeadBinder var = binds
    
    3426
    -                   | otherwise        = (bndr, varToCoreExpr var1) : binds
    
    3426
    +                   | otherwise        = binds -- (bndr, varToCoreExpr var1) : binds
    
    3427 3427
                 -- Why this let-binding?
    
    3428 3428
           = Lam (setter var1 bndr) (go unf_tvs binds' bndrs)
    
    3429 3429
     
    
    3430 3430
           | isId var, change_ty || change_unf
    
    3431 3431
           , let binds' | isDeadBinder var = binds
    
    3432
    -                   | otherwise        = (bndr, varToCoreExpr id2) : binds
    
    3432
    +                   | otherwise        = binds -- (bndr, varToCoreExpr id2) : binds
    
    3433 3433
           = Lam (setter id2 bndr) (go unf_tvs binds' bndrs)
    
    3434 3434
     
    
    3435 3435
           | otherwise