Term variable capture (#23740)
This patch changes type variable lookup rules (lookupTypeOccRn) and implicit quantification rules (filterInScope) so that variables bound in the term namespace can be captured at the type level {-# LANGUAGE RequiredTypeArguments #-} f1 x = g1 @x -- `x` used in a type application f2 x = g2 (undefined :: x) -- `x` used in a type annotation f3 x = g3 (type x) -- `x` used in an embedded type f4 x = ... where g4 :: x -> x -- `x` used in a type signature g4 = ... This change alone does not allow us to accept examples shown above, but at least it gets them past the renamer.
Showing
- compiler/GHC/Rename/Env.hs 101 additions, 28 deletionscompiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/HsType.hs 136 additions, 14 deletionscompiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs 6 additions, 4 deletionscompiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/Errors/Ppr.hs 1 addition, 1 deletioncompiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types/PromotionErr.hs 1 addition, 1 deletioncompiler/GHC/Tc/Errors/Types/PromotionErr.hs
- compiler/GHC/Tc/Gen/HsType.hs 2 additions, 0 deletionscompiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Splice.hs 1 addition, 1 deletioncompiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Utils/Env.hs 15 additions, 1 deletioncompiler/GHC/Tc/Utils/Env.hs
- testsuite/tests/diagnostic-codes/codes.stdout 1 addition, 0 deletionstestsuite/tests/diagnostic-codes/codes.stdout
- testsuite/tests/rename/should_compile/T22513a.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513a.stderr
- testsuite/tests/rename/should_compile/T22513b.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513b.stderr
- testsuite/tests/rename/should_compile/T22513c.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513c.stderr
- testsuite/tests/rename/should_compile/T22513d.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513d.stderr
- testsuite/tests/rename/should_compile/T22513e.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513e.stderr
- testsuite/tests/rename/should_compile/T22513f.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513f.stderr
- testsuite/tests/rename/should_compile/T22513g.hs 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513g.hs
- testsuite/tests/rename/should_compile/T22513g.stderr 2 additions, 2 deletionstestsuite/tests/rename/should_compile/T22513g.stderr
- testsuite/tests/rename/should_compile/T22513h.stderr 1 addition, 1 deletiontestsuite/tests/rename/should_compile/T22513h.stderr
- testsuite/tests/rename/should_compile/T22513i.stderr 3 additions, 2 deletionstestsuite/tests/rename/should_compile/T22513i.stderr
- testsuite/tests/rename/should_compile/T22513j.hs 8 additions, 0 deletionstestsuite/tests/rename/should_compile/T22513j.hs
Loading
Please register or sign in to comment