Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: new function in module sometimes treated as imported with using #15264

Closed
toivoh opened this issue Feb 27, 2016 · 0 comments
Closed
Assignees
Labels
kind:regression Regression in behavior compared to a previous version

Comments

@toivoh
Copy link
Contributor

toivoh commented Feb 27, 2016

In Julia 0.4, the code

module Test
    mod1{T}(x::T) = x < 1 ? x : mod1(x-1)
end

works and defines a module with a new function mod1. But with Julia master, I get instead the error message

ERROR: error in method definition: function Base.mod1 must be explicitly imported to be extended
 in eval(::Module, ::Any) at ./boot.jl:267

It seems that by using mod1 in the function body, Base.mod1 is considered to be imported before the function definition takes effect. If I make it non-recursive, remove the type parameter, or add a simple definition of mod1 in the Test module before the one given above, the error goes away.

@JeffBezanson JeffBezanson added the kind:regression Regression in behavior compared to a previous version label Mar 2, 2016
@JeffBezanson JeffBezanson self-assigned this Mar 2, 2016
JeffBezanson added a commit that referenced this issue Mar 2, 2016
This was caused by the call to jl_has_intrinsics in the LambdaInfo
constructor, which looked up symbols inside the function too soon.
JeffBezanson added a commit that referenced this issue Mar 2, 2016
This was caused by the call to jl_has_intrinsics in the LambdaInfo
constructor, which looked up symbols inside the function too soon.
JeffBezanson added a commit that referenced this issue Mar 3, 2016
fix #15264, spurious `must be explicitly imported` error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants