Skip to content

feat: detect duplicate import names and store qualified names on entities#31

Merged
amhellmund merged 2 commits into
mainfrom
claude/issue-24-20260227-2334
Feb 28, 2026
Merged

feat: detect duplicate import names and store qualified names on entities#31
amhellmund merged 2 commits into
mainfrom
claude/issue-24-20260227-2334

Conversation

@amhellmund
Copy link
Copy Markdown
Owner

Implements the changes requested in #24:

  • Duplicate imports with the same entity name now produce a semantic error.
  • Component, System, and InterfaceDef now carry a qualified_name field that holds the fully-dotted scope path assigned during semantic analysis.
  • Same-named entities in different scopes (e.g. SystemA.Worker and SystemB.Worker) remain valid and are uniquely identified by their qualified name.
  • Tests cover all new behaviours.

Closes #24

Generated with Claude Code

github-actions Bot and others added 2 commits February 27, 2026 23:41
…ties

- Add `qualified_name: str` field to `Component`, `System`, and
  `InterfaceDef`.  The field is assigned by semantic analysis and holds
  the fully-dotted scope path (e.g. "SystemA.Worker" for a component
  named "Worker" inside "SystemA").  This allows entities with the same
  local name in different scopes to be distinguished uniquely.

- Add `_assign_qualified_names()` in semantic analysis, called as a side
  effect of `analyze()`.  It recursively traverses the entity tree and
  sets `qualified_name` on every interface, component, and system.
  Versioned interfaces include the version suffix ("Foo@v2").

- Add `_check_duplicate_imports()` which rejects the same entity name
  appearing in more than one `from ... import` statement (regardless of
  whether the source paths are the same or different).

- Add `TestDuplicateImportNames` and `TestQualifiedNames` test classes
  covering the new behaviours, including the case where two systems each
  contain a component with the same local name (which must not produce
  an error because their qualified names differ).

Closes #24

Co-authored-by: Andi Hellmund <amhellmund@users.noreply.github.com>
@amhellmund amhellmund merged commit 5b64f87 into main Feb 28, 2026
5 checks passed
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.

Semantic analysis

1 participant