From 25ebd37425956c5c53dafdf30988c51abc90bee2 Mon Sep 17 00:00:00 2001 From: bibonix Date: Wed, 29 Apr 2026 04:44:11 +0000 Subject: [PATCH 1/2] Add failing regression test for #637 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unused-void-attr lint emits a false-positive warning when a void attribute of an outer formation is referenced from a nested inner formation, because the inner reference is parsed as ξ.ρ. and the current XSL only matches ξ. substrings. --- ...lows-void-attr-used-in-nested-formation.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-void-attr-used-in-nested-formation.yaml diff --git a/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-void-attr-used-in-nested-formation.yaml b/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-void-attr-used-in-nested-formation.yaml new file mode 100644 index 000000000..61c58ede5 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-void-attr-used-in-nested-formation.yaml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +# Regression test for objectionary/lints#637. +# The void attribute "widths" of "tabular" is referenced from inside the +# nested "[i] > inner" formation as "widths.at i", which the parser turns +# into "ξ.ρ.widths.at". The lint must recognise this rho-walking reference +# as a real usage and not flag "widths" as unused. +sheets: + - /org/eolang/lints/misc/unused-void-attr.xsl +asserts: + - /defects[count(defect[contains(., '"widths"')])=0] +input: | + # Foo. + [widths] > tabular + [i] > inner + widths.at i > @ From 644cfc43d1ff0a20ff82556e88afdf5b942205ad Mon Sep 17 00:00:00 2001 From: bibonix Date: Wed, 29 Apr 2026 05:30:46 +0000 Subject: [PATCH 2/2] Fix #637: count rho-walking references as void-attr usages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unused-void-attr lint matched only literal 'ξ.' substrings, which made every reference from inside a nested formation ('ξ.ρ.', 'ξ.ρ.ρ.', ...) invisible to the lint and produced a false 'unused' warning for the outer void attribute. The XSL now matches any '^ξ(.ρ)*.(...)?$' base, counts the rho hops, and confirms that the formation declaring the attribute is exactly that many enclosing abstract scopes above the usage. The existing pack 'catches-usage-as-nested-rho-ref' was locking in the buggy behaviour; it is renamed to 'allows-usage-as-nested-rho-ref' and its assertion flipped to the correct expectation. --- .../org/eolang/lints/misc/unused-void-attr.xsl | 15 +++++++++++++-- ...f.yaml => allows-usage-as-nested-rho-ref.yaml} | 3 +-- 2 files changed, 14 insertions(+), 4 deletions(-) rename src/test/resources/org/eolang/lints/packs/single/unused-void-attr/{catches-usage-as-nested-rho-ref.yaml => allows-usage-as-nested-rho-ref.yaml} (74%) diff --git a/src/main/resources/org/eolang/lints/misc/unused-void-attr.xsl b/src/main/resources/org/eolang/lints/misc/unused-void-attr.xsl index 4c2ee3ac4..21ee7b0a1 100644 --- a/src/main/resources/org/eolang/lints/misc/unused-void-attr.xsl +++ b/src/main/resources/org/eolang/lints/misc/unused-void-attr.xsl @@ -3,7 +3,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com * SPDX-License-Identifier: MIT --> - + @@ -14,7 +14,18 @@ - + + + + + + + + + + + + diff --git a/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/catches-usage-as-nested-rho-ref.yaml b/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-usage-as-nested-rho-ref.yaml similarity index 74% rename from src/test/resources/org/eolang/lints/packs/single/unused-void-attr/catches-usage-as-nested-rho-ref.yaml rename to src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-usage-as-nested-rho-ref.yaml index 6d0368750..20c3f77fc 100644 --- a/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/catches-usage-as-nested-rho-ref.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/unused-void-attr/allows-usage-as-nested-rho-ref.yaml @@ -4,8 +4,7 @@ sheets: - /org/eolang/lints/misc/unused-void-attr.xsl asserts: - - /defects[count(defect[@severity='warning'])=1] - - /defects/defect[@line='2'] + - /defects[count(defect[@severity='warning'])=0] input: | # Foo [x] > foo