• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #38038
77%

Build:
DEFAULT BRANCH: master
Ran 29 Mar 2025 08:25AM UTC
Jobs 1
Files 211
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Mar 2025 06:46PM UTC coverage: 20.292% (-0.3%) from 20.564%
#38038

push

local

web-flow
lowering: Fix captured vars shadowed by an inner global declaration (#57648)

As discovered in #57547, lowering isn't resolving references to captured variables when a global of the same name is declared in any scope in the current function:

```
julia> let
            g = 1
            function f()
                let; global g = 2; end;
                return g    # g is not resolved
            end; f()
        end
ERROR: Found raw symbol in code returned from lowering. Expected all symbols to
have been resolved to GlobalRef or slots.
```

`resolve-scopes` correctly detects that we're returning the local, but scope-blocks are removed in this pass. As a result, `analyze-vars-lambda` finds more globals than `resolve-scopes` did when calling `find-global-decls` (which does not peek inside nested scopes) on `f`.  `analyze-vars-lambda` then calculates the set of captured variables in `f` to be:

```
captvars = (current_env ∩ free_vars) - (new_staticparams ∪ wrong_globals)
```

so `g` in this case is never captured.

This bug was introduced (revealed, maybe) in #57051---the whole resolution step used to happen after lowering, so lowering passes disagreeing on scopes would be less visible.

Fix: omit globals from the free variable list in `analyze-vars-lambda` in the first place.  This way we don't need to call the scope-block-dependent `find-global-decls`.

9941 of 48990 relevant lines covered (20.29%)

99223.49 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
25.43
-0.19% base/broadcast.jl
1
55.56
-14.44% base/cmem.jl
1
61.96
-1.09% base/iddict.jl
1
15.19
0.0% base/intfuncs.jl
1
52.7
-1.35% base/libuv.jl
1
38.75
-0.42% base/logging/logging.jl
1
1.27
-0.14% base/mpfr.jl
1
9.19
-0.12% base/multidimensional.jl
1
6.06
-1.52% base/number.jl
1
36.87
0.0% base/operators.jl
1
38.46
-1.54% base/pkgid.jl
1
17.65
-0.39% base/promotion.jl
1
21.25
-0.05% base/show.jl
1
29.55
-0.57% base/strings/basic.jl
1
9.21
-0.66% base/strings/cstring.jl
1
35.47
-0.28% base/strings/util.jl
1
21.32
-1.3% base/threadingconstructs.jl
1
18.57
-0.33% base/tuple.jl
1
27.55
-1.02% stdlib/Random/src/Xoshiro.jl
2
57.39
-1.14% base/asyncevent.jl
2
28.5
-0.93% base/iostream.jl
2
6.67
-2.22% base/multimedia.jl
2
9.9
-0.52% base/range.jl
2
57.83
-1.2% base/stacktraces.jl
2
27.15
-0.4% base/task.jl
2
67.81
-1.37% base/terminfo.jl
3
16.47
-0.22% base/abstractarray.jl
3
55.07
-4.35% base/Base.jl
3
65.79
-7.89% base/coreir.jl
3
22.73
-0.46% base/io.jl
3
31.25
-9.38% base/ordering.jl
3
13.5
-1.84% base/sysinfo.jl
3
42.31
-11.54% stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl
4
30.66
-1.15% base/client.jl
5
54.45
-2.84% base/essentials.jl
6
44.3
-2.86% base/bitset.jl
9
53.74
-1.11% base/array.jl
9
22.19
-1.19% base/errorshow.jl
11
31.65
-2.82% base/boot.jl
12
15.79
-1.05% base/bitarray.jl
22
35.22
-4.48% base/runtime_internals.jl
88
42.72
-0.26% base/stream.jl
157
1.98
-0.03% stdlib/Random/src/RNGs.jl
195
39.95
0.73% base/iobuffer.jl
Jobs
ID Job ID Ran Files Coverage
1 #38038.1 29 Mar 2025 08:25AM UTC 211
20.29
Source Files on build #38038
  • Tree
  • List 211
  • Changed 48
  • Source Changed 0
  • Coverage Changed 48
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • a046da5f on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc