Sema: Fix isExported()
for extension decls
#42585
Merged
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.
Fix
isExported()
for extension decls in order to correct availability diagnostics when-target-min-inlining-version min
is specified.Previously, an extension decl was always considered exported (externally visible to module clients) as long as it extended an exported type. Extensions need to either contain some externally visible member (e.g. a public method) or implement a conformance to a public protcol, though, to actually be exported. Without this fix, the compiler incorrectly requires internal extensions to types that are always available at runtime to have declared availability which would be a nuisance for library authors.
As part of testing this change, I expanded the attr_inlinable_available.swift test case significantly and that prompted me to scrap the copy of the test specific to macCatalyst as it seemed like needing to keep the two tests in sync was going to be a liability going forward. I replaced the deleted test with a couple of more targeted tests that use
-dump-type-refinement-contexts
to verify the effect of-target-min-inlining-version min
on the root refinement context. Again a macCatalyst version of the test is required because we don't have bots that are configured to make the macCatalyst runtime the "target" OS.Resolves rdar://91382040