Add missing Foundation imports to fix test build errors on iOS with MemberImportVisibility enabled #1108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
This general kind of build error is being emitted because we adopted SE-0444: Member import visibility 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 ofString.contains()
, and it turns out there are multiple overloads of that function, with an older one inFoundation
and a newer one directly in the stdlibSwift
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: