[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: Fall back to types when looking up data constructors (#18740)

Marge Bot gitlab at gitlab.haskell.org
Sun Oct 11 02:53:31 UTC 2020



 Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
c9262d49 by Daniel Rogozin at 2020-10-10T23:24:32+03:00
Fall back to types when looking up data constructors (#18740)

Before this patch, referring to a data constructor in a term-level
context led to a scoping error:

    ghci> id Int
    <interactive>:1:4: error: Data constructor not in scope: Int

After this patch, the renamer falls back to the type namespace
and successfully finds the Int. It is then rejected in the type
checker with a more useful error message:

    <interactive>:1:4: error:
    • Illegal term-level use of the type constructor ‘Int’
        imported from ‘Prelude’ (and originally defined in ‘GHC.Types’)
    • In the first argument of ‘id’, namely ‘Int’
      In the expression: id Int

We also do this for type variables.

- - - - -
de2dbcba by Simon Peyton Jones at 2020-10-10T22:53:23-04:00
Fix some missed opportunities for preInlineUnconditionally

There are two signficant changes here:

* Ticket #18815 showed that we were missing some opportunities for
  preInlineUnconditionally.  The one-line fix is in the code for
  GHC.Core.Opt.Simplify.Utils.preInlineUnconditionally, which now
  switches off only for INLINE pragmas.  I expanded
  Note [Stable unfoldings and preInlineUnconditionally] to explain.

* When doing this I discovered a way in which preInlineUnconditionally
  was occasionally /too/ eager.  It's all explained in
  Note [Occurrences in stable unfoldings] in GHC.Core.Opt.OccurAnal,
  and the one-line change adding markAllMany to occAnalUnfolding.

I also got confused about what NoUserInline meant, so I've renamed
it to NoUserInlinePrag, and changed its pretty-printing slightly.
That led to soem error messate wibbling, and touches quite a few
files, but there is no change in functionality.

I did a nofib run.  As expected, no significant changes.

        Program           Size    Allocs
----------------------------------------
         sphere          -0.0%     -0.4%
----------------------------------------
            Min          -0.0%     -0.4%
            Max          -0.0%     +0.0%
 Geometric Mean          -0.0%     -0.0%

- - - - -
ee4d15bf by Hécate at 2020-10-10T22:53:24-04:00
Remove the dependency on the ghc-linters stage

- - - - -


30 changed files:

- .gitlab-ci.yml
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Parser.y
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/Name/Occurrence.hs
- compiler/GHC/Types/Name/Reader.hs
- compiler/GHC/Utils/Binary.hs
- testsuite/tests/module/mod132.stderr
- testsuite/tests/module/mod147.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr
- + testsuite/tests/rename/should_fail/T18740a.hs
- + testsuite/tests/rename/should_fail/T18740a.stderr
- + testsuite/tests/rename/should_fail/T18740b.hs
- + testsuite/tests/rename/should_fail/T18740b.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/roles/should_compile/Roles1.stderr
- testsuite/tests/roles/should_compile/Roles14.stderr
- testsuite/tests/roles/should_compile/Roles2.stderr
- testsuite/tests/roles/should_compile/Roles3.stderr
- testsuite/tests/roles/should_compile/Roles4.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/22476b27c46c66293907180ae0d07fe3666bde5b...ee4d15bfbc16bfd76328c0ace830b45a5a8c5560

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/22476b27c46c66293907180ae0d07fe3666bde5b...ee4d15bfbc16bfd76328c0ace830b45a5a8c5560
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/20201010/d1660466/attachment.html>


More information about the ghc-commits mailing list