Skip to content

#1687: match the self-call homed into the package in unoptimizable-recursion - #1688

Merged
yegor256 merged 1 commit into
objectionary:masterfrom
sherenkov:bug/#1687/recursion-in-package
Nov 10, 2026
Merged

yegor256 merged 1 commit into
objectionary:masterfrom
sherenkov:bug/#1687/recursion-in-package

Conversation

@sherenkov

Copy link
Copy Markdown
Contributor

unoptimizable-recursion recognised the plain-name self-call of a top-level object only as Φ.<name>. In a program with a +package meta, eo-parser 0.63.0 puts the top-level object into its package, so calc (n.minus 1) inside [n] > calc of +package foo becomes base="Φ.foo.calc". No self-call matched, and the lint reported nothing for such a program, although the compiler does not turn Φ.foo.calc into a loop either.

The sheet now reads the package from the +package meta, and a new eo:plain function gives both spellings of a plain name, Φ.<name> and Φ.<package>.<name>. eo:is-self-call, eo:is-self-dispatch and eo:is-self-direct use it where they compared with concat('Φ.', $name), so the three shapes of the plain-name self-call are reported in a packaged program as they are in a program without a package.

New packs in packs/single/unoptimizable-recursion/, all with +package foo:

  • catches-plain-name-tail-call-in-a-package.yaml: the example from the issue, which reported no defect before and now gets the "names the formation directly" warning on line 7;
  • catches-plain-name-self-call-in-a-package.yaml: a self-call under n.mul, reported as "no self-call sits in a tail position";
  • catches-a-dispatch-on-the-plain-name-self-call-in-a-package.yaml: calc.plus 1, reported as "the self-call is the receiver of a dispatch";
  • allows-tail-call-in-an-if-branch-in-a-package.yaml: a nested ^.rec tail call, which still gets no defect.

The first three fail on master and pass with this change. mvn test -Dtest='LtByXslTest#checksAllLints' passes.

Closes #1687.

…timizable-recursion

In a program with a +package meta, eo-parser puts the top-level object into its package, so its plain-name self-call reads Φ.<package>.<name> instead of Φ.<name>, and the lint reported nothing. The self-call functions now accept both spellings.
@sherenkov

Copy link
Copy Markdown
Contributor Author

@yegor256 CI is green and the branch is up to date with master, could you take a look when you have a moment? It makes unoptimizable-recursion recognise the plain-name self-call of a top-level object in a program with +package, which the parser spells Φ.<package>.<name> and the lint used to miss.

@yegor256 yegor256 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change matches issue #1687 and the new packs cover the reported case and keep neighbouring behavior intact.

@yegor256
yegor256 merged commit a8ec0f8 into objectionary:master Nov 10, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unoptimizable-recursion misses a plain-name self-call of a top-level object in a program with +package

2 participants