log a warning for shadowing an import with a definition
This commit is contained in:
parent
95bac91268
commit
f7e1fcd557
|
@ -226,7 +226,9 @@ that produces syntax definitions must be defined before it is used.
|
|||
No identifier can be imported or defined more than once at any
|
||||
@tech{phase level} within a single module, except that a definition
|
||||
via @racket[define-values] or @racket[define-syntaxes] can shadow a
|
||||
preceding import via @racket[#%require].
|
||||
preceding import via @racket[#%require]; unless the shadowed import is
|
||||
from the module's initial @racket[module-path], a warning is logged
|
||||
to the initial logger.
|
||||
Every exported identifier must be imported or
|
||||
defined. No expression can refer to a @tech{top-level variable}.
|
||||
A @racket[module*] form in which the enclosing module's bindings are visible
|
||||
|
|
|
@ -7842,6 +7842,14 @@ static int check_already_required(Scheme_Hash_Table *required, Scheme_Object *na
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void warn_previously_required(Scheme_Object *modname, Scheme_Object *name)
|
||||
{
|
||||
scheme_log(NULL, SCHEME_LOG_WARNING, 0,
|
||||
"warning: defined identifier is already imported: %S in module: %D",
|
||||
SCHEME_STX_VAL(name),
|
||||
modname);
|
||||
}
|
||||
|
||||
static void propagate_imports(Module_Begin_Expand_State *bxs,
|
||||
Module_Begin_Expand_State *super_bxs,
|
||||
Scheme_Object *rn,
|
||||
|
@ -8960,7 +8968,7 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_
|
|||
}
|
||||
|
||||
if (check_already_required(required, name)) {
|
||||
/* allow definition of previously imported */
|
||||
warn_previously_required(env->genv->module->modname, orig_name);
|
||||
}
|
||||
|
||||
/* Not syntax: */
|
||||
|
@ -9061,7 +9069,7 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_
|
|||
}
|
||||
|
||||
if (check_already_required(required, name)) {
|
||||
/* allow definition of previously imported */
|
||||
warn_previously_required(oenv->genv->module->modname, orig_name);
|
||||
}
|
||||
|
||||
if (!SAME_OBJ(SCHEME_STX_VAL(orig_name), name)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user