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

Sema: Mostly remove one-way constraints #79914

Merged
merged 5 commits into from
Mar 12, 2025

Conversation

slavapestov
Copy link
Contributor

I had to revert this last time (#79105) because it broke observable behavior in some cases involving capture list expressions. For now, there doesn't appear to be an easy way to simulate the current behavior of capture lists without one-way constraints.

However, since one-way constraints are no longer needed for performance, we can still rip out the special handling they received in the connected components algorithm. This still changes behavior in a diagnostics test, but the existing expression there appears to be already invalid. The test case from rdar://problem/143338891 still passes:

func rdar143338891() {
  func takesAny(_: Any?) {}

  class Test {
    func test() {
      _ = { [weak self] in takesAny(self) }
    }
  }
}

…therNearbyConstraints()

The two GatherKinds no longer share any implementation, so there's
no point keeping the logic together. Doing this also allows removing
the acceptConstraintFn from gatherAllConstraints(), which further
simplifies depthFirstSearch().
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

LGTM! I like this narrower change because it means no changes to inference behavior for the left-hand side type variable.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov slavapestov enabled auto-merge March 12, 2025 00:15
@slavapestov slavapestov merged commit 9e721a3 into swiftlang:main Mar 12, 2025
4 of 5 checks passed
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