Skip to content

Commit

Permalink
fix #15264, spurious must be explicitly imported error
Browse files Browse the repository at this point in the history
This was caused by the call to jl_has_intrinsics in the LambdaInfo
constructor, which looked up symbols inside the function too soon.
  • Loading branch information
JeffBezanson committed Mar 2, 2016
1 parent b61f660 commit 6f12818
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ jl_lambda_info_t *jl_new_lambda_info(jl_value_t *ast, jl_svec_t *tvars, jl_svec_
called |= (1<<(i-1));
}
li->called = called;
if (tvars != jl_emptysvec)
if (jl_has_intrinsics(li, (jl_expr_t*)ast, ctx))

This comment has been minimized.

Copy link
@yuyichao

yuyichao Mar 7, 2016

Contributor

Incidentally, this fixes a memory corruption in arrayops test (due to jl_has_intrinsics allocating) that I was trying to track down but blocked by rr-debugger/rr#1665.

li->needs_sparam_vals_ducttape = 1;
}
return li;
}
Expand Down
4 changes: 0 additions & 4 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,10 +1111,6 @@ jl_value_t *jl_preresolve_globals(jl_value_t *expr, jl_lambda_info_t *lam)
if (!jl_local_in_linfo(lam, (jl_sym_t*)expr))
return jl_module_globalref(lam->module, (jl_sym_t*)expr);
}
else if (jl_is_lambda_info(expr)) {
jl_lambda_info_t *l = (jl_lambda_info_t*)expr;
(void)jl_preresolve_globals(l->ast, l);
}
else if (jl_is_expr(expr)) {
jl_expr_t *e = (jl_expr_t*)expr;
if (e->head == lambda_sym) {
Expand Down
3 changes: 3 additions & 0 deletions src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ JL_DLLEXPORT void jl_method_def(jl_svec_t *argdata, jl_lambda_info_t *f, jl_valu

if (!jl_is_lambda_info(f))
f = expr_to_lambda((jl_expr_t*)f);
if (tvars != jl_emptysvec && !f->needs_sparam_vals_ducttape &&
jl_has_intrinsics(f, (jl_expr_t*)f->ast, f->module))
f->needs_sparam_vals_ducttape = 1;

assert(jl_is_lambda_info(f));
assert(jl_is_tuple_type(argtypes));
Expand Down
6 changes: 6 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3870,3 +3870,9 @@ let
end
@test j15283 == 1
@test !isdefined(:k15283)

# issue #15264
module Test15264
mod1{T}(x::T) = x < 1 ? x : mod1(x-1)
end
@test Test15264.mod1 !== Base.mod1

0 comments on commit 6f12818

Please sign in to comment.