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

UndefVarError when a local variable is previously referenced in an @async block. #11062

Closed
amitmurthy opened this issue Apr 30, 2015 · 5 comments

Comments

@amitmurthy
Copy link
Contributor

julia> function test2()
           @async x=1
           x = 2
       end
test2 (generic function with 1 method)

julia> test2()
ERROR: UndefVarError: x not defined
 in test2 at none:2

I guess what is happening here is that x in the @async block refers to the yet-to-be-defined x in test2 ?

@samtkaplan
Copy link

For the record, here is a corresponding thread on the Julia users mailing list:
https://groups.google.com/forum/?fromgroups=#!topic/julia-users/Q5QVpry4lBI

@ihnorton
Copy link
Member

Nominate to close, seems to be fixed on 0.5:

julia> function test2()
                 @async x=1
                 x = 2
          end
test2 (generic function with 1 method)
julia> test2()
2

The following fails (probably #13450?):

function test2()
                  @async x=1
                  println(x)
                  x = 2
end

(related? #5930)

@tkelman
Copy link
Contributor

tkelman commented Feb 20, 2016

if we're going to close, should add a test

@vtjnash
Copy link
Member

vtjnash commented Feb 20, 2016

The following fails (probably #13450?):

which is as to be expected, since it has an UndefVar usage in that println (although incorrectly printed as UndefRefError, since lowering boxed it)

@amitmurthy
Copy link
Contributor Author

Test added in #15164

Probably closed by @JeffBezanson's work on anonymous functions.

vtjnash added a commit that referenced this issue Feb 21, 2016
add test for local variables created after localized vars (#11062)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants