Navigation Menu

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-1857] Using PHFetchResult.enumerateObjects() with trailing closure syntax causes compiler error #44466

Closed
swift-ci opened this issue Jun 21, 2016 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1857
Radar None
Original Reporter mluisbrown (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

macOS 10.11.5, Xcode 8 beta (8S128d), Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, ClangImporter
Assignee None
Priority Medium

md5: 6fdfa333950314f08433920ed9f2a390

duplicates:

  • SR-1408 NSArray indexesOfObjectsPassingTest cannot be called in Swift 3

Issue Description:

In Swift 3.0 the following code:

import Photos

let allAssets = PHAsset.fetchAssets(with: nil)

allAssets.enumerateObjects { (asset, index, stop) in
    print("creationDate: \(asset.creationDate)")
}

Results in the compiler error "Ambiguous use of 'enumerateObjects'". This worked fine in Swift 2.2.

The only way to get the code to compile is to not use the trailing closure syntax:

import Photos

let allAssets = PHAsset.fetchAssets(with: nil)

allAssets.enumerateObjects ({ (asset, index, stop) in
    print("creationDate: \(asset.creationDate)")
})
@belkadan
Copy link
Contributor

Same basic issue as SR-1408.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants