From d985e9eb2dd22c60c7d753dc530d7d61b352368f Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Wed, 11 Sep 2024 13:46:10 +0200 Subject: [PATCH 1/2] Remove stray space after `if` condition on unit `switch` --- corpus/unit.spicy | 6 +++++- corpus/unit.spicy.expected | 8 ++++++-- src/query.scm | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/corpus/unit.spicy b/corpus/unit.spicy index 549061b..ac0174c 100644 --- a/corpus/unit.spicy +++ b/corpus/unit.spicy @@ -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; diff --git a/corpus/unit.spicy.expected b/corpus/unit.spicy.expected index 17e1306..1b23615 100644 --- a/corpus/unit.spicy.expected +++ b/corpus/unit.spicy.expected @@ -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 { diff --git a/src/query.scm b/src/query.scm index c595754..69c6632 100644 --- a/src/query.scm +++ b/src/query.scm @@ -92,6 +92,13 @@ (unit_switch "if" @prepend_space + . + "(" + . + (expression) + . + ; FIXME(bbannier): Unsure where this space comes from. + ")" @append_antispace ) (unit_switch_case From 5161459048dae85e6f2c00be3db9a16d8375ac2f Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Wed, 11 Sep 2024 13:47:35 +0200 Subject: [PATCH 2/2] Bump pre-commit hooks --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a70b0f4..5caf735 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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