Skip to content

Commit

Permalink
fix #13021, regression in error message for Mod.x = val
Browse files Browse the repository at this point in the history
(cherry picked from commit 8f08a1f)
  • Loading branch information
JeffBezanson authored and tkelman committed Sep 11, 2015
1 parent cf2002a commit b121d8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,8 @@ JL_CALLABLE(jl_f_field_type)
{
JL_NARGS(fieldtype, 2, 2);
jl_datatype_t *st = (jl_datatype_t*)args[0];
if (st == jl_module_type)
jl_error("cannot assign variables in other modules");
if (!jl_is_datatype(st))
jl_type_error("fieldtype", (jl_value_t*)jl_datatype_type, (jl_value_t*)st);
int field_index;
Expand Down
10 changes: 10 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,13 @@ end
let v = sprint(whos, _test_whos_)
@test contains(v, "x 8 bytes Float64 : 1.0")
end

# issue #13021
let ex = try
Main.x13021 = 0
nothing
catch ex
ex
end
@test isa(ex, ErrorException) && ex.msg == "cannot assign variables in other modules"
end

0 comments on commit b121d8a

Please sign in to comment.