Add right-to-left rule for pattern bindings
Fix #18323 by adding a few lines of code to handle non-recursive pattern bindings. see GHC.Tc.Gen.Bind Note [Special case for non-recursive pattern bindings] Alas, this confused the pattern-match overlap checker; see #18323. Note that this patch only affects pattern bindings like that for (x,y) in this program combine :: (forall a . [a] -> a) -> [forall a. a -> a] -> ((forall a . [a] -> a), [forall a. a -> a]) breaks = let (x,y) = combine head ids in x y True We need ImpredicativeTypes for those [forall a. a->a] types to be valid. And with ImpredicativeTypes the old, unprincipled "allow unification variables to unify with a polytype" story actually works quite well. So this test compiles fine (if delicatedly) with old GHCs; but not with QuickLook unless we add this patch
Showing
- compiler/GHC/Hs/Binds.hs 1 addition, 6 deletionscompiler/GHC/Hs/Binds.hs
- compiler/GHC/HsToCore/Binds.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs 1 addition, 1 deletioncompiler/GHC/HsToCore/Expr.hs
- compiler/GHC/Tc/Gen/Bind.hs 99 additions, 27 deletionscompiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Match.hs 9 additions, 2 deletionscompiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Match.hs-boot 2 additions, 2 deletionscompiler/GHC/Tc/Gen/Match.hs-boot
- compiler/GHC/Tc/Utils/Zonk.hs 2 additions, 2 deletionscompiler/GHC/Tc/Utils/Zonk.hs
- testsuite/tests/typecheck/should_compile/T18323.hs 29 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T18323.hs
- testsuite/tests/typecheck/should_compile/all.T 2 additions, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T8570.stderr 11 additions, 5 deletionstestsuite/tests/typecheck/should_fail/T8570.stderr
- testsuite/tests/typecheck/should_fail/tcfail004.stderr 4 additions, 7 deletionstestsuite/tests/typecheck/should_fail/tcfail004.stderr
- testsuite/tests/typecheck/should_fail/tcfail005.stderr 4 additions, 7 deletionstestsuite/tests/typecheck/should_fail/tcfail005.stderr
- testsuite/tests/typecheck/should_fail/tcfail012.stderr 3 additions, 3 deletionstestsuite/tests/typecheck/should_fail/tcfail012.stderr
- testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr 1 addition, 1 deletion...suite/tests/warnings/should_fail/CaretDiagnostics1.stderr
Please register or sign in to comment