Skip to content

Commit 2e0e269

Browse files
KenoJeffBezanson
authored andcommitted
Fix top level symbol lookup (#24677)
Jeff and Jameson point out that if a module is already the toplevel, we need to stop the lookup right there. Adjust the loop accordingly.
1 parent 2dad958 commit 2e0e269

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/toplevel.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ jl_value_t *jl_eval_module_expr(jl_module_t *parent_module, jl_expr_t *ex)
288288
// - later, it refers to either old Base or new Base
289289
JL_DLLEXPORT jl_module_t *jl_base_relative_to(jl_module_t *m)
290290
{
291-
while (m != m->parent) {
291+
for (;;) {
292292
if (m->istopmod)
293293
return m;
294+
if (m == m->parent)
295+
break;
294296
m = m->parent;
295297
}
296298
return jl_top_module;

0 commit comments

Comments
 (0)