Description
Previous ID | SR-1844 |
Radar | None |
Original Reporter | ahyattdev (JIRA User) |
Type | Bug |
Attachment: Download
Environment
Mac OS X 10.11.5 "El Capitan"
Xcode 8 Beta 1
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler, Foundation, Standard Library |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: c444ef42e2b79cdba91aa4796be30788
Issue Description:
Some functions of Swift standard library structs like String are implemented in Foundation on OS X, but they are visible in Xcode when Foundation is not imported, and the Swift compiler sees no issue with it.
The issue does not manifest itself until the linking phase, where it fails.
This compiles, but fails during the linking stage.
The confusion arises because many Foundation classes were "merged" with their counterparts in the Swift standard library, and some of their functions are still implemented in Foundation.
If moving the implementation of functions like components(seperatedBy:) over to the Swift standard library is a goal of Swift 3, then this problem can be ignored.
However, if this is how Swift 3 is intended to work, then the compiler needs to throw an error.
To reproduce:
The project uses a Makefile build system.
I tried providing a single-file test case, but stripping out the code that uses the libraries of the project causes the bug to disappear.
To get the error:
Open the xcodeproj and build the project, or run "make" from the command line.
The file that causes the error is "src/hostname/main.swift", line 69 where I call the components function.
If build schemes are missing in Xcode for some reason, just auto-generate them and run the "coreutils-swift"
All warnings and errors from Swift work normally with Xcode when using an external build system.
My invocation of swiftc from the Makefile could be a part of what leads to the issue, To see what it is invoked with, see the build log.