objectionary / objectionary/lints

unoptimizable-recursion misses self-recursion written by plain name (Φ.<name>)

Open Beginner friendly
#1,381 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
14
Forks
39
Avg merge
22h 54m
Merged PRs (30d)
90

Description

Problem

unoptimizable-recursion misses the most common way to write a self-recursive call — by plain name — because the modern parser resolves such calls to Φ.<name>, while the lint only looks for ξ.ρ.<name> (the ^-style form).

Root cause

src/main/resources/org/eolang/lints/design/unoptimizable-recursion.xsl:64-66:

<xsl:variable name="self" select="concat('ξ.ρ.', @name)"/>
<xsl:variable name="calls" select="... //o[@base = $self] ..."/>

Verified with a real program:

[] > calc
  if. > @
    n.eq 0
    1
    n.mul (calc (n.sub 1))

The inner call calc (...) is resolved by eo-parser 0.63.0 to @base='Φ.calc', so the lint finds no ξ.ρ.calc and reports nothing. The same recursion written as ^.calc does produce ξ.ρ.calc and is caught — so the lint's behavior depends on how the recursion is spelled, not on the recursion itself.

Expected behavior

Self-calls should be detected for both Φ.<name> and ξ.ρ.<name> forms (and ideally $<name>), so the lint is consistent regardless of the referencing syntax.

Related

  • #1321 (compiler fails to convert certain self-recursion shapes into Java loops) — the underlying design issue.
  • packs/single/unoptimizable-recursion/ — existing packs use the ^ form only.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/main/resources/org/eolang/lints/design/unoptimizable-recursion.xsl:64-66 and inspect the existing cases under packs/single/unoptimizable-recursion/. Run the related lint checks with examples using plain-name and ^ self-calls; done means both Φ. and ξ.ρ. forms are detected consistently, with coverage for the supported recursion references.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.