-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
lower top-level statements so that the front-end knows their values are unused #26304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e2d5401 to
a38ae65
Compare
|
Does it make sense to test that |
|
Ok, I'm adding tests for this. It was bizarrely difficult. First I found that |
their values are not used fixes most false positives in the deprecation for using the value of `.=`
a38ae65 to
9badfc2
Compare
|
@c42f: is the |
|
The docstring for |
|
The docstring is very good; the surprising part is that you pass zero patterns to check for zero log events. We could add a |
…luenonscalarindexedassignment * origin/master: (28 commits) fix an optimizer bug in `invoke` with non-constant functions (#26301) lower top-level statements in such a way that the front-end knows (#26304) Make sure Sockets page has h1 header (#26315) fix doctests, and make them less prone to errors (#26275) FIx intro to manual chapter on types (#26312) Add a missing "that" (#26313) fix docstring for code_llvm (#26266) Remove the examples/ folder (#26153) download cert.pem from deps-getall, fixes #24903 (#25344) Slight update to doc string for at-enum to refer to instances (#26208) performance tweak in reverse(::String) (#26300) remove references to `TCPSocket` in Base docstrings (#26298) Deprecate adding integers to CartesianIndex (#26284) Deprecate conj(::Any), add real(::Missing) and imag(::Missing) (#26288) fix #26267, regression in `names` with `imported=false` (#26293) fix #25857, `typeinfo` problem in showing arrays with abstract tuple types (#26289) Add adjoint(::Missing) method (#25502) Use lowered form in logging macro (#26291) deprecate bin, oct, dec, hex, and base in favor of `string` and keyword args (#25804) deprecate `spawn(cmd)` to `run(cmd, wait=false)` (#26130) ...
This is preparatory work for experimental integration with
JuliaLowering, which
happened to be separable into its own PR.
We currently have three lowering entry points doing slightly different
things:
`jl-expand-to-thunk`, `jl-expand-to-thunk-warn` (for complaining about
ambiguous
soft scope assignments during non-interactive use), and
`jl-expand-to-thunk-stmt` (which wraps the expression in a block
returning
nothing before lowering it) and a bunch of C wrappers on top of those
(see red
nodes in the call graphs below).
In this PR:
- Make all lowering calls go through `jl_lower`, which just calls out to
lisp
for now, but will probably function like `jl_parse` does in a future PR.
- Handle `warn` with an extra parameter
- Delete most of the lowering wrappers, which were mainly a result of
the
three entry points
- While we're breaking things in ast.c, take the opportunity to rename
"expand"-prefixed functions to "lower"-prefixed ones (excluding macro
expansion functions, which are called as the first part of lowering).
Here's a call graph before this change, made by looking for callers
of each lowering entry point and tracing back one or more steps (expect
mistakes...). Macro expansion functions are mostly omitted for clarity.
Blue is scheme, red is ast.c, and green is toplevel.c.

After this change:

#### todo?
- ~~I'd like to see if we can eliminate the `stmt` boolean option from
`jl_lower`
and handle that another way; I'm just not sure it's worth the effort at
the
moment. We only use it in one place in `jl_eval_module_expr`. The
original
code path was added in #26304.~~
Fixes most false positives in the deprecation for using the value of
.=; see #26088 (comment)This could also be useful in other ways in the future.