Skip to content

Enable upcoming feature 'MemberImportVisibility' and fix issues it reveals #1020

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

Merged

Conversation

stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented Mar 12, 2025

This enables the MemberImportVisibility upcoming Swift feature described in SE-0444: Member import visibility, then fixes the new issues that enabling it reveals.

Resolves rdar://146876960.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@stmontgomery stmontgomery added enhancement New feature or request build 🧱 Affects the project's build configuration or process labels Mar 12, 2025
@stmontgomery stmontgomery added this to the Swift 6.2 milestone Mar 12, 2025
@stmontgomery stmontgomery self-assigned this Mar 12, 2025
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@stmontgomery stmontgomery merged commit 77fa261 into swiftlang:main Mar 12, 2025
3 checks passed
@stmontgomery stmontgomery deleted the enable-MemberImportVisibility branch March 12, 2025 16:46
stmontgomery added a commit that referenced this pull request Mar 13, 2025
Follow-on to #1020 to enable this upcoming feature in the CMake rules,
too.

Resolves rdar://146876960.

- [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.
stmontgomery added a commit that referenced this pull request May 7, 2025
…emberImportVisibility 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build 🧱 Affects the project's build configuration or process enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants