[Git][ghc/ghc][wip/sand-witch/modern-STV-extension-shuffling] 2 commits: Fix -Wterm-variable-capture scope (#23434)

Andrei Borzenkov (@sand-witch) gitlab at gitlab.haskell.org
Mon May 29 11:00:42 UTC 2023



Andrei Borzenkov pushed to branch wip/sand-witch/modern-STV-extension-shuffling at Glasgow Haskell Compiler / GHC


Commits:
0009b5ae by Andrei Borzenkov at 2023-05-29T12:47:16+04:00
Fix -Wterm-variable-capture scope (#23434)

-Wterm-variable-capture wasn't accordant with type variable
scoping in associated types, in type classes. For example,
this code produced the warning:
  k = 12

  class C k a where
    type AT a :: k -> Type

I solved this issue by reusing machinery of newTyVarNameRn function
that is accordand with associated types: it does lookup for each free type
variable when we are in the type class context. And in this patch I
use result of this work to make sure that -Wterm-variable-capture warns
only on implicitly quantified type variables.

- - - - -
a47e341d by Andrei Borzenkov at 2023-05-29T15:00:08+04:00
Extension shuffling (#23291)

Where introduced 4 new extensions:
  - PatternSignatures
  - ExtendedForAllScope
  - MethodTypeVariables
  - ImplicitForAll

Tasks of ScopedTypeVariables extension were distributed between
PatternSignatures, ExtendedForAllScope and MethodTypeVariables according
to the proposal. Now ScopedTypeVaribles only implies these three exntesions.

Extension ImplicitForAll saves current behavior. NoImplicitForAll
disables implicit bounding of type variables in many contexts.

Was introduced one new warning option: -Wpattern-signature-binds
It warns when pattern signature binds into scope new type variable. For
example:

  f (a :: t) = ...

- - - - -


30 changed files:

- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Types/Error/Codes.hs
- docs/users_guide/9.8.1-notes.rst
- docs/users_guide/expected-undocumented-flags.txt
- docs/users_guide/exts/explicit_forall.rst
- docs/users_guide/exts/gadt.rst
- + docs/users_guide/exts/implicit_forall.rst
- docs/users_guide/exts/scoped_type_variables.rst
- docs/users_guide/exts/type_abstractions.rst
- docs/users_guide/exts/type_signatures.rst
- docs/users_guide/using-warnings.rst
- libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
- testsuite/tests/driver/T4437.hs
- testsuite/tests/rename/should_compile/T22513a.stderr
- testsuite/tests/rename/should_compile/T22513b.stderr
- testsuite/tests/rename/should_compile/T22513c.stderr
- testsuite/tests/rename/should_compile/T22513d.stderr
- testsuite/tests/rename/should_compile/T22513e.stderr
- testsuite/tests/rename/should_compile/T22513f.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/97b245a6cfee3bcc663d4fcd991df735969cec97...a47e341d524a104c6f81260bf478bbc4c9ec52a0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/97b245a6cfee3bcc663d4fcd991df735969cec97...a47e341d524a104c6f81260bf478bbc4c9ec52a0
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/20230529/e616d797/attachment-0001.html>


More information about the ghc-commits mailing list