Skip to content

Commit 43a8482

Browse files
committed
doc: add documentation for @_spi_available
1 parent e0fd889 commit 43a8482

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/ReferenceGuides/UnderscoredAttributes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,3 +830,10 @@ the compiler.
830830

831831
This `async` function uses the pre-SE-0338 semantics of unsafely inheriting the caller's executor. This is an underscored feature because the right way of inheriting an executor is to pass in the required executor and switch to it. Unfortunately, there are functions in the standard library which need to inherit their caller's executor but cannot change their ABI because they were not defined as `@_alwaysEmitIntoClient` in the initial release.
832832

833+
## `@_spi_available(platform, version)`
834+
835+
Like `@available`, this attribute indicates a decl is available only as an SPI.
836+
This implies several behavioral changes comparing to regular `@available`:
837+
1. Type checker diagnoses when a client accidently exposes such a symbol in library APIs.
838+
2. When emitting public interfaces, `@_spi_available` is printed as `@available(platform, unavailable)`.
839+
3. ClangImporter imports ObjC macros `SPI_AVAILABLE` and `__SPI_AVAILABLE` to this attribute.

0 commit comments

Comments
 (0)