-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved #82732
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
Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved #82732
Conversation
|
@swift-ci Please smoke test macOS platform |
|
@swift-ci Please smoke test Linux platform |
|
@swift-ci Please smoke test Windows platform |
rjmccall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to move the entire feature behind a flag, just the change to the capture semantics. In that light, please call the feature something like WeakLetCaptures or ImmutableWeakCaptures.
038ae0e to
985c151
Compare
|
@swift-ci Please smoke test |
985c151 to
59df9a0
Compare
|
@swift-ci Please smoke test |
|
@swift-ci Please Test Source Compatibility Release |
rjmccall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality LGTM, with a question about the VarDeclUsageChecker that can totally be dealt with in a follow-up. Some minor comment requests.
Would you mind preparing a cherry-pick PR against the release/6.2 branch? We'll need to get LSG sign-off before we can merge that one, but hopefully that comes tomorrow.
FYI, I think we're going to aim for 6.2.x for this at this point. |
59df9a0 to
532724e
Compare
|
@swift-ci Please smoke test |
|
@rjmccall, could pls respond to the unresolved discussions above. Or shall I just merge the PR as is? |
rjmccall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey. So in the original PR, we talked about whether we needed the change that makes weak/unowned captures use a box. Apple has seen what seems to be a regression that's fixed by restoring that block and turning the condition into var->getInterfaceType()->is<ReferenceStorageType>() && !Context.LangOpts.hasFeature(Feature::ImmutableWeakCaptures). We haven't narrowed why this fixes the problem yet — the bug appears to be that code is seeing a nil'ed out weak reference when it shouldn't — but it's clearly not completely semantically equivalent, which is something we need to understand.
|
Interesting. Do you have a code sample that reproduces the issue (link to the GitHub issue would work)? Any other links to include in the code comment?
Does it mean that the issue does not reproduce with Does it matter if it is a native or ObjC weak reference? |
I believe the investigation was done by bisecting the compiler history and then looking at the implicated PRs; we haven't reduced a test case. Your PR isn't supposed to affect code generation for non-adopting projects, though, so it's definitely suspicious that it is.
This is in code that I'm fairly certain hasn't adopted the feature at all. The actual effect of the tentative patch is therefore just to restore the old behavior, so there's no particular reason to think that the new condition is right.
It is possible that the actual bug is further downstream, like maybe the capture handling in IRGen doesn't handle reference storage types properly.
I would be surprised if this were the difference. |
I was trying to align capture behavior of the
Yes. Shall we for now merge a version where all the changes are wrapped into an experimental feature? |
No, I don't think we need to go that far. Let's just restore this block unconditionally for now, and then we can look into what's causing the miscompile separately. |
…rategy of the feature
f0caade to
0496ca4
Compare
|
@swift-ci Please smoke test |
…fails" This reverts commit 1690bc4, reversing changes made to 37d33ab. The xfailed tests seem to have been fixed by "Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved" swiftlang/swift#82732.
…re semantics still wrapped into a feature See swiftlang#80440 and swiftlang#82732
Wrapped into the feature:
Not wrapped into the feature:
weak letdeclarationsweak vardeclarations which are never written to (except closure captures).Most of the tests run both with feature off and on, but a couple of less relevant for the change - only with feature on (i.e. preserving status quo).