Skip to content

Commit

Permalink
fix #33135, wrong scope resolution with conflicting sparams and let v…
Browse files Browse the repository at this point in the history
…ars (#33145)

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.

(cherry picked from commit 0fc3f03)
  • Loading branch information
JeffBezanson authored and Kristoffer Carlsson committed Sep 5, 2019
1 parent 1d43fb6 commit 2410981
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,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)))
Expand Down
7 changes: 7 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2410981

Please sign in to comment.