From f152c93d4b830c66f083cfbbc1018084d7b9c144 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 3 Jan 2019 18:09:38 -0500 Subject: [PATCH] fix `lambda-optimize-vars!` with complex assignment RHSs (#30564) fixes #30563 (cherry picked from commit 84a83ab8219e48c2ed466fe5c76b3de74039c158) --- src/julia-syntax.scm | 4 +++- test/compiler/compiler.jl | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 5d9e99a9627d99..7b1a15c5591030 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -2998,7 +2998,9 @@ f(x) = yt(x) (kill)) (cdr e))) (else - (mark-used e) + (if (eq? (car e) '=) + (visit (caddr e)) + (mark-used e)) (if (and (or (eq? (car e) '=) (and (eq? (car e) 'method) (length> e 2))) (has? unused (cadr e))) diff --git a/test/compiler/compiler.jl b/test/compiler/compiler.jl index 01b7000a6a68a2..16e3eaf39f8740 100644 --- a/test/compiler/compiler.jl +++ b/test/compiler/compiler.jl @@ -1822,6 +1822,15 @@ function g15276() end @test g15276() isa Vector{Int} +function inbounds_30563() + local y + @inbounds for i in 1:10 + y = (m->2i)(0) + end + return y +end +@test Base.return_types(inbounds_30563, ()) == Any[Int] + # issue #27316 - inference shouldn't hang on these f27316(::Vector) = nothing f27316(::Any) = f27316(Any[][1]), f27316(Any[][1])