Skip to content

idempotency attribute incorrectly flagged as an anonymous object in linter #730

@h1alexbel

Description

@h1alexbel

Here is the EO snippet:

[] > foo
  [] +> tests-slice-foreign-literals
    eq. > @
      "hello, 大家!".slice
        7
        1
      "大"

The test will be parsed to this XMIR:

<o line="405" name="+tests-slice-foreign-literals" pos="2">
   <o base="ξ.xi🌵" line="405" pos="2"/>
   <o base=".eq" line="406" name="φ" pos="4">
      <o base=".slice" line="407" pos="18">
         <o base="Φ.org.eolang.string" line="407" pos="6">
            <o as="α0" base="Φ.org.eolang.bytes" line="407" pos="6">
               <o as="α0" line="407" pos="6">68-65-6C-6C-6F-2C-20-E5-A4-A7-E5-AE-B6-21</o>
            </o>
         </o>
         <o base="Φ.org.eolang.number" line="408" pos="8">
            <o as="α0" base="Φ.org.eolang.bytes" line="408" pos="8">
               <o as="α0" line="408" pos="8">40-1C-00-00-00-00-00-00</o>
            </o>
         </o>
         <o base="Φ.org.eolang.number" line="409" pos="8">
            <o as="α0" base="Φ.org.eolang.bytes" line="409" pos="8">
               <o as="α0" line="409" pos="8">3F-F0-00-00-00-00-00-00</o>
            </o>
         </o>
      </o>
      <o base="Φ.org.eolang.string" line="410" pos="6">
         <o as="α0" base="Φ.org.eolang.bytes" line="410" pos="6">
            <o as="α0" line="410" pos="6">E5-A4-A7</o>
         </o>
      </o>
   </o>
</o>

And lints will complain:

It is prohibited to have formations like "+tests-slice-foreign-literals" that contain anonymous objects inside (anonymous-objects-inside-formation (Single))

Here, object with @base="ξ.xi🌵" (idempotency attribute) is technically anonymous, however we should not complain about it, since we need it for special reasons.

Let's not complain about idempotency attributes.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood-titleThe title was checked and improved by ChatGPThelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions