Skip to content

fix(sv): validate module and interface names without interface ports - #1621

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-design-unit-namespace/validate-module-interface-names-without-interface--95004bce
Oct 21, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/sv-design-unit-namespace/validate-module-interface-names-without-interface--95004bce

Conversation

@tignear

@tignear tignear commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T22:32:04.070798Z
We couldn’t complete this review. Comment @codex review to try again.
5fbd5f6 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@tignear

tignear commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial c7b14d1 2026-10-20 14:22 UTC
2 content c7b14d1 → bfe716b Address review: retain declaration warnings on namespace collisions and validate module analysis with prebuilt interface packages 2026-10-20 14:22 UTC
3 content bfe716b → 4dba364 Address review: preserve non-ANSI interface names separately from semantic binding sources for split-source namespace validation 2026-10-20 14:28 UTC
4 content 4dba364 → 5fbd5f6 Resolve PR #1621 conflicts with current master while preserving namespace validation and review regressions 2026-10-20 22:31 UTC

@tignear
tignear force-pushed the stack/tignear/fix/sv-design-unit-namespace/validate-module-interface-names-without-interface--95004bce branch from c7b14d1 to bfe716b Compare October 20, 2026 14:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread crates/celox-sv-analyzer/src/parsed.rs Outdated
packages: &Packages,
) -> Result<(), AnalyzerError> {
let name = ast::normalize_identifier(module_name);
if packages.interface_sources.contains_key(&name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@tignear
tignear force-pushed the stack/tignear/fix/sv-design-unit-namespace/validate-module-interface-names-without-interface--95004bce branch from bfe716b to 4dba364 Compare October 20, 2026 14:28
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 20, 2026
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
@tignear
tignear force-pushed the stack/tignear/fix/sv-design-unit-namespace/validate-module-interface-names-without-interface--95004bce branch from 4dba364 to 5fbd5f6 Compare October 20, 2026 22:31
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@mergify mergify Bot added the queued Mergify queue entry label Oct 20, 2026
@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit bc10c18 into master Oct 21, 2026
31 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/sv-design-unit-namespace/validate-module-interface-names-without-interface--95004bce branch October 21, 2026 00:02
@mergify mergify Bot removed the queued Mergify queue entry label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(sv): validate module and interface names without interface ports

1 participant