[Git][ghc/ghc][wip/backports] 3 commits: Improve skolemisation

Ben Gamari gitlab at gitlab.haskell.org
Sat May 30 17:04:36 UTC 2020



Ben Gamari pushed to branch wip/backports at Glasgow Haskell Compiler / GHC


Commits:
2fab423c by Simon Peyton Jones at 2020-05-30T13:04:13-04:00
Improve skolemisation

This patch avoids skolemiseUnboundMetaTyVar making
up a fresh Name when it doesn't need to.

See Note [Skolemising and identity]

Improves error messsages for partial type signatures.

(cherry picked from commit d7002bccd7d131f8ee9b1ddcd83d62262622294d)

- - - - -
61d29c90 by Simon Peyton Jones at 2020-05-30T13:04:13-04:00
Improve pretty-printing for TyConBinders

In particular, show their kinds.

(cherry picked from commit fa37940cd72f82abc460f5c0a5de64dd75cee6ae)

- - - - -
748925ad by Simon Peyton Jones at 2020-05-30T13:04:30-04:00
Fix scoping of TyCon binders in TcTyClsDecls

This patch fixes #17566 by refactoring the way we decide the final
identity of the tyvars in the TyCons of a possibly-recursive nest
of type and class decls, possibly with associated types.

It's all laid out in
  Note [Swizzling the tyvars before generaliseTcTyCon]

Main changes:

* We have to generalise each decl (with its associated types)
  all at once: TcTyClsDecls.generaliseTyClDecl

* The main new work is done in TcTyClsDecls.swizzleTcTyConBndrs

* The mysterious TcHsSyn.zonkRecTyVarBndrs dies altogether

Other smaller things:

* A little refactoring, moving bindTyClTyVars from tcTyClDecl1
  to tcDataDefn, tcSynRhs, etc.  Clearer, reduces the number of
  parameters

* Reduce the amount of swizzling required.
  Specifically, bindExplicitTKBndrs_Q_Tv doesn't need
    to clone a new Name for the TyVarTv, and not
    cloning means that in the vasly common case,
    swizzleTyConBndrs is a no-op

  In detail:
    Rename newTyVarTyVar --> cloneTyVarTyVar
    Add newTyVarTyTyVar that doesn't clone
    Use the non-cloning newTyVarTyVar in
       bindExplicitTKBndrs_Q_Tv
       Rename newFlexiKindedTyVarTyVar
           --> cloneFlexiKindedTyVarTyVar

* Define new utility function and use it
     HsDecls.familyDeclName ::
        FamilyDecl (GhcPass p) -> IdP (GhcPass p)

Updates haddock submodule.

(cherry picked from commit b9605396f1f1560aea94792646b835cadcb49f45)

- - - - -


30 changed files:

- compiler/GHC/Hs/Decls.hs
- compiler/typecheck/TcHsSyn.hs
- compiler/typecheck/TcHsType.hs
- compiler/typecheck/TcInstDcls.hs
- compiler/typecheck/TcMType.hs
- compiler/typecheck/TcTyClsDecls.hs
- compiler/types/TyCon.hs
- testsuite/tests/partial-sigs/should_compile/ExprSigLocal.stderr
- testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr
- testsuite/tests/partial-sigs/should_compile/T10519.stderr
- testsuite/tests/partial-sigs/should_compile/T12844.stderr
- testsuite/tests/partial-sigs/should_compile/T13482.stderr
- testsuite/tests/partial-sigs/should_compile/T14217.stderr
- testsuite/tests/partial-sigs/should_compile/T14715.stderr
- testsuite/tests/partial-sigs/should_compile/T15039a.stderr
- testsuite/tests/partial-sigs/should_compile/T15039c.stderr
- testsuite/tests/partial-sigs/should_compile/T16728.stderr
- testsuite/tests/partial-sigs/should_compile/T16728b.stderr
- testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardNotEnabled.stderr
- testsuite/tests/partial-sigs/should_fail/InstantiatedNamedWildcardsInConstraints.stderr
- testsuite/tests/partial-sigs/should_fail/NamedWildcardExplicitForall.stderr
- testsuite/tests/partial-sigs/should_fail/T10615.stderr
- testsuite/tests/polykinds/T11203.stderr
- testsuite/tests/polykinds/T11821a.stderr
- testsuite/tests/typecheck/should_compile/Makefile
- + testsuite/tests/typecheck/should_compile/T17566.hs
- + testsuite/tests/typecheck/should_compile/T17566a.hs
- testsuite/tests/typecheck/should_compile/all.T
- + testsuite/tests/typecheck/should_fail/T17566b.hs
- + testsuite/tests/typecheck/should_fail/T17566b.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0e49e13e5d0d5cbc49710226bf21a6fe0d923084...748925ad536bd939cdd71c73f4fe9122b56647e8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0e49e13e5d0d5cbc49710226bf21a6fe0d923084...748925ad536bd939cdd71c73f4fe9122b56647e8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200530/12452031/attachment.html>


More information about the ghc-commits mailing list