Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: same name of the components should add an error to the circuit json #724

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

imrishabh18
Copy link
Member

@imrishabh18 imrishabh18 commented Apr 7, 2025

/close #723

Copy link

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tscircuit-core-benchmarks ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2025 8:30pm

const errors = checkEachPcbTraceNonOverlapping(db.toArray())
for (const error of errors) {
db.pcb_trace_error.insert(error)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to only run this on the board, because DRC requirements are board-wide, it is a bit of an unusual case but i do think ots correct to have it on board

const { db } = this.root!

if (this.isSubcircuit) {
const subcircuitComponentsByName = new Map<string, PrimitiveComponent[]>()
Copy link
Contributor

Choose a reason for hiding this comment

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

Subcircuit component name checking is good 👍 this one doesnt need to go on the board

Copy link
Member Author

Choose a reason for hiding this comment

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

So, we don't need to check it here in Board. But we will have to import from the Group class for this behaviour to be accepted, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can call the super method inside the board so that it runs the DRC checks that run for any subcircuit. You can alternatively create an internal underscore function that does what the subcircuit does. For example _checkForConflictingNames()

pcbX={-3}
/>
</subcircuit>
</group>,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a valid circuit that shouldnt error. Names must be unique within a subcircuit

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't I am checking for the pcb_trace_error to be 0, will update the test name to be clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Woops sorry ty!!

@imrishabh18 imrishabh18 merged commit e01595e into main Apr 7, 2025
11 checks passed
@imrishabh18 imrishabh18 deleted the fix-same-name branch April 7, 2025 21:47
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.

This circuit doesn't throw any error, why?
2 participants