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

Apply new version of JuliaFormatter #589

Closed
wants to merge 1 commit into from
Closed

Apply new version of JuliaFormatter #589

wants to merge 1 commit into from

Conversation

gdalle
Copy link
Member

@gdalle gdalle commented Oct 16, 2024

Format all code with JuliaFormatter v2.0, now based on JuliaSyntax

@codecov-commenter
Copy link

codecov-commenter commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 55.10204% with 22 lines in your changes missing coverage. Please review.

Project coverage is 50.72%. Comparing base (9174ccb) to head (ccdd07a).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...faceZygoteExt/DifferentiationInterfaceZygoteExt.jl 0.00% 3 Missing ⚠️
...ace/ext/DifferentiationInterfaceEnzymeExt/utils.jl 0.00% 2 Missing ⚠️
...xt/DifferentiationInterfaceForwardDiffExt/utils.jl 0.00% 2 Missing ⚠️
.../ext/DifferentiationInterfaceMooncakeExt/onearg.jl 0.00% 2 Missing ⚠️
...t/DifferentiationInterfaceReverseDiffExt/twoarg.jl 0.00% 2 Missing ⚠️
...ext/DifferentiationInterfaceSymbolicsExt/onearg.jl 0.00% 2 Missing ⚠️
...ationInterface/test/Misc/DifferentiateWith/test.jl 0.00% 2 Missing ⚠️
...ifferentiationInterfaceEnzymeExt/reverse_onearg.jl 0.00% 1 Missing ⚠️
...entiationInterfaceFastDifferentiationExt/twoarg.jl 0.00% 1 Missing ⚠️
.../ext/DifferentiationInterfaceMooncakeExt/twoarg.jl 0.00% 1 Missing ⚠️
... and 4 more

❗ There is a different number of reports uploaded between BASE (9174ccb) and HEAD (ccdd07a). Click for more details.

HEAD has 32 uploads less than BASE
Flag BASE (9174ccb) HEAD (ccdd07a)
DIT 8 4
DI 33 5
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     
Flag Coverage Δ
DI 31.22% <41.66%> (-67.38%) ⬇️
DIT 85.61% <92.30%> (-10.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -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}
Copy link
Member Author

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

Copy link

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.

Copy link

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?

Copy link
Member Author

@gdalle gdalle Oct 17, 2024

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.

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.

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

Successfully merging this pull request may close these issues.

4 participants