feat: detect duplicate import names and store qualified names on entities#31
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the changes requested in #24:
Component,System, andInterfaceDefnow carry aqualified_namefield that holds the fully-dotted scope path assigned during semantic analysis.SystemA.WorkerandSystemB.Worker) remain valid and are uniquely identified by their qualified name.Closes #24
Generated with Claude Code