* [Observation] Exclude generic class types from pre-caching their keypaths
* Account for multiple nesting levels of generics for observation cached keypaths
* `@Observable` Macro supports properties with the `package` access modifier #71060
* Cherry-pick "Move the tests for package scopes to the module interface tests" 4e274ce0a5
---------
Co-authored-by: Philippe Hausler <phausler@apple.com>
* [Observation] Forward availability and defines to extensions
* Simplify availability slightly from review feedback
* Simplify availability for extensions to use `.with`
This adopts `@attached(peer)` for generating an observable type's
underscored storage when expanding the `@ObservationTracked` macro,
instead of using `arbitrary` with the member macro on the
observable type.
With support for redundant conformance declarations via macros,
the `Observable` protocol can be a non-marker protocol, which
provides more flexibility for evolution in the future.
rdar://111463883
This change also switches to the new ExtensionMacro protocol,
the requirement for which includes information about whether the
conformance to the Observable protocol has already been added, either
in the declaration or in a superclass to the macro-attributed type.
This allows the @Observable macro to be applied to subclasses of
observable types without redundant-conformance errors.
* Make ObservationRegistrar Codable/Hashable
These conformances enable automatic Codable synthesis for Observable
types, and smooth the runway for structs being supported by the
Observable macro in the future.
* Limit Observable macro to classes
This removes the ability for the Observable macro to apply to structs,
and adds diagnostic tests for the three disallowed declaration kinds.
The review of SE-0395 is down to small details at this point that won't
affect the overall shape of the API much. Rename the model in
anticipation of that.
* [Observation] Transition to peer macros instead of arbitrary members
* [Observation] Lift the initializer requirement by utilizing init accessors for fully formed definite initialization
* [Observation] Gate enabling of peer macros by flag
* [Observation] Enable feature for InitAccessors in the observation tests
* [Observation] Add tests to validate memberwise and definite initialization
* [Observation] Change visibility of observation runtime functions to be hidden
* [Observation] Update API requirements for Observable AsyncSequence names and alter the behavior of value emissions to be based upon transactionality
* [Observation] Slight naming alteration of isolation -> isolatedTo
Note: This re-enables the previously disabled tests since the implementation should be considerably more robust to hangs.