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-13446] Optional<IndexPath>.none != nil #55888
Comments
Testing the claims from the bug report in the REPL in Xcode 11.5
While the above doesn't seem to correspond to the behavior reported, perhaps what you are seeing is the LLDB bug SR-11593, where the debugger incorrectly displays nil for some Optionals? (see screenshot in SR-11546 for example) |
Comment by Jason Sadler (JIRA) Thanks for looking into this! I think a few things must be at play here.
let selectedProjectIsInList = listViewController.selectedObject.map { dataSource.indexPath(for: $0) } != Optional<IndexPath>.none
if !selectedProjectIsInList {
listViewController.selectObject(nil)
router.emptyRightPane()
} where func indexPath(for object: T) -> IndexPath? {
return fetchedResultsController.indexPath(forObject: object)
} |
The func map<U>(_ transform: (Wrapped) throws -> U) rethrows -> U? It means that in your case it will return You have 3 potential returns for your expression
To fix your problem you probably want to replace |
Comment by Jason Sadler (JIRA) �♂️ yes. I can’t believe I missed that. Thanks so much! |
Environment
Xcode Version 11.5 (11E608c)
(Using Swift 5 for SWIFT_VERSION)
Additional Detail from JIRA
md5: 9dd067e7ef11417416e33ca27ac79e79
duplicates:
Issue Description:
The expression
Optional<IndexPath>.none == nil
evaluates tofalse
.It seems that an
IndexPath?
variable set tonil
is interpreted as anIndexPath
with a single index that evaluates to0
. (That's what prints withpo
in the Xcode debugger)(Apologies if this is the wrong place to file this bug...I wasn't sure whether it was a Swift issue or an Apple issue. I've also filed a Feedback with Apple: FB8534137)
The text was updated successfully, but these errors were encountered: