You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add missing Foundation imports to fix test build errors on iOS with MemberImportVisibility enabled (#1108)
This fixes several instances of a build error when attempting to build
this package for iOS, or any non-macOS Apple platform. Here's one
example
```
error: instance method 'contains' is not available due to missing import of defining module 'Foundation'
Tests/TestingTests/SwiftPMTests.swift:370:5: note: in expansion of macro 'expect' here
#expect(testIDs.allSatisfy { $0.contains(".swift:") })
```
This general kind of build error is being emitted because we adopted
[SE-0444: Member import
visibility](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md)
by enabling the `MemberImportVisibility` experimental feature in #1020.
In that PR, I fixed several instances of missing imports, including some
for `Foundation` in test files. But these errors are from usages of
`String.contains()`, and it turns out there are multiple overloads of
that function, with an older one in `Foundation` and a newer one
directly in the stdlib `Swift` module. The latter has newer, iOS
13.0-aligned API availability, and when building our tests for macOS
this issue was not noticed previously because SwiftPM artificially
raises the deployment target of macOS test targets to match the testing
frameworks included in Xcode (when the testing libraries are being used
from the installed copy of Xcode).
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments