[commit: ghc] wip/ppc-reg-alloc: Treat kind/type variables identically, demolish FKTV (5bc195b)

git at git.haskell.org git at git.haskell.org
Thu Feb 28 02:14:42 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/ppc-reg-alloc
Link       : http://ghc.haskell.org/trac/ghc/changeset/5bc195b1fe788e9a900a15fbe473967850517c3e/ghc

>---------------------------------------------------------------

commit 5bc195b1fe788e9a900a15fbe473967850517c3e
Author: Vladislav Zavialov <vlad.z.4096 at gmail.com>
Date:   Wed Feb 13 17:15:49 2019 +0300

    Treat kind/type variables identically, demolish FKTV
    
    Implements GHC Proposal #24: .../ghc-proposals/blob/master/proposals/0024-no-kind-vars.rst
    Fixes Trac #16334, Trac #16315
    
    With this patch, scoping rules for type and kind variables have been
    unified: kind variables no longer receieve special treatment. This
    simplifies both the language and the implementation.
    
    User-facing changes
    -------------------
    
    * Kind variables are no longer implicitly quantified when an explicit
      forall is used:
    
        p ::             Proxy (a :: k)    -- still accepted
        p :: forall k a. Proxy (a :: k)    -- still accepted
        p :: forall   a. Proxy (a :: k)    -- no longer accepted
    
      In other words, now we adhere to the "forall-or-nothing" rule more
      strictly.
    
      Related function: RnTypes.rnImplicitBndrs
    
    * The -Wimplicit-kind-vars warning has been deprecated.
    
    * Kind variables are no longer implicitly quantified in constructor
      declarations:
    
        data T a        = T1 (S (a :: k) | forall (b::k). T2 (S b)  -- no longer accepted
        data T (a :: k) = T1 (S (a :: k) | forall (b::k). T2 (S b)  -- still accepted
    
      Related function: RnTypes.extractRdrKindSigVars
    
    * Implicitly quantified kind variables are no longer put in front of
      other variables:
    
        f :: Proxy (a :: k) -> Proxy (b :: j)
    
        f :: forall k j (a :: k) (b :: j). Proxy a -> Proxy b   -- old order
        f :: forall k (a :: k) j (b :: j). Proxy a -> Proxy b   -- new order
    
      This is a breaking change for users of TypeApplications. Note that
      we still respect the dpendency order: 'k' before 'a', 'j' before 'b'.
      See "Ordering of specified variables" in the User's Guide.
    
      Related function: RnTypes.rnImplicitBndrs
    
    * In type synonyms and type family equations, free variables on the RHS
      are no longer implicitly quantified unless used in an outermost kind
      annotation:
    
        type T = Just (Nothing :: Maybe a)         -- no longer accepted
        type T = Just Nothing :: Maybe (Maybe a)   -- still accepted
    
      The latter form is a workaround due to temporary lack of an explicit
      quantification method. Ideally, we would write something along these
      lines:
    
        type T @a = Just (Nothing :: Maybe a)
    
      Related function: RnTypes.extractHsTyRdrTyVarsKindVars
    
    * Named wildcards in kinds are fixed (Trac #16334):
    
        x :: (Int :: _t)    -- this compiles, infers (_t ~ Type)
    
      Related function: RnTypes.partition_nwcs
    
    Implementation notes
    --------------------
    
    * One of the key changes is the removal of FKTV in RnTypes:
    
      - data FreeKiTyVars = FKTV { fktv_kis    :: [Located RdrName]
      -                          , fktv_tys    :: [Located RdrName] }
      + type FreeKiTyVars = [Located RdrName]
    
      We used to keep track of type and kind variables separately, but
      now that they are on equal footing when it comes to scoping, we
      can put them in the same list.
    
    * extract_lty and family are no longer parametrized by TypeOrKind,
      as we now do not distinguish kind variables from type variables.
    
    * PatSynExPE and the related Note [Pattern synonym existentials do not scope]
      have been removed (Trac #16315). With no implicit kind quantification,
      we can no longer trigger the error.
    
    * reportFloatingKvs and the related Note [Free-floating kind vars]
      have been removed. With no implicit kind quantification,
      we can no longer trigger the error.


>---------------------------------------------------------------

5bc195b1fe788e9a900a15fbe473967850517c3e
 compiler/main/DynFlags.hs                          |   4 +-
 compiler/rename/RnSource.hs                        |  16 +-
 compiler/rename/RnTypes.hs                         | 480 +++++++++------------
 compiler/typecheck/TcHsType.hs                     | 116 -----
 compiler/typecheck/TcPatSyn.hs                     |  51 ---
 compiler/typecheck/TcRnTypes.hs                    |   5 -
 compiler/typecheck/TcSplice.hs                     |   2 +-
 compiler/typecheck/TcTyClsDecls.hs                 |  13 +-
 docs/users_guide/8.10.1-notes.rst                  |  28 ++
 docs/users_guide/glasgow_exts.rst                  | 112 +++--
 docs/users_guide/using-warnings.rst                |  53 ---
 testsuite/tests/codeGen/should_fail/T13233.hs      |   4 +-
 .../tests/dependent/should_compile/T15264.stderr   |  10 -
 testsuite/tests/dependent/should_compile/all.T     |   1 -
 .../tests/dependent/should_fail/BadTelescope2.hs   |   2 +-
 .../dependent/should_fail/BadTelescope2.stderr     |   6 +-
 .../{should_compile => should_fail}/T15264.hs      |   1 -
 .../tests/dependent/should_fail/T15264.stderr      |   6 +
 testsuite/tests/dependent/should_fail/T15825.hs    |   4 +-
 .../tests/dependent/should_fail/T15825.stderr      |   2 +-
 testsuite/tests/dependent/should_fail/all.T        |   1 +
 testsuite/tests/ghci/scripts/T7873.stderr          |   8 +-
 testsuite/tests/ghci/scripts/T9293.stdout          |   4 -
 testsuite/tests/ghci/scripts/ghci024.stdout        |   1 -
 testsuite/tests/ghci/scripts/ghci057.stdout        |   4 -
 .../should_compile/ExplicitForAllFams1.hs          |   2 +-
 .../parser/should_compile/DumpRenamedAst.stderr    |   4 +-
 .../partial-sigs/should_compile/T15039a.stderr     |   2 +-
 .../partial-sigs/should_compile/T15039b.stderr     |   2 +-
 .../partial-sigs/should_compile/T15039c.stderr     |   2 +-
 .../partial-sigs/should_compile/T15039d.stderr     |   2 +-
 .../tests/partial-sigs/should_compile/T16334.hs    |   6 +
 .../partial-sigs/should_compile/T16334.stderr      |   4 +
 testsuite/tests/partial-sigs/should_compile/all.T  |   1 +
 .../{should_fail => should_compile}/T14498.hs      |   4 +-
 testsuite/tests/patsyn/should_compile/all.T        |   1 +
 testsuite/tests/patsyn/should_fail/T14507.hs       |   2 +-
 testsuite/tests/patsyn/should_fail/all.T           |   1 -
 testsuite/tests/polykinds/BadKindVar.hs            |   2 +-
 testsuite/tests/polykinds/BadKindVar.stderr        |   2 +-
 testsuite/tests/polykinds/KindVarOrder.script      |   9 +
 testsuite/tests/polykinds/KindVarOrder.stdout      |   5 +
 testsuite/tests/polykinds/T10503.hs                |   2 +-
 testsuite/tests/polykinds/T10503.stderr            |   6 +-
 testsuite/tests/polykinds/T13985.stderr            |  28 +-
 testsuite/tests/polykinds/T14561.hs                |   2 +-
 testsuite/tests/polykinds/T14563.hs                |   2 +-
 testsuite/tests/polykinds/T14846.stderr            |  12 +-
 testsuite/tests/polykinds/T14887a.hs               |   8 +-
 testsuite/tests/polykinds/T8616.hs                 |   4 +-
 testsuite/tests/polykinds/T8616.stderr             |   2 +-
 testsuite/tests/polykinds/T9144.hs                 |   2 +-
 testsuite/tests/polykinds/all.T                    |   1 +
 testsuite/tests/typecheck/should_compile/T13343.hs |   2 +-
 testsuite/tests/typecheck/should_fail/T12973.hs    |   2 +-
 .../tests/typecheck/should_fail/T13983.stderr      |   8 +-
 testsuite/tests/typecheck/should_fail/T15629.hs    |   2 +-
 .../tests/typecheck/should_fail/T15629.stderr      |  10 +-
 testsuite/tests/typecheck/should_fail/T15797.hs    |   2 +-
 59 files changed, 399 insertions(+), 681 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5bc195b1fe788e9a900a15fbe473967850517c3e


More information about the ghc-commits mailing list