Skip to content

[6.0][region-isolation] Do not ignore non-trivial results that are Sendable to be more permissive in the face of lazy typechecker issues. #75542

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

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Jul 29, 2024

Explanation: We have found certain cases due to the requestified typechecker, a type is initially Sendable and then is later non-Sendable. This can be seen by the attached test case where the first time one calls isNonSendableType on the test value, one would get that it is Sendable and then the second time one would get it was non-Sendable. The result of this is that the pass gets into an inconsistent state.

This patch is a small patch that makes the pass more permissive in the face of such an error by making it so that we do not ignore Sendable results of instructions (that is we make sure to track a value for them), so we do not break invariants.

As an example of this type of behavior, in the test case in this patch, we first find the Sendable conformance of MySubClass and then the typechecker after doing some more type checking while performing that query, the second time finds the inherited non-Sendable conformance of MyParentClass causing MySubClass to be considered to be non-Sendable.

Radars:

  • rdar://132347404

Original PRs:

Risk: Low. All I am doing is making it so that we actually "create" a valid value that can be looked up in the case where we initially were Sendable but now have become non-Sendable. We will still get weird semantics, but we will not get a crash.
Reviewer:

@gottesmm gottesmm requested a review from a team as a code owner July 29, 2024 15:57
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

Original: #75541

…e to be more permissive in the face of lazy typechecker issues.

We have found certain cases due to the requestified typechecker, a type is
initially Sendable and then is later non-Sendable. This can be seen by the
attached test case where the first time one calls isNonSendableType on the test
value, one would get that it is Sendable and then the second time one would get
it was non-Sendable. The result of this is that the pass gets into an
inconsistent state.

This patch is a small patch that makes the pass more permissive in the face of
such an error by making it so that we do not ignore Sendable results of
instructions (that is we make sure to track a value for them), so we do not
break invariants.

The longer term better fix is to make it so that we have a cache in the pass for
this query that way we just always use the first answer returned from the
typechecker and cache that. If the typechecker has such a bug, we may get bogus
results, but we at least do not break invariants.

As an example of this type of behavior, in the test case in this patch, we first
find the Sendable conformance of MySubClass and then the typechecker after doing
some more type checking while performing that query, the second time finds the
inherited non-Sendable conformance of MyParentClass causing MySubClass to be
considered to be non-Sendable.

rdar://132347404
(cherry picked from commit 8604480)
@gottesmm gottesmm force-pushed the release/6.0-rdar132347404 branch from 2e0d795 to 4d2f337 Compare July 29, 2024 16:49
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm gottesmm enabled auto-merge July 29, 2024 20:22
@gottesmm gottesmm merged commit 0382996 into swiftlang:release/6.0 Jul 31, 2024
5 checks passed
@gottesmm gottesmm deleted the release/6.0-rdar132347404 branch July 31, 2024 21:04
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.

2 participants