Skip to content

Commit

Permalink
module.c: clarify assignment error message (#30548)
Browse files Browse the repository at this point in the history
  • Loading branch information
waldyrious authored and JeffBezanson committed Jan 11, 2019
1 parent 1daf145 commit a43bf16
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/src/manual/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ julia> pi
π = 3.1415926535897...
julia> pi = 3
ERROR: cannot assign variable MathConstants.pi from module Main
ERROR: cannot assign a value to variable MathConstants.pi from module Main
julia> sqrt(100)
10.0
julia> sqrt = 4
ERROR: cannot assign variable Base.sqrt from module Main
ERROR: cannot assign a value to variable Base.sqrt from module Main
```

## Allowed Variable Names
Expand Down
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,7 @@ static Value *global_binding_pointer(jl_codectx_t &ctx, jl_module_t *m, jl_sym_t
assert(b != NULL);
if (b->owner != m) {
char *msg;
(void)asprintf(&msg, "cannot assign variable %s.%s from module %s",
(void)asprintf(&msg, "cannot assign a value to variable %s.%s from module %s",
jl_symbol_name(b->owner->name), jl_symbol_name(s), jl_symbol_name(m->name));
emit_error(ctx, msg);
free(msg);
Expand Down
2 changes: 1 addition & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ JL_DLLEXPORT jl_binding_t *jl_get_binding_wr(jl_module_t *m, jl_sym_t *var, int
b->owner = m;
}
else if (error) {
jl_errorf("cannot assign variable %s.%s from module %s",
jl_errorf("cannot assign a value to variable %s.%s from module %s",
jl_symbol_name(b->owner->name), jl_symbol_name(var), jl_symbol_name(m->name));
}
}
Expand Down

0 comments on commit a43bf16

Please sign in to comment.