[JuliaLowering] Refactor scope resolution pass (#60316)
## Fixes
### Soft scope
We currently treat flisp's `'(block (softscope true))` as a scope that "is
soft", but this isn't correct. It should behave more like a toggle, where if the
scope surrounding `(softscope true)` is the top-level thunk, neutral scopes not
protected by a hard scope become permeable to already-defined globals.
I've added `K"softscope"` for this.
Fixes https://github.com/JuliaLang/JuliaLowering.jl/issues/101.
`JuliaLowering.activate!()` should be much more usable in the REPL now,
as globals won't be accidentally eaten by the "soft scope."
### Shadowing behaviour
Found while cleaning up the lhs-resolution step with the change above. This PR
allows static parameters to be shadowed by globals and locals as long as they're
explicit (and not in the same scope). flisp allows this with globals, and the
explicit locals that desugar to `local-def` forms (which JuliaLowering doesn't
have).
This change is more permissive than flisp in the local case, since after looking
into why shadowing was disallowed I realized it was just was just to prevent
assignment to the static parameter (#32623). The flisp fix leads to some
funny behaviour:
```
julia> function f(x::T) where T
let
global T # remove this T and the other two will fight
let; local T; end
end
end
f (generic function with 1 method)
```
### Bindings/LambdaBindings
In figuring out how to use the variable bookkeeping system, I ran into inaccuracies.
This PR moves all vinfo to BindingInfo and deletes the incorrect bookkeeping
in LambdaBindings. We still need to have a per-lambda flag for capturedness
(different from the variable-level capt vinfo flag). With the added flags,
I've just made BindingInfo mutable since our previous workflow (BindingId is an
index into a vector; mutate the vector) doesn't give us the benefits of
immutability anyway.
## Enhancements
Scopes are retained until the end of the pass, so consumers like JETLS
can answer questions like "what names are available at my cursor?"
Recreating this previously-discarded information was a bit hacky!