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

NSOrderedSet: Implement more functionality #2089

Merged
merged 1 commit into from Apr 17, 2019

Conversation

spevans
Copy link
Collaborator

@spevans spevans commented Apr 11, 2019

  • Add copy() and mutableCopy().

  • Add .set and .array to return immumtable views of the current
    contents.

  • Implement index(of:inSortedRange:options:usingComparator cmp:)
    by calling NSArray()'s version on ._orderedStorage.

  • Implement description(withLocale:), description(withLocale:indent:),
    .description and .customMirror.

  • NSCoding still needs to be implemented.

@spevans
Copy link
Collaborator Author

spevans commented Apr 11, 2019

@swift-ci test

@spevans
Copy link
Collaborator Author

spevans commented Apr 11, 2019

Note: Need to add some tests.

@millenomi
Copy link
Contributor

Can you use storage._swiftObject instead?

@spevans
Copy link
Collaborator Author

spevans commented Apr 11, 2019

I looked at how NSArray and NSSet implemented copy and mutableCopy and didn't see the use of _swiftObject there. Is it needed even though the types of the Set and Array are Swift not CF Types?

@spevans
Copy link
Collaborator Author

spevans commented Apr 11, 2019

@swift-ci test linux

- Add copy() and mutableCopy().

- Add .set and .array to return immumtable views of the current
  contents.

- Implement index(of:inSortedRange:options:usingComparator cmp:)
  by calling NSArray()'s version on ._orderedStorage.

- Implement description(withLocale:), description(withLocale:indent:),
  .description and .customMirror.

- NSCoding still needs to be implemented.
@spevans
Copy link
Collaborator Author

spevans commented Apr 12, 2019

@swift-ci test linux

1 similar comment
@spevans
Copy link
Collaborator Author

spevans commented Apr 12, 2019

@swift-ci test linux

@millenomi
Copy link
Contributor

@swift-ci please test

@millenomi
Copy link
Contributor

millenomi commented Apr 12, 2019

The idea here is that we're hitting a compiler bug around casting, which is often problematic while developing s-c-f because s-c-f is part of the implementation of casting itself (and also has to coexist with the bridging setup on Darwin.) The guideline going forward is to avoid bridging casts and use _swiftObject, _cfObject and _nsObject where they exist, and __SwiftValue.store(…)/.fetch(…) otherwise if all you have is an Any or AnyObject (which will do the right thing wrt interacting with bridged values coming from the ObjC Foundation on Darwin). This only applies to s-c-f's codebase; outside, including in TestFoundation, it is okay to use bridging as usual.

@spevans
Copy link
Collaborator Author

spevans commented Apr 16, 2019

@swift-ci test

@spevans
Copy link
Collaborator Author

spevans commented Apr 16, 2019

@swift-ci test

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.

None yet

2 participants