Conversation
Catches an `+alias` meta whose target is in the same package as the file's own `+package` meta. Since the compiler auto-homes a bare reference to an object of the same package, such an alias is dead weight (see objectionary/eo#5527). A cross-package alias, or one that renames the object to a new local name, is left alone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwFnKcNakcpzPWb6HTQFPu
The EO parser only allows a comment before metas, not between them and the object. The deep-tagged validatesEoPacksForErrors test caught the resulting parse errors on CI; the fixtures didn't need the comment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WwFnKcNakcpzPWb6HTQFPu
yegor256
marked this pull request as ready for review
August 27, 2026 06:35
Member
Author
|
@rultor merge |
Contributor
Contributor
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 #1045.
Adds a new lint
same-package-aliasthat catches an+aliasmeta whosetarget object lives in the same package as the file's own
+packagemeta. Since the compiler auto-homes a bare reference to an object in the
same package, such an alias is redundant (see objectionary/eo#5527,
which removed all the existing ones by hand).
The parser expands a bare
+alias org.eolang.txt.sprintfinto thetwo-part meta form
sprintf Φ.org.eolang.txt.sprintf. The lint flags ameta when the alias's fully-qualified target (with the
Φ.prefixstripped) equals
<package>.<local-name>. A renamed alias(
+alias sp org.eolang.txt.sprintf) or a cross-package alias is leftalone, since neither is redundant.
What's included
src/main/resources/org/eolang/lints/aliases/same-package-alias.xsl— the lintsrc/main/resources/org/eolang/motives/aliases/same-package-alias.md— motive docalias, allows a renamed same-package alias, allows an alias when no
+packagemeta is present, and checks thecontextattribute isprinted when line numbers are absent
Testing
mvn test -Dtest=LtByXslTest,PkMonoTest— 431 tests, 0 failuresmvn test -Dgroups='!deep & !benchmark'— 0 failures, 0 errorsGenerated by Claude Code