The equality comparison operator ==
is producing incorrect results for KeyPaths on Swift 6.0 Development Snapshots.
#73554
Labels
AnyKeyPath
Area → standard library: The `AnyKeyPath` type
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Equatable
Area → standard library: The `Equatable` protocol
key paths
Feature: key paths (both native and Objective-C)
standard library
Area: Standard library umbrella
swift 6.0
unexpected behavior
Bug: Unexpected behavior or incorrect output
Description
There are cases when the equality comparison operator
==
is returningtrue
when it ought to returnfalse
. Here, both sides involve KeyPaths, but the KeyPaths themselves are different.Reproduction
Run the below code (built either in Debug or Release mode) with a recent Swift 6.0 Development Snapshot (2024-04-30 tested).
Expected behavior
The above code should print
false
.Environment
Swift Development Snapshot 6.0 (2024-04-29a and 2024-04-30a) are affected.
If using Xcode, one can create a new
xcodeproj
, paste in the above code, switch to a 6.0-branch toolchain, and run.This problem also occurs in Ubuntu 20 with an x86 machine.
Note that when running the executable on a MacOS terminal window, the executable itself ought to be using the
libswiftCore.dylib
corresponding to a 6.0-based toolchain, rather than the default system one.Additional information
None of the nightly toolchains (i.e, 2024-05-01a) nor anything on the 5.10 branch appears to be affected.
The text was updated successfully, but these errors were encountered: