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

[Core] Fix isSet flag when setting a link to a not-yet created data #5081

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fredroy
Copy link
Contributor

@fredroy fredroy commented Oct 23, 2024

In SimpleAPI and SofaPython3 (surely XML too),
if a data link is set to a data of a not-yet created BaseObject, isSet is not true.

In the newly created tests, the last one would be false without the fix in BaseData


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request pr: test PR adding test(s) in SOFA labels Oct 23, 2024
@fredroy
Copy link
Contributor Author

fredroy commented Oct 23, 2024

[ci-build][with-all-tests]

@alxbilger
Copy link
Contributor

Is this related to #4910?

@hugtalbot
Copy link
Contributor

This should fix #4911

@fredroy
Copy link
Contributor Author

fredroy commented Oct 23, 2024

Is this related to #4910?

Maybe but It was not my intention 😅 I got the problem in SofaPython3 for our own component.

This should fix #4911

It would have been convenient to have a test related to this problem 👼

{"printLog", "true"}
});
auto* objdata4 = obj4->findData("printLog");
ASSERT_TRUE(objdata4->isSet());
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be good to add a test with a wrong link ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might be good to add a test with a wrong link ?

done.

Actually this remark leads to interesting consequences:

  • there is no message/warning whatsoever if the link is wrong (i.e point to the non-existing data). This is understandable if setting a link a posteriori is a feature;
  • more philosophical : should it be still isSet() if it is wrong ? but the link itself (no the pointed data) is set after all;
  • the only way to know the link was wrong is to test if getParent() is null... which would mean ideally that it should be tested every time...

Copy link
Contributor

Choose a reason for hiding this comment

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

To me this is the result of a not very well defined/consistent behavior.
Actually I'm very unconvident on the general use of links that are searched "a posteriori" and wonder if we shouldn't remove and replace that by a different (and explicit mechanism).

@bakpaul bakpaul added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Nov 13, 2024
@fredroy
Copy link
Contributor Author

fredroy commented Nov 14, 2024

[ci-build][with-all-tests][force-full-build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed pr: test PR adding test(s) in SOFA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants