Skip to content

Conversation

@xymus
Copy link
Contributor

@xymus xymus commented Jan 6, 2026

Always check references to @_implementationOnly imports even without library-evolution enabled but downgrade errors to warnings by default. Clients should enable them as errors by adopting -enable-experimental-feature CheckImplementationOnly.

Use the existing warning on the @_implementationsOnly imports from modules without library-evolution to invite existing users to adopt CheckImplementationOnly. Adopting that feature will also silence the warning on the import.

rdar://167805228


Note, I looked into using -Werror over CheckImplementationOnly but this use case doesn't apply very well since this is an existing diagnostic targeting many different exportability source to reference combinations that's already an error by default. If we really want to we could do so by accessing the -Werror flags directly, with the implied added complexity.

xymus added 3 commits January 6, 2026 15:11
…ault

Always enable checking for references to `@_implementationOnly` imports
even without library-evolution enabled but downgrade errors to warnings
by default. Clients should enable them as errors by adopting
`CheckImplementationOnly`.
…rors

Recent commits changed the behavior downgrading enum cases with errors
to private in `AccessLevelRequest`. It checks `hasInterfaceType` likely
to avoid circular references. This is very prone to side effects. It is
dependent on the timing of the check but the result was cached, making
this behavior unreliable. Let's remove the downgrade to private
behavior.
Invite users of `@_implementationsOnly` imports from modules without
library-evolution to adopt `CheckImplementationOnly`. Use the existing warning
on the import statement. Adopting that feature reports unsafe references to
implementation-only imported types as errors and silences the warning on
the import.
@xymus
Copy link
Contributor Author

xymus commented Jan 6, 2026

@swift-ci Please smoke test

@xymus xymus requested a review from ktoso as a code owner January 8, 2026 23:42
@xymus
Copy link
Contributor Author

xymus commented Jan 8, 2026

@swift-ci Please smoke test

@xymus xymus force-pushed the exportability-nle-warn branch from f4682d3 to 97e06cb Compare January 9, 2026 00:56
@xymus
Copy link
Contributor Author

xymus commented Jan 9, 2026

@swift-ci Please smoke test

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented Jan 9, 2026

@swift-ci Please smoke test

@xymus xymus force-pushed the exportability-nle-warn branch from 97e06cb to 810611d Compare January 13, 2026 00:31
@xymus
Copy link
Contributor Author

xymus commented Jan 13, 2026

@swift-ci Please smoke test

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented Jan 15, 2026

@swift-ci Please smoke test

@xymus xymus force-pushed the exportability-nle-warn branch from 211c38b to b56c143 Compare January 16, 2026 00:54
@xymus
Copy link
Contributor Author

xymus commented Jan 16, 2026

@swift-ci Please smoke test

xymus added 2 commits January 20, 2026 13:55
Introduce `limitBehaviorIfMorePermissive` as an alternative to
`limitBehavior` that merges the new limit with the previous one. This
allows for composing different conditions that would downgrade a
diagnostics in succession.
Centralize the logic downgrading diagnostics to warning for newly
introduced exportability checks along with the one silencing the errors.
Update client sites to the new API and to uniformly apply the downgrade
to warning behavior.

Diagnostics about typealiases and conformances are now properly
downgraded to warnings if not opt-in.
@xymus xymus force-pushed the exportability-nle-warn branch from b56c143 to b0d6c7f Compare January 20, 2026 22:01
@xymus
Copy link
Contributor Author

xymus commented Jan 20, 2026

@swift-ci Please smoke test

xymus added 2 commits January 21, 2026 11:30
This one is specific. Allow extensions to define public members to
package types implicitly exporting their memory layout when imported
non-publicly.

Enabling exportability checks for non-library-evolution by default as a
warning triggered marking such types as implicitly exported to clients.
This in turn enabled erroring on the extensions in clients when imported
non-publicly. This error would be source breaking and shouldn't be
required in such a context. We may even consider lifting this
restriction entierly, even for public types imported non-public.
Extending type-checking to non-public decls triggered new errors when
`-target-min-inlining-version min` is enabled. Ensure these checks are only
applied to explicitly exported decls.

Affected test: test/Concurrency/deinit_isolation_availability.swift
@xymus xymus force-pushed the exportability-nle-warn branch from b0d6c7f to 9d4ed92 Compare January 21, 2026 19:36
@xymus
Copy link
Contributor Author

xymus commented Jan 21, 2026

@swift-ci Please smoke test

@xymus xymus merged commit c8f99af into swiftlang:main Jan 22, 2026
3 checks passed
@xymus xymus deleted the exportability-nle-warn branch January 22, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant