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

Remove stray space after if condition on unit switch #132

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
hooks:
- id: gitlint
- repo: https://github.com/crate-ci/typos
rev: v1.23.3
rev: v1.24.5
hooks:
- id: typos
- repo: https://github.com/igorshubovych/markdownlint-cli
Expand Down
6 changes: 5 additions & 1 deletion corpus/unit.spicy
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ type X = unit {
} if (False);
};

# Condition on unit switch.
type X = unit {
switch {
-> : uint8;
} if(True) ;
};

# External hook implementation.
on X::Y::%done {1;2;
Expand Down
8 changes: 6 additions & 2 deletions corpus/unit.spicy.expected
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ type X = unit {
type X = unit {
switch (1) {
* -> : void;
} if(False) ;
} if(False);
};

# Condition on unit switch.
type X = unit {
switch {
-> : uint8;
} if(True);
};

# External hook implementation.
on X::Y::%done {
Expand Down
7 changes: 7 additions & 0 deletions src/query.scm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@

(unit_switch
"if" @prepend_space
.
"("
.
(expression)
.
; FIXME(bbannier): Unsure where this space comes from.
")" @append_antispace
)

(unit_switch_case
Expand Down
Loading