Commit Graph

9 Commits

Author SHA1 Message Date
Allan Shortlidge
7e6e8ed7b5 Sema: Fully check the availability of wrappedValue.
Call `checkDeclarationAvailability()`, instead of just diagnosing
unavailability.
2024-10-25 16:50:20 -07:00
Xi Ge
6f5b40543d Revert "Handle package exportability."
This reverts commit d182d01c28.
2024-06-11 11:54:00 -07:00
Ellie Shin
d182d01c28 Handle package exportability.
This PR treats package access level as exportable, preventing
internally imported types from accidentally being declared in
package decl signatures.

Added package-specific cases to ExportabilityReason and
DisallowedOriginKind to track the validity of imported types
at use sites with package access scope. Added tests to cover
variety of use cases.

Resolves rdar://117586046&125050064&124484388&124306642
2024-05-02 05:17:03 -07:00
Alexis Laferrière
56095cf745 Sema: duplicate the note about which import limits access-level
Access-level on imports limit where decls from the target module can
be referenced. This is reported by the typical error about and a note
on the import. However, when using an IDE and editing a large file,
the note on the import is easy to miss. Address this by duplicating
the information on the error line as well so it's never out of the
current viewport.

rdar://119438201
2024-04-22 12:07:31 -07:00
Alexis Laferrière
8b098ab487 [Tests] Remove the flag AccessLevelOnImport from all tests but one 2023-10-10 09:09:22 -07:00
Alexis Laferrière
242d01c393 [Sema] Add test for references to restricted imports from frozen structs
Exporting types imported as non-public in @frozen strucs is reported by
pre-existing mechanics using the access-levels system. This simply adds
a test to prevent regressions.
2023-09-12 11:12:17 -07:00
Alexis Laferrière
ea2465dea6 [Sema] Report uses of package import without a package name 2023-09-05 17:33:49 -07:00
Alexis Laferrière
a26fbd2849 [Sema] Improve note on access-level downgrade from import
Using an access-level on an import downgrades imported decl from public
to the import's access-level. When we can identify which decl is
problematic, name it in the note displayed on the import. This should
help understanding the effect of the import's access level on the decl
causing an error further down in the source file.
2023-03-09 09:08:42 -08:00
Alexis Laferrière
0322ca0654 [Sema] Report use of decls imported as non-public in inlinable code
Inlinable code can only refer to public types, so either local public
types or public types imported publicly. Report any decl imported as
non-public in inlinable code.

rdar://105902141
2023-03-02 10:12:25 -08:00