-
Notifications
You must be signed in to change notification settings - Fork 13
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
Apply new version of JuliaFormatter #589
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #589 +/- ##
===========================================
- Coverage 97.57% 50.72% -46.85%
===========================================
Files 110 100 -10
Lines 5227 5118 -109
===========================================
- Hits 5100 2596 -2504
- Misses 127 2522 +2395
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -10,11 +10,11 @@ to_val(::DI.BatchSizeSettings{B}) where {B} = Val(B) | |||
|
|||
## Annotations | |||
|
|||
function get_f_and_df(f::F, ::AutoEnzyme{M,Nothing}, ::Val{B}=Val(1)) where {F,M,B} | |||
function get_f_and_df(f::F, ::AutoEnzyme{M,Nothing}; (::Val{B})=Val(1)) where {F,M,B} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this automatic formatting changes the semantics, turning a positional argument into a keyword argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be disabled with separate_kwargs_with_semicolon=false
I think this is the behaviour one would want for the option though, no? It seems if it didn't make this transformation previously it would be a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or is it such that ::Val{B}=Val(1) is not considered a keyword argument but val::Val{B}=Val(1) is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, previously it wasn't a bug. It was an unnamed positional argument, for which I'm only interested in the type (think of it as a Holy trait).
Besides, @MilesCranmer seems to say that the same behavior can be observed for named positional arguments, which is also problematic.
Named or unnamed, positional arguments can also have default values, as long as they come at the end of the list of positional arguments and before the semicolon. They don't need to be keyword arguments to have default values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Here’s an example in my codebase:
function check_constraints(
tree::AbstractExpressionNode,
options::AbstractOptions,
- maxsize::Int,
+ maxsize::Int;
cursize::Union{Int,Nothing}=nothing,
)::Bool
This means that doing a function call check_constraints(tree, options, maxsize, cursize)
will now throw an error when previously it worked.
Format all code with JuliaFormatter v2.0, now based on JuliaSyntax