Improve out-of-order inferred type variables
Don't instantiate type variables for :type in `GHC.Tc.Gen.App.tcInstFun`, to avoid inconsistently instantianting `r1` but not `r2` in the type forall {r1} (a :: TYPE r1) {r2} (b :: TYPE r2). ... This fixes #21088. This patch also changes the primop pretty-printer to ensure that we put all the inferred type variables first. For example, the type of reallyUnsafePtrEquality# is now forall {l :: Levity} {k :: Levity} (a :: TYPE (BoxedRep l)) (b :: TYPE (BoxedRep k)). a -> b -> Int# This means we avoid running into issue #21088 entirely with the types of primops. Users can still write a type signature where the inferred type variables don't come first, however. This change to primops had a knock-on consequence, revealing that we were sometimes performing eta reduction on keepAlive#. This patch updates tryEtaReduce to avoid eta reducing functions with no binding, bringing it in line with tryEtaReducePrep, and thus fixing #21090.
Showing
- compiler/GHC/Core/Utils.hs 26 additions, 11 deletionscompiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs 6 additions, 14 deletionscompiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Tc/Gen/App.hs 8 additions, 3 deletionscompiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Module.hs 2 additions, 2 deletionscompiler/GHC/Tc/Module.hs
- docs/users_guide/9.4.1-notes.rst 18 additions, 10 deletionsdocs/users_guide/9.4.1-notes.rst
- docs/users_guide/ghci.rst 5 additions, 5 deletionsdocs/users_guide/ghci.rst
- libraries/ghc-prim/changelog.md 14 additions, 10 deletionslibraries/ghc-prim/changelog.md
- testsuite/tests/corelint/LintEtaExpand.hs 2 additions, 2 deletionstestsuite/tests/corelint/LintEtaExpand.hs
- testsuite/tests/ghci/scripts/T12550.stdout 2 additions, 1 deletiontestsuite/tests/ghci/scripts/T12550.stdout
- testsuite/tests/ghci/scripts/T21088.hs 29 additions, 0 deletionstestsuite/tests/ghci/scripts/T21088.hs
- testsuite/tests/ghci/scripts/T21088.script 11 additions, 0 deletionstestsuite/tests/ghci/scripts/T21088.script
- testsuite/tests/ghci/scripts/T21088.stdout 19 additions, 0 deletionstestsuite/tests/ghci/scripts/T21088.stdout
- testsuite/tests/ghci/scripts/all.T 1 addition, 0 deletionstestsuite/tests/ghci/scripts/all.T
- testsuite/tests/numeric/should_compile/T19769.stderr-ws-32 9 additions, 9 deletionstestsuite/tests/numeric/should_compile/T19769.stderr-ws-32
- testsuite/tests/numeric/should_compile/T19769.stderr-ws-64 11 additions, 11 deletionstestsuite/tests/numeric/should_compile/T19769.stderr-ws-64
- testsuite/tests/numeric/should_compile/T20347.stderr 2 additions, 2 deletionstestsuite/tests/numeric/should_compile/T20347.stderr
- testsuite/tests/primops/should_compile/KeepAliveWrapper.hs 8 additions, 0 deletionstestsuite/tests/primops/should_compile/KeepAliveWrapper.hs
- testsuite/tests/primops/should_compile/all.T 2 additions, 1 deletiontestsuite/tests/primops/should_compile/all.T
- testsuite/tests/stranal/should_compile/T18122.stderr 22 additions, 20 deletionstestsuite/tests/stranal/should_compile/T18122.stderr
- utils/genprimopcode/Main.hs 67 additions, 14 deletionsutils/genprimopcode/Main.hs
Loading
Please register or sign in to comment