Perl: cross-file method resolution and accessor typing (Moose, Mojo::Base)

Open
#2,949 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c, perl

Research direction

Start with internal/cbm/lsp/perl_lsp.c and the reference work in #2171, then review the shared cross-file registry used by other language resolvers. Check #2846 for possible tree-sitter-perl node changes. Pick one behavior and add a before/after regression test; done means that behavior resolves correctly from current main with signed-off commits.

Written by the indexing model from the issue text.

Description

enhancement

Perl call resolution is currently file-local. The Perl semantic pass (internal/cbm/lsp/perl_lsp.c) builds its type registry from the current file's definitions plus the stdlib tables, and there is no cross-file pass for Perl. On current main that leaves these gaps:

  1. Inheritance across files. A method inherited through use parent, use base or @ISA resolves through the semantic pass only when the parent package is defined in the same file.
  2. Accessor typing. Moose and Mojo::Base has attributes are not modelled, so a chain such as $self->ua->get(...) loses its receiver type after the accessor.
  3. require imports. Only top-level use statements produce import rows; require Foo::Bar; (often conditional, or written as require 'Foo/Bar.pm') produces none.
  4. Perl 5.38 class syntax. class / method / field (Corinna) is not handled by the semantic pass.

Reference work: #2171 (thank you, @turtacn) implemented all of these on a September base, with a regression test for each step, and is the best reference for the shape of the work. It could not be merged as it stood (opened from a fork's main, conflicting with current main, unsigned commits), so it was closed; focused slices of it are welcome.

How we would like to land it:

  • One behaviour per PR, cut from current main, with a before/after regression test and signed-off commits (git commit -s).
  • Cross-file resolution should build on the shared cross-file registry the other language resolvers use, rather than a per-file scan of the whole project, so indexing stays linear on large Perl codebases.
  • Related: #2846 (tree-sitter-perl grammar refresh) may change node names this work depends on.

No timeline is implied; this issue keeps the gap visible so it is not lost.

Dominant language
C
Stars
45.8k
Forks
3.8k
Avg merge
2d 18h
Merged PRs (30d)
108

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from DeusData/codebase-memory-mcp

All issues in DeusData/codebase-memory-mcp

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.