From 7dfd525c8dc5e49ada7f545a720a7e874cff1ec3 Mon Sep 17 00:00:00 2001 From: bibonix Date: Sun, 3 May 2026 04:24:33 +0000 Subject: [PATCH 1/2] test(#640): add failing pack reproducing chained-dot self usage The redundant-object lint flags 'self' as redundant when it is reached via a chained dot reference like '(...).self', because the usage XPath only matches '@base' values prefixed with 'xi(.rho)*'. The new pack exercises exactly that shape and currently fails. --- .../allows-self-used-via-chained-dot.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/resources/org/eolang/lints/packs/single/redundant-object/allows-self-used-via-chained-dot.yaml diff --git a/src/test/resources/org/eolang/lints/packs/single/redundant-object/allows-self-used-via-chained-dot.yaml b/src/test/resources/org/eolang/lints/packs/single/redundant-object/allows-self-used-via-chained-dot.yaml new file mode 100644 index 000000000..90e59a665 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/redundant-object/allows-self-used-via-chained-dot.yaml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/misc/redundant-object.xsl +asserts: + - /defects[count(defect)=0] +input: | + # Bytes as input. + [bts] > bytes-as-input + # Read 'size' amount of bytes from 'bts'. + [size] > read + ((input-block bts --).read size).self > @ + # Bytes-as-input block. + [data buffer] > input-block + buffer > @ + $ > self From f7d3d5e21bb1d3df73aa96daa9149bdb601fe9a7 Mon Sep 17 00:00:00 2001 From: bibonix Date: Sun, 3 May 2026 04:43:43 +0000 Subject: [PATCH 2/2] fix(#640): allow chained-dot usage of $-aliased attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an attribute is declared as a $-alias (`$ > name`) and the only reference to it appears as a chained method call (`(...).name`), the parser emits the usage as ``, which the previous `^ξ(?:\.ρ)*\.(?:\.[\w-]+)*$` regex never matched. The lint therefore counted zero usages and flagged the attribute as redundant, even though inlining it (`(...).$`) is not valid EO. Add a second regex matching the chained-dot form and suppress the warning when the candidate is a $-alias and at least one such usage exists. Same-level redundant aliases stay flagged because their usages still appear under the `ξ.` form. --- src/main/resources/org/eolang/lints/misc/redundant-object.xsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/org/eolang/lints/misc/redundant-object.xsl b/src/main/resources/org/eolang/lints/misc/redundant-object.xsl index 3a09f8775..73708188a 100644 --- a/src/main/resources/org/eolang/lints/misc/redundant-object.xsl +++ b/src/main/resources/org/eolang/lints/misc/redundant-object.xsl @@ -13,7 +13,8 @@ - + +