Fix sparse-decoration wrongly flagging void φ as decoration (#1130) - #1133
Merged
Conversation
A formation whose only attribute is a void φ (the abstract-interface idiom, e.g. `[@] > input`) is not a decoration: there is nothing to inline and the object has no body. The predicate only checked that the single child was named φ, so the parser's void φ (`@base='∅'`) was counted as a decoratee. Require the φ child not to be void (`not(@base='∅')`), mirroring how other lints distinguish a bound φ from a void one. Using `not(@base='∅')` rather than `@base != '∅'` keeps flagging the formation-as-decoratee case (`[] > @`), whose φ carries no `@base` at all. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHPhak7n4mBMk4QfZgb2iP
|
@yegor256 Thanks for the contribution! You've earned +4 points for this: +16 as a basis; -8 for the lack of code review; -4 for too few (12) hits-of-code. Please, keep them coming. Your running score is +2793; don't forget to check your Zerocracy account too). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1130.
Problem
misc/sparse-decoration.xslreported "Sparse decoration is prohibited" for a formation whose only attribute is a void φ, i.e. the abstract-interface idiom[@] > input. The predicate checkedcount(o[...])=1ando[...][1][@name='φ'], but never checked that the φ child carries a real@base. For[@] > inputthe parser emits a void φ (@base='∅'), and the lint counted it as a decoration.A void φ is not a decoration — it is a free attribute the caller must supply. There is nothing to inline and the object has no body. This false-positive hit real objects in
objectionary/eosuch aseo-runtime/src/main/eo/input.eoandoutput.eo.Fix
Add a
not(@base='∅')guard to the φ test in the predicate so a void φ is skipped, the same way other lints distinguish a bound φ from a void one.The issue suggested
@base != '∅', but that would break the existing formation-as-decoratee case ([] > @), whose φ carries no@baseattribute at all —@base != '∅'evaluates to false when@baseis absent. Usingnot(@base='∅')excludes only void φ while still flagging bound-φ and formation-φ decoratees.Tests
Added
no-sparse-because-void-phi.yamlcovering[@] > input, which now yields zero defects. All 348LtByXslTest#testsAllLintsByEopack tests pass.Generated by Claude Code