Skip to content

Load package dependencies of interfaces#367

Open
jeet-dekivadia wants to merge 3 commits into
hudson-trading:mainfrom
jeet-dekivadia:codex/load-interface-package-dependencies
Open

Load package dependencies of interfaces#367
jeet-dekivadia wants to merge 3 commits into
hudson-trading:mainfrom
jeet-dekivadia:codex/load-interface-package-dependencies

Conversation

@jeet-dekivadia

@jeet-dekivadia jeet-dekivadia commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • queue newly discovered package and interface trees for recursive dependency discovery
  • add interface-imported packages to shallow compilation without recursively walking discovered modules
  • add a regression fixture where a module depends on an interface that imports its payload type from a package

Correctness

The originating tree is always inspected. Discovered documents are always added to the shallow dependency set, but only package and interface syntax trees are queued for another discovery step. For the regression graph, the walk reaches interface_consumer -> transitive_if -> transitive_pkg. A module discovered beneath another file is not queued, so the loader does not recursively follow the design hierarchy.

Fixes #349

Remote Linux validation

  • git diff --check
  • uv run pre-commit run --all-files
  • cmake --preset clang-release -DSLANG_CI_BUILD=ON
  • cmake --build build/clang-release -j2
  • ctest --test-dir build/clang-release --output-on-failure --no-tests=error -j2
  • uv venv
  • source .venv/bin/activate
  • uv sync
  • pytest tests/system/ --binary build/clang-release/bin/slang-server

Comment thread src/ServerDriver.cpp Outdated
}
}
// Interfaces and modules can add package dependencies of their own.
treesToProcess.push(newdoc->getSyntaxTree());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will result in a whole design being loaded in shallow compilation; we don't want this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this. I narrowed the queue so discovered packages and interfaces are inspected recursively, while discovered modules are still added as shallow dependencies but are not queued. That keeps the interface-imported package case working without following the design hierarchy. I reran the Linux configure, build, CTest, and system-test lane successfully.

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.

Incomplete type when I don't import the package

2 participants