-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Bug]: Error if a variable inside a @check function has the same name as the function #54
Comments
Thank you for the bug report! This is very weird; I'm not sure what's going on, so as a workaround, your best option is to make sure variables in your function don't clash with the function name. |
Ok wow, this might be related to the weird scoping behavior of closures/let blocks. Placing the julia> @testset "Supposition" begin
@check function foo(x = Data.Integers{Int64}())
foo = x^2
foo >= 0
end
end;
input = (x = -9223372036854775808,)
foo = var"#foo#foo##1"(Core.Box(var"#foo#foo##1"(#= circular reference @-2 =#)))
input = (x = -6993590808634186443,)
foo = 0
input = (x = -9223372036854775808,)
foo = 0 (with some internal modifications to get the printing here to show up.) I don't even know how to tackle that on my end, because it looks like this is a mixup in lowering 🤔 |
Reduced to this MWE, which I'm going to report upstream: julia> let;
function a()
b()
end
function b()
b = 1
return b
end
@show a()
@show a()
end
a() = 1
ERROR: MethodError: objects of type Int64 are not callable
The object of type `Int64` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Maybe you forgot to use an operator such as *, ^, %, / etc. ?
Stacktrace:
[1] (::var"#a#a##4")()
@ Main ./REPL[6]:3
[2] top-level scope
@ REPL[6]:10
[3] macro expansion
@ show.jl:1229 [inlined] IMO, the rebinding in |
Yes of course, the workaround is very simple and it only impacts people like me who are bad at naming things 😅. First time writing a Julia related issue and surprised that the rumor of a very responsive community is 100% true! |
What happened?
From this minimal code:
Everything is working fine, but if i use a
@testset
:What did you expect to happen?
No error, or at least a more useful information than the current one.
Julia Version
Package Environment
The text was updated successfully, but these errors were encountered: