[SR-13040] Set collection not working as expected #55486
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
conformances
Feature → protocol: protocol conformances
duplicate
Resolution: Duplicates another issue
nested types
Feature: nested types
operators
Feature: operators
swift 5.2
type checker
Area → compiler: Semantic analysis
unexpected behavior
Bug: Unexpected behavior or incorrect output
Environment
Xcode 11.5
Swift version 5.2.4.
Additional Detail from JIRA
md5: a50eab392328f1bdf548490201b698a8
relates to:
Issue Description:
If I run the following code (contained in
testExample
) in a Swift playground it works as expected. That is, the "equatable" object is added only once and==
operator is called. However, the code in a unit test (or somewhere in app code) adds the object twice.Playground output:
Unit test output:
If I move the struct
Object
to class or global scope, as one user on stack overflow suggested, thenSet
operations work as expected.https://stackoverflow.com/questions/62438945/why-does-set-operate-differently-in-a-swift-playground
The text was updated successfully, but these errors were encountered: