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

Objectify: warn if Is{Component,Positional}ObjectRep absent #4964

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fingolfin
Copy link
Member

This works towards resolving #1043: now Objectify warns if IsPositionalObjectRep resp. IsComponentObjectRep is not set for an object that should have one of them; and it also gives an error if both are set / "the wrong one" is set (i.e. IsPositionalObjectRep for a T_COMOBJ or IsComponentObjectRep for a T_POSOBJ).

I've eliminated all the warnings triggered by loading GAP and running tst/testinstall.g, and submitted gap-packages/fr#50 to fix one violation in a package (I've already fixed a bunch of others in packages in the past couple years). I am guessing there may still be a couple more, so I am reluctant to turn the warnings into an error just now... at the very least, before we attempt such a thing, the test suites of all packages should be run against a GAP with that error activated.

Also, before merging this PR we should check how this extra test affects performance: Objectify is a bit of a bottleneck, and we don't want to make it worse than it already is...

@fingolfin
Copy link
Member Author

Hmm, thinking about it, I am not even sure why to warn -- instead we could just add that flag? Perhaps for performance reasons: a missing flag that has to be added in requires us to create a new sub-type...

@fingolfin fingolfin closed this Mar 15, 2024
@fingolfin fingolfin reopened this Mar 15, 2024
@fingolfin fingolfin closed this Oct 25, 2024
@fingolfin fingolfin reopened this Oct 25, 2024
Comment on lines +605 to +606
#Assert(0, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)));
Assert(0, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)));
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe disable this by default, but have it enabled e.g. in most test suites (as long as the use START_TEST)?

Suggested change
#Assert(0, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)));
Assert(0, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)));
#Assert(1, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)));
Assert(1, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)));

Comment on lines +613 to +614
#Assert(0, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)));
Assert(0, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)));
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
#Assert(0, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)));
Assert(0, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)));
#Assert(1, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)));
Assert(1, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)));

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.

1 participant