Xcode Cannot Find Code in Swift Package in Certain Files

I have a Swift Package called QuickCombine that I have been working on of late. I recently encountered a bizarre bug while working on my package though. I took a screen recording of me demonstrating the issue. The project in the state that cause this issue can be downloaded here (it's only 60 KB).

Steps to reproduce:

  1. Run testReplaceNilWithError in Tests/QuickCombineTests/QuickCombineTests.swift. This test fails.
  2. Cut the contents of Sources/QuickCombine/Operators/Publisher+replaceNil.swift
  3. Paste the contents at the bottom of Sources/QuickCombine/Publishers/ReplaceNil.swift
  4. Run testReplaceNilWithError in Tests/QuickCombineTests/QuickCombineTests.swift again and the test passes?!

For some reason, copy and pasting the code to a different location in the project makes it work. I observed this to be present in Xcode Version 11.3.1 (11C504). When I the test the first time in Xcode Version 11.4 beta 3 (11N132i), it passed. Also, I tried copying and pasting the contents of ReplaceNil.swift, Publisher+replaceNil.swift, and the failing part of the testReplaceNilWithError() method into a playground on Xcode Version 11.3.1 (11C504), and it also worked.

It seems to me that for some reason, Xcode cannot find the correct method that is used in the test which is at the bottom of Publisher+replaceNil.swift

Does anyone have any idea why the package is not working?

Not sure if you have filed a bug yet, but that's probably the best way to report it.

Terms of Service

Privacy Policy

Cookie Policy