Skip to content

Conversation

@slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jul 24, 2025

There were two unrelated issues:

  • A diagnostics crash if an AnyObject requirement failed in a very specific case
  • Embedded Swift had a generic implementation of ===, because of limitations that have been fixed since. However we only open existentials when passed to a method with this signature in -swift-version 6 mode.

As a result, attempting === on two class-bound existentials would just crash.

Fixes rdar://156095800.

It's difficult to trigger this because the code path is only
reached for the standard operators. The issue in question was
in embedded Swift due to an unsupported usage of the ===
operator, but we expect an upcoming standard library change to
actually make us accept that code.

However, the fix should be pretty safe, even without a test case.

Fixes the crash in rdar://156095800.
@slavapestov slavapestov requested review from a team, hborla and xedin as code owners July 24, 2025 19:11
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

CC @kubamracek @lorentey

@slavapestov slavapestov force-pushed the fix-rdar156095800 branch 2 times, most recently from 85d6fab to ae4723f Compare July 24, 2025 19:24
It seems that the restriction preventing these from working was
lifted.

The behavioral difference is that in Swift 5 mode, we don't
actually open AnyObject like this, so the old operator could
not be used with class-bound existentials.

I added a trivial test case just to ensure that calls to ===
type check correctly in both language modes.

Fixes rdar://156095800.
@slavapestov slavapestov changed the title Embedded Swift: Fix === and !=== with existential Embedded Swift: Fix === and !== with existential Jul 24, 2025
@slavapestov
Copy link
Contributor Author

The stdlib was completely wrong in the first version, it's fixed now.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit ca50986 into swiftlang:main Jul 25, 2025
3 checks passed
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, thank you!

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