From 7767f115e0cce08366bc7fbfa1272b85a4b0b5d3 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 3 Sep 2019 14:06:29 -0400 Subject: [PATCH] fix #33135, wrong scope resolution with conflicting sparams and let vars The static parameters of an outer scope should not be passed along to inner scopes; it instead needs to be handled by the lookup process iterating back to enclosing scopes. --- src/julia-syntax.scm | 2 +- test/syntax.jl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index a980af94e15a2..af05ed9a9db3b 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -2554,7 +2554,7 @@ (append locals-nondef locals-def) ;; global declarations at the top level are not inherited (if toplevel? '() globals) - (scope:sp scope) + '() (append (map cons need-rename renamed) (map cons need-rename-def renamed-def)) scope))) diff --git a/test/syntax.jl b/test/syntax.jl index 37e7caf07afcb..fc6afd199b43f 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -1928,3 +1928,10 @@ end # Stream positioning after parsing var @test Meta.parse("var'", 1, greedy=false) == (:var, 4) +# issue #33135 +function f33135(x::T) where {C1, T} + let C1 = 1, C2 = 2 + C1 + end +end +@test f33135(0) == 1