-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
inferred
macro causes :block Expr arguments to lose LineNumberNodes
#31334
Comments
The relevant section of the Lines 1383 to 1387 in 5fac1b5
|
Oh, haha, jk, i guess it's probably this call to Line 1369 in 5fac1b5
What's the reasoning behind that call? Can we do it in a way that it doesn't affect the arguments to the expression? |
😆 Haha thanks. yeah it took me a while to notice that call there, literally spelling out my complaint. 😝
The reasoning there makes sense. Any idea about how to restructure this to avoid removing them from user input? I'm playing with it now, but |
We could just drop the call. The issue it was working around is fixed. (or with more difficultly, change the structure the macro to avoid calling it on the user input, |
Ah, damn, that makes sense. It's better than what i came up with, which is pretty silly in retrospect: |
I was finally picking this up again, and i noticed that actually julia> e = quote 2 + 2 end
quote
#= none:1 =#
2 + 2
end
julia> @test quote 2+2 end == e
Test Failed at none:1
Expression: $(Expr(:quote, quote
2 + 2
end)) == e
Evaluated: begin
2 + 2
end == begin
#= none:1 =#
2 + 2
end
ERROR: There was an error during testing Can I make the same change to |
And actually, unfortunately, @vtjnash i don't think the solution you presented would work here; that still leaves linenumbers, as far as I can tell. I think the problem is that the julia> :(let args = (1,2,3); $(Base.remove_linenums!(quote 2+2 end)); end)
:(let args = (1, 2, 3)
#= REPL[5]:1 =#
begin
2 + 2
end
end) |
After thinking more about this, I wonder if the right solution is maybe to change I think this would solve the above problem, and match the intended behavior of
So I think that 1:1 correspondence is a nice property that we can take advantage of to solve this problem, by just changing EDIT: I have implemented this |
I'm not sure if this is related to #20620 or not.
The
@inferred
macro causes block quotes in the arguments to a function to lose theirLineNumberNode
s:I'm assuming it's got something to do with the way the temporary
args
variable is generated, since it's already gone by that line:but i'm not sure what about that is wrong.
The text was updated successfully, but these errors were encountered: