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

[SR-5084] Unions of IndexSets in Swift Foundation does not produce the same results as IndexSet in the Swift overlay for Darwin Foundation. #4094

Closed
swift-ci opened this issue Jun 3, 2017 · 1 comment

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Jun 3, 2017

Previous ID SR-5084
Radar None
Original Reporter andersha (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

swift-3.1-RELEASE-ubuntu14.04

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, Linux
Assignee mattrajca (JIRA)
Priority Medium

md5: 2ec55b48fef40f31656db999a12a303b

Issue Description:

It appears that `formUnion` and `union` in Swift Foundation do not produce the same results as the Swift overlay for Darwin Foundation.

As seen in the test results, `IndexSet` produces duplicated indexes.
https://travis-ci.org/RACCommunity/ReactiveCollections/jobs/239062429#L905

// Expected & Tested on Darwin
// # of indices, followed by the indices
updates: 3>> [0, 1, 2]

// Actual
// # of indices, followed by the indices
updates: 7>> [0, 1, 2, 2, 2, 2, 2]

For this specific test case, the update index set is only applied with `formUnion` (the concerned code path if it helps).

I have also tested it with the IBM Swift Sandbox which runs Swift 3.1.1.

@spevans
Copy link
Collaborator

spevans commented Jan 18, 2019

This was fixed in 4.0

$ cat sr-5084.swift
import Foundation

var indexes = IndexSet()
indexes.formUnion(IndexSet([2]))
indexes.formUnion(IndexSet([2]))
indexes.formUnion(IndexSet([2]))
indexes.formUnion(IndexSet([2]))
indexes.formUnion(IndexSet([2]))
indexes.formUnion(IndexSet([2]))

print(Array(indexes))
$ ~/swift-4.0-RELEASE-ubuntu16.04/usr/bin/swift sr-5084.swift 
[2]

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants