Skip to content

Commit

Permalink
clarify warning for constant redefinition (#35119)
Browse files Browse the repository at this point in the history
Before it sounded like a linter message, now it should be clearer that
this warning means Julia may now be partially dysfunctional.
  • Loading branch information
vtjnash authored May 5, 2020
1 parent 84ae4a4 commit 6b53e02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions doc/src/manual/variables-and-scoping.md
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ julia> const y = 1.0
1.0
julia> y = 2.0
WARNING: redefining constant y
WARNING: redefinition of constant y. This may fail, cause incorrect answers, or produce other errors.
2.0
```
* if an assignment would not result in the change of variable value no message is given:
Expand Down Expand Up @@ -669,7 +669,7 @@ julia> const a = [1]
1
julia> a = [1]
WARNING: redefining constant a
WARNING: redefinition of constant a. This may fail, cause incorrect answers, or produce other errors.
1-element Array{Int64,1}:
1
```
Expand All @@ -690,7 +690,7 @@ julia> f()
1
julia> x = 2
WARNING: redefining constant x
WARNING: redefinition of constant x. This may fail, cause incorrect answers, or produce other errors.
2
julia> f()
Expand Down
2 changes: 1 addition & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ JL_DLLEXPORT void jl_checked_assignment(jl_binding_t *b, jl_value_t *rhs)
jl_errorf("invalid redefinition of constant %s",
jl_symbol_name(b->name));
}
jl_printf(JL_STDERR, "WARNING: redefining constant %s\n",
jl_printf(JL_STDERR, "WARNING: redefinition of constant %s. This may fail, cause incorrect answers, or produce other errors.\n",
jl_symbol_name(b->name));
}
}
Expand Down

0 comments on commit 6b53e02

Please sign in to comment.