Skip to content

tests: Add test of repeated adding of the same extension #539

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

Closed
wants to merge 1 commit into from

Conversation

croyzor
Copy link
Contributor

@croyzor croyzor commented Sep 18, 2023

No description provided.

@croyzor croyzor requested a review from aborgna-q September 18, 2023 09:20
let mut windows = nodes.windows(2);
while let Some(&[src, tgt]) = windows.next() {
hugr.connect(src, 0, tgt, 0)?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Validate it afterwards? Where would a broken inference fail?

Copy link
Contributor Author

@croyzor croyzor Sep 18, 2023

Choose a reason for hiding this comment

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

oops! 🤦

// Connect nodes in order (0 -> 1 -> 2 ...)
let nodes = [node0, node1, node2, node3, node4, node5];
let mut windows = nodes.windows(2);
while let Some(&[src, tgt]) = windows.next() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be for &[src, tgt] in nodes.windows(2) {...} or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately that doesn't work quite as well because rust doesn't know at compile time the size of the window and complains that &[src, tgt] is a refutable pattern.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use `tuple_windows instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙌

@croyzor croyzor force-pushed the tests/inference-test branch from 2228d35 to 87d9345 Compare September 18, 2023 13:51
@croyzor
Copy link
Contributor Author

croyzor commented Sep 18, 2023

This test should've been added to #538 instead of its own PR! But it should act as proof that this test doesn't pass on main, so #538 is doing something!

(Will close after tests run)

@croyzor croyzor closed this Sep 18, 2023
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.

3 participants