Skip to content

Commit

Permalink
fix #23978, deprecation message for Base.Test
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Oct 4, 2017
1 parent f2b4ff5 commit 9ef75ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
12 changes: 1 addition & 11 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1356,17 +1356,7 @@ end
using .DSP
export conv, conv2, deconv, filt, filt!, xcorr

module Test
for f in [Symbol("@inferred"), Symbol("@test"), Symbol("@test_approx_eq"),
Symbol("@test_approx_eq_eps"), Symbol("@test_broken"), Symbol("@test_nowarn"),
Symbol("@test_skip"), Symbol("@test_throws"), Symbol("@test_warn"),
Symbol("@testset"), :GenericArray, :GenericDict, :GenericSet, :GenericString,
:detect_ambiguities, :detect_unbound_args]
@eval Base.@deprecate_moved $f "Test" true true
end
end
export Test
deprecate(@__MODULE__, :Test)
@deprecate_binding Test nothing true ", run `using Test` instead"

@deprecate_moved SharedArray "SharedArrays" true true

Expand Down
25 changes: 15 additions & 10 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void jl_binding_deprecation_warning(jl_binding_t *b);

JL_DLLEXPORT jl_binding_t *jl_get_binding_or_error(jl_module_t *m, jl_sym_t *var)
{
jl_binding_t *b = jl_get_binding_(m, var, NULL);
jl_binding_t *b = jl_get_binding(m, var);
if (b == NULL)
jl_undefined_var_error(var);
if (b->deprecated)
Expand Down Expand Up @@ -283,15 +283,20 @@ static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s,
jl_symbol_name(to->name));
}
else {
if (b->deprecated && to != jl_main_module && to != jl_base_module &&
jl_options.depwarn != JL_OPTIONS_DEPWARN_OFF) {
/* with #22763, external packages wanting to replace
deprecated Base bindings should simply export the new
binding */
jl_printf(JL_STDERR,
"WARNING: importing deprecated binding %s.%s into %s.\n",
jl_symbol_name(from->name), jl_symbol_name(s),
jl_symbol_name(to->name));
if (b->deprecated) {
if (b->value == jl_nothing) {
return;
}
else if (to != jl_main_module && to != jl_base_module &&
jl_options.depwarn != JL_OPTIONS_DEPWARN_OFF) {
/* with #22763, external packages wanting to replace
deprecated Base bindings should simply export the new
binding */
jl_printf(JL_STDERR,
"WARNING: importing deprecated binding %s.%s into %s.\n",
jl_symbol_name(from->name), jl_symbol_name(s),
jl_symbol_name(to->name));
}
}

jl_binding_t **bp = (jl_binding_t**)ptrhash_bp(&to->bindings, s);
Expand Down

0 comments on commit 9ef75ce

Please sign in to comment.