Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

check_unique refactor#667

Open
kkysen wants to merge2 commits intopfb/unique-checking
base:pfb/unique-checking
Choose a base branch
Loading
fromkkysen/pfb/unique-checking/check-unique-refactor

Conversation

kkysen
Copy link
Contributor

Refactored all the unique and non-uniqueassert!ions intocheck_unique, which is much more concise and avoids the ton of repetition there was previously. It also adds more context to the error message when it fails.

@kkysenkkysenforce-pushed thekkysen/pfb/unique-checking/check-unique-refactor branch from3d11ec4 to34bc78fCompareSeptember 16, 2022 07:33
@kkysenkkysenforce-pushed thekkysen/pfb/unique-checking/check-unique-refactor branch from34bc78f to7510aecCompareSeptember 16, 2022 15:13
@spernsteiner
Copy link
Collaborator

One downside I see to this approach is that in some cases it forces the node names in the assertion to be out of order compared to the graph, which makes it slightly harder to match the two up. I think we could get the best of both worlds with a macro along the lines ofassert_unique!(pdg, [a, !j, !b1, !b2, !c1, !c2, d2]);, or something like this:

let[a, j, b1, b2, c1, c2, d2] =unique_flags([a, j, b1, b2, c1, c2, d2]);assert!(a && !j && !b1 && !b2 && !c1 && !c2 && d2);

@kkysen
Copy link
ContributorAuthor

One downside I see to this approach is that in some cases it forces the node names in the assertion to be out of order compared to the graph, which makes it slightly harder to match the two up. I think we could get the best of both worlds with a macro along the lines ofassert_unique!(pdg, [a, !j, !b1, !b2, !c1, !c2, d2]);, or something like this:

let[a, j, b1, b2, c1, c2, d2] =unique_flags([a, j, b1, b2, c1, c2, d2]);assert!(a && !j && !b1 && !b2 && !c1 && !c2 && d2);

See#668. That solves this issue I think by putting the expectedunique value where we create theNode.

assert!(!info(&pdg, b3).unique);
assert!(!info(&pdg, c1).unique);
assert!(!info(&pdg, c2).unique);
check_unique(&pdg, &[], &[a, b1, b2, b3, c1, c2]);
Copy link
Contributor

Choose a reason for hiding this comment

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

having these two arguments really doesn't make clear that you're checking for non-uniqueness here, in addition to the function name. i suggest having one function for each

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, that might be better. Might not be worth changing, though, given#668.

Copy link
Contributor

@aneksteindaneksteind left a comment

Choose a reason for hiding this comment

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

see comment

@kkysen
Copy link
ContributorAuthor

I think we could get the best of both worlds with a macro along the lines ofassert_unique!(pdg, [a, !j, !b1, !b2, !c1, !c2, d2]);
I don't think we should add a macro if we don't need to.

or something like this:

let[a, j, b1, b2, c1, c2, d2] =unique_flags([a, j, b1, b2, c1, c2, d2]);assert!(a && !j && !b1 && !b2 && !c1 && !c2 && d2);

This wouldn't give good error messages, though.

@spernsteiner
Copy link
Collaborator

This whole PR is superseded by the approach in#668, right?

@kkysen
Copy link
ContributorAuthor

This whole PR is superseded by the approach in#668, right?

Yeah, pretty much.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@aneksteindaneksteindaneksteind requested changes

@spernsteinerspernsteinerAwaiting requested review from spernsteiner

@boyland-pfboyland-pfAwaiting requested review from boyland-pf

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@kkysen@spernsteiner@aneksteind

[8]ページ先頭

©2009-2025 Movatter.jp