Skip to content

Commit d763c8f

Browse files
committed
Fix setglobal! (first argument is a module, not a symbol)
1 parent 0d4901b commit d763c8f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/linear_ir.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function emit_assignment_or_setglobal(ctx, srcref, lhs, rhs, op=K"=")
333333
emit(ctx, @ast ctx srcref [
334334
K"call"
335335
"setglobal!"::K"top"
336-
string(nameof(binfo.mod))::K"Identifier"
336+
binfo.mod::K"Value"
337337
binfo.name::K"Symbol"
338338
rhs
339339
])

test/decls.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,16 @@ end
6363
# Unsupported for now
6464
@test_throws LoweringError JuliaLowering.include_string(test_mod, "const a,b,c = 1,2,3")
6565

66+
# Globals in local scope
67+
@test JuliaLowering.include_string(test_mod, """
68+
function f()
69+
let
70+
global x
71+
x = 1
72+
end
73+
end
74+
f()
75+
x
76+
""") === 1
77+
6678
end

0 commit comments

Comments
 (0)