Skip to content

Fix a comparison in an assertion #80347

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

Conversation

porglezomp
Copy link
Contributor

This was being caught by a newer clang in -Wparentheses by default:

warning: comparisons like 'X<=Y<=Z' don't have their mathematical meaning [-Wparentheses]

This was being caught by a newer clang in -Wparentheses by default:
warning: comparisons like 'X<=Y<=Z' don't have their mathematical meaning [-Wparentheses]
@porglezomp porglezomp requested review from hborla and ktoso as code owners March 27, 2025 17:10
@porglezomp
Copy link
Contributor Author

@swift-ci please smoke test

@porglezomp porglezomp enabled auto-merge March 27, 2025 17:11
Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

I think this is what was intended in this code, but I'm unsure about the context of this assert. Let's get some clarification here first.

@@ -857,7 +857,7 @@ void swift::assertRequiredSynthesizedPropertyOrder(ASTContext &Context,
}
if (idIdx + actorSystemIdx + unownedExecutorIdx >= 0 + 1 + 2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's unclear what this if condition means. The logic above doesn't differentiate between the id field being missing, and the id being the first field. In both cases, idIdx is 0.

Now if all three fields are missing for example, we skip the assert. So we're only asserting that they have the correct order when present?

@ktoso Can you please explain the intent behind this code?

Copy link
Contributor

@ktoso ktoso Mar 28, 2025

Choose a reason for hiding this comment

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

It’s a bug if this order ever not as expected, I wanted to fix the warning earlier #79146 but yeah it’s a real bug that will need some investigation.

every distributed actor gets those fields synthesized. They MUST be in the specific order (ID then system) because IRGen will use them in this order in remote call accessors AFAIR. I’ll have to dig up the exact place.

We can close this PR as I have the other one I’ll get back to after some other bug fixes

@porglezomp
Copy link
Contributor Author

The three test failures are from this assertion failing in distributed actor tests, so it definitely needs some further feedback.

@porglezomp porglezomp closed this Mar 28, 2025
auto-merge was automatically disabled March 28, 2025 23:44

Pull request was closed

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