Skip to content

Commit 84a83ab

Browse files
authored
fix lambda-optimize-vars! with complex assignment RHSs (#30564)
fixes #30563
1 parent 8b189ec commit 84a83ab

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/julia-syntax.scm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,9 @@ f(x) = yt(x)
30483048
(kill))
30493049
(cdr e)))
30503050
(else
3051-
(mark-used e)
3051+
(if (eq? (car e) '=)
3052+
(visit (caddr e))
3053+
(mark-used e))
30523054
(if (and (or (eq? (car e) '=)
30533055
(and (eq? (car e) 'method) (length> e 2)))
30543056
(has? unused (cadr e)))

test/compiler/inference.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,15 @@ function g15276()
18321832
end
18331833
@test g15276() isa Vector{Int}
18341834

1835+
function inbounds_30563()
1836+
local y
1837+
@inbounds for i in 1:10
1838+
y = (m->2i)(0)
1839+
end
1840+
return y
1841+
end
1842+
@test Base.return_types(inbounds_30563, ()) == Any[Int]
1843+
18351844
# issue #27316 - inference shouldn't hang on these
18361845
f27316(::Vector) = nothing
18371846
f27316(::Any) = f27316(Any[][1]), f27316(Any[][1])

0 commit comments

Comments
 (0)