You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I assign to a variable in the condition of a while loop in this (working) code:
getdata() = rand() < 0.5 ? rand() : missing
function dowork()
while !ismissing((val = getdata();))
println(val^2)
end
end
When I format the file with JuliaFormatter.format_file(), the semicolon is removed. The code then errors with “ERROR: MethodError: no method matching ismissing(; val::Float64)”, changing the behavior.
The versions are Julia 1.9.3, JuliaFormatter 1.0.36. I've tried it with the default and setting SciML style.
I think this will be easier to do when we swap CSTParser for JuliaSyntax but atm placing the semicolon in the right spot can be problematic since it's only captured by the tokenizer and not the parse tree
I assign to a variable in the condition of a while loop in this (working) code:
When I format the file with JuliaFormatter.format_file(), the semicolon is removed. The code then errors with “ERROR: MethodError: no method matching ismissing(; val::Float64)”, changing the behavior.
The versions are Julia 1.9.3, JuliaFormatter 1.0.36. I've tried it with the default and setting SciML style.
It has been pointed out that the code that breaks isn't the most readable. Originally posted here https://discourse.julialang.org/t/formatting-assignment-in-function-call/105269
The text was updated successfully, but these errors were encountered: