Repository navigation
fix(sv): validate module and interface names without interface ports - #1621
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7b14d1e0a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let Some(previous) = design_units.insert(name.clone(), unit.kind) | ||
| && previous != unit.kind | ||
| { | ||
| return Err(AnalyzerError::DuplicateModule { name }); |
There was a problem hiding this comment.
Preserve warnings when rejecting name collisions
When the colliding design also contains a package or compilation-unit function that triggers a declaration warning (for example, $exit outside a program), this early return occurs before Packages::analyze_with_roots collects those warnings, so AnalyzerError::warnings() is unexpectedly empty. Previously detected module/interface collisions reached the later interface-planning check after package warnings had been appended; collect the syntactic package warnings before this validation or attach them to the returned error.
Useful? React with 👍 / 👎.
| // whether interface ports require a full binding plan. Inspect | ||
| // declarations only, so unrelated interface bodies stay selective. | ||
| let mut design_units = HashMap::default(); | ||
| for source in sources { |
There was a problem hiding this comment.
Validate modules analyzed with prebuilt packages
Because this validation compares only the sources supplied to the current package-analysis call, the public split-source workflow still accepts the collision: build Packages from a source containing interface I; endinterface, then pass those packages to analyze_source_module_with_packages for a separate source containing module I; endmodule. That entry point directly invokes ParsedSource::analyze_module, which never compares the module against packages.interface_sources, so the module and interface continue to coexist despite the new shared-namespace check.
Useful? React with 👍 / 👎.
Revision history
|
c7b14d1 to
bfe716b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfe716b1a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| packages: &Packages, | ||
| ) -> Result<(), AnalyzerError> { | ||
| let name = ast::normalize_identifier(module_name); | ||
| if packages.interface_sources.contains_key(&name) |
There was a problem hiding this comment.
Track non-ANSI interface names in prebuilt packages
When Packages is built from a valid non-ANSI interface such as interface I(a); input a; endinterface, the collection loop excludes it from interface_sources, so this check cannot see it; a later analyze_source_module_with_packages call for module I; endmodule therefore succeeds even though the declarations share the design-element namespace. Preserve all interface names separately for namespace validation rather than relying only on the ANSI interface sources used for semantic binding.
Useful? React with 👍 / 👎.
bfe716b to
4dba364
Compare
Package setup previously relied on interface-port planning to detect a module and interface sharing the same name. Sources using only local interface instances could therefore bypass the shared namespace check. Check module/interface declaration names before package semantic analysis, retaining syntactic package and compilation-unit warnings on failure. Keep all interface names, including non-ANSI declarations, separate from the ANSI sources used for semantic binding. Check module analysis against interfaces in prebuilt Packages, including declaration-only analysis, without analyzing unrelated interface bodies. Fixes #1497. Validation: failed-before regressions cover both declaration orders, non-ANSI modules and interfaces, declarations split across files, and the public prebuilt-packages and declaration-only APIs. Regressions also check warning preservation and selective handling of unused interface bodies. On the current master base, analyzer tests pass (762 tests, 3 existing ignores, 2 doctests), as do all 3,174 SV integration tests (90 existing ignores), affected-crate Clippy with warnings denied, formatting and diff checks. No shared executable cases changed, so external simulators were not rerun. The master rebase preserves the analysis-options package entry point, including the mixed-timescale compatibility option, alongside declaration namespace validation and warning retention. Change-Id: I95004bcea16e94aa69e9444bbaae669840f51d33
4dba364 to
5fbd5f6
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merge Queue Status
This pull request spent 57 minutes 45 seconds in the queue, including 55 minutes 31 seconds running CI. Required conditions to merge
|
Package setup previously relied on interface-port planning to detect a
module and interface sharing the same name. Sources using only local
interface instances could therefore bypass the shared namespace check.
Check module/interface declaration names before package semantic analysis,
retaining syntactic package and compilation-unit warnings on failure. Keep
all interface names, including non-ANSI declarations, separate from the
ANSI sources used for semantic binding. Check module analysis against
interfaces in prebuilt Packages, including declaration-only analysis,
without analyzing unrelated interface bodies.
Fixes #1497.
Validation: failed-before regressions cover both declaration orders,
non-ANSI modules and interfaces, declarations split across files, and the
public prebuilt-packages and declaration-only APIs. Regressions also check
warning preservation and selective handling of unused interface bodies.
On the current master base, analyzer tests pass (762 tests, 3 existing
ignores, 2 doctests), as do all 3,174 SV integration tests (90 existing
ignores), affected-crate Clippy with warnings denied,
formatting and diff checks. No shared executable cases changed, so external
simulators were not rerun.
The master rebase preserves the analysis-options package entry point,
including the mixed-timescale compatibility option, alongside declaration
namespace validation and warning retention.