Skip to content

Put keyword arguments after ; in function calls - #231

Draft
fredrikekre wants to merge 1 commit into
masterfrom
fe/kwargs
Draft

fredrikekre wants to merge 1 commit into
masterfrom
fe/kwargs

Conversation

@fredrikekre

Copy link
Copy Markdown
Owner

Keyword arguments in calls written with a , are now separated from the
positional arguments with a ;, e.g. f(x, a = 1) becomes f(x; a = 1)
and f(a = 1) becomes f(; a = 1). Comma-kwargs are merged into an
existing ; group (f(x, a = 1; b = 2) -> f(x; a = 1, b = 2)).

Arguments are never reordered since Julia evaluates them in source order,
so calls with a positional argument after a keyword argument
(f(a = 1, x)) are left as is. The rule applies to calls only, including
calls inside macro calls and quoted expressions, but not to function or
macro definition signatures, macro calls, tuples, indexing, or curly
braces. Definition signatures are identified by a new
TAG_FUNCTION_SIGNATURE tag set top-down from the function/macro node
since the lineage alone can not distinguish the signature call from the
body call in f(x, a = 1) = g(y, b = 2).

Closes #33.

Keyword arguments in calls written with a `,` are now separated from the
positional arguments with a `;`, e.g. `f(x, a = 1)` becomes `f(x; a = 1)`
and `f(a = 1)` becomes `f(; a = 1)`. Comma-kwargs are merged into an
existing `;` group (`f(x, a = 1; b = 2)` -> `f(x; a = 1, b = 2)`).

Arguments are never reordered since Julia evaluates them in source order,
so calls with a positional argument after a keyword argument
(`f(a = 1, x)`) are left as is. The rule applies to calls only, including
calls inside macro calls and quoted expressions, but not to function or
macro definition signatures, macro calls, tuples, indexing, or curly
braces. Definition signatures are identified by a new
TAG_FUNCTION_SIGNATURE tag set top-down from the `function`/`macro` node
since the lineage alone can not distinguish the signature call from the
body call in `f(x, a = 1) = g(y, b = 2)`.

This is a new formatting rule (Runic 2.0), not a spec-bug fix. Runic's
own sources are reformatted accordingly.

Closes #33.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.98658% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.85%. Comparing base (20e05bd) to head (4fa674d).

Files with missing lines Patch % Lines
src/chisels.jl 50.00% 2 Missing ⚠️
src/runestone.jl 99.27% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #231      +/-   ##
==========================================
+ Coverage   90.60%   90.85%   +0.24%     
==========================================
  Files           9        9              
  Lines        4088     4231     +143     
==========================================
+ Hits         3704     3844     +140     
- Misses        384      387       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Move keyword arguments to the end and always use ; before kwargs

1 participant