Commit Graph

9 Commits

Author SHA1 Message Date
Richard Howell
5bcf1bf61f Add access level import diagnostic for named pattern.
This PR adds a missing access level diagnostic when type checking
named patterns by walking the interface type to find the importing
decl to emit the diagnostic for.
2024-12-09 12:30:03 -08: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
a0b848ea96 [Sema] Report imports marked as public that are not used in API 2023-09-28 13:00:04 -07:00
Alexis Laferrière
6d9779f8bb [Sema] Remove duplicated information when we can only use AccessScope
Stop relying on a separate access-level from the access-scope to show
and prioritize diagnostics. This change should be NFC but it does break some
tests. This only affects the prioritization of which of many offending type
is the worst and should be pointed to, the logic remains sound.
2023-09-13 15:40:33 -07:00
Alexis Laferrière
1a1df7e9ec [Sema] Apply import restriction in TypeAccessScopeChecker's AccessScope
This cleans up the logic and allows using `private` imported
declarations in `fileprivate` declarations.
2023-09-13 15:40:33 -07:00
Becca Royal-Gordon
3732c75e97 Adopt %kind for certain access control diagnostics
These particular changes slightly alter some diagnostics.
2023-07-19 13:06:51 -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
75255d153c [Sema] Diagnose exportability of decls limited by a non-public import
Check the API of decls to ensure that imported types are only used in
decls with compatible access-level. For example, error on using a type
import as internal in a public function, but allow it in internal
functions and lower.

This change raises errors on wrongful use of types limited by an import
and offers a note pointing to the import that did limit the imported
type.
2023-03-01 18:35:41 -08:00