Skip to content

sparse-decoration wrongly flags void φ as a decoration #1130

Description

@yegor256

misc/sparse-decoration.xsl:17 reports "Sparse decoration is prohibited" for a
formation whose only attribute is a void φ, that is [@] > input. The
predicate checks count(o[...])=1 and o[...][1][@name='φ'], but never checks
that the φ child carries a @base. For [@] > input the parser emits
<o base="∅" line="16" name="φ"/>, and the lint counts it as a decoration.

That is wrong because a void φ is not a decoration at all — it is a free
attribute the caller must supply, the abstract-interface idiom. There is
nothing to inline into it and nothing to widen; the object has no body. In
objectionary/eo this hits eo-runtime/src/main/eo/input.eo:16 and
eo-runtime/src/main/eo/output.eo:15, both of which exist precisely so that
input.dead, bytes.as-input and friends can decorate them.

The fix is to add @base to the φ test in the predicate — for instance require
o[...][1][@name='φ'][@base != '∅'] — so that a void φ is skipped the same way
errors/decorated-formation.xsl already distinguishes a bound φ from a void one.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood-titleThe title was checked and improved by ChatGPT

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions