Skip to content

Commit c35330e

Browse files
authored
Merge pull request swiftlang#38296 from varungandhi-apple/vg-doc-availability-limitations
2 parents 56a82ab + aa59101 commit c35330e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/LibraryEvolution.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ the following changes are permitted:
349349

350350
- Reordering any existing members, including stored properties (unless the
351351
struct is marked ``@frozen``; see below).
352-
- Adding any new members, including stored properties.
352+
- Adding any new members, including stored properties (see below for an
353+
exception).
353354
- Changing existing properties from stored to computed or vice versa (unless the
354355
struct is marked ``@frozen``; see below).
355356
- As a special case of the above, adding or removing ``lazy`` from a stored
@@ -370,6 +371,9 @@ change even with Swift's synthesis of memberwise and no-argument initializers;
370371
these initializers are always ``internal`` and thus not exposed to clients
371372
outside the module.
372373

374+
Adding a new stored property with availability newer than the deployment
375+
target for the library is an error.
376+
373377
It is not safe to add or remove ``mutating`` or ``nonmutating`` from a member
374378
or accessor within a struct.
375379

@@ -507,9 +511,10 @@ without breaking binary compatibility. As with structs, this results in a fair
507511
amount of indirection when dealing with enum values, in order to potentially
508512
accommodate new values. More specifically, the following changes are permitted:
509513

510-
- Adding a new case (unless the enum is marked ``@frozen``; see below).
514+
- Adding a new case (see below for exceptions around ``@frozen`` and
515+
availability).
511516
- Reordering existing cases is a `binary-compatible source-breaking change`
512-
(unless the struct is marked ``@frozen``; see below). In particular, both
517+
(unless the enum is marked ``@frozen``; see below). In particular, both
513518
CaseIterable and RawRepresentable default implementations may affect client
514519
behavior.
515520
- Adding a raw type to an enum that does not have one.
@@ -526,6 +531,10 @@ accommodate new values. More specifically, the following changes are permitted:
526531
representation for the value, just as it may discard fields of structs that
527532
are provably never accessed.
528533

534+
Adding a new case with one or more associated values and with availability
535+
newer than the deployment target for the library is an error.
536+
This limitation is similar to the limitation for stored properties on structs.
537+
529538
Adding or removing the ``@objc`` attribute from an enum is not permitted; this
530539
affects the enum's memory representation and is not backwards-compatible.
531540

0 commit comments

Comments
 (0)