Commit Graph

21 Commits

Author SHA1 Message Date
Manu
02b5fa2c8e Fix some typos in the codebase 2023-08-31 18:50:10 -03:00
Alex Hoppen
8231b272ba [ASTGen/Macros] Update for the fact that syntax collections are always non-optional in SwiftSyntax now 2023-08-11 07:46:59 -07:00
Alex Hoppen
62db3d5ad2 [Macros] Fix SwiftSyntax deprecation warnings 2023-08-03 10:44:09 -07:00
Alex Hoppen
b92530f50b Merge pull request #67500 from ahoppen/ahoppen/accessor-refactoring
Adjustments for refactoring of representation of Accessors in SwiftSyntax
2023-08-01 06:34:24 -07:00
Alex Hoppen
4bc5fe0c6a Adjustments for refactoring of representation of Accessors in SwiftSyntax 2023-07-26 14:24:02 -07:00
Philippe Hausler
0fca5199e7 [Observation] Forward availability and defines to extensions (#67412)
* [Observation] Forward availability and defines to extensions

* Simplify availability slightly from review feedback

* Simplify availability for extensions to use `.with`
2023-07-26 08:46:57 -07:00
Nate Cook
c5fbb4210e [Obs] Switch to peer instead of arbitrary macros
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.
2023-07-13 14:30:33 -05:00
Philippe Hausler
c3af373628 [Observation] Avoid using T since it is a common generic name, instead use a very specific generic return value name (#67207) 2023-07-12 15:34:42 -07:00
Pavel Yaskevich
4760b95282 Merge pull request #67183 from xedin/convert-effects-into-storageRestrictions
[AST/Sema] Implement @storageRestrictions attribute
2023-07-11 11:57:14 -07:00
Nate Cook
003b335351 [Observation] Switch Observable to be a non-marker protocol (#66993)
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.
2023-07-09 13:09:14 -05:00
Pavel Yaskevich
fe17491982 [AST] InitAccessors: Switch from init accessor effects (initializes/accesses) to @storageRestrictions 2023-07-07 10:00:36 -07:00
Nate Cook
40a7396b03 Make the @Observable macro class only (#67033)
* 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.
2023-07-06 15:01:01 -05:00
Doug Gregor
6265f0c542 [SE-0395] Rename _Observation module to Observation
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.
2023-06-30 11:01:02 -07:00
Philippe Hausler
04ecc35d35 [Observation] Ensure type access is qualified to the module name (#66364) 2023-06-09 19:21:08 -07:00
Philippe Hausler
4d1d8a9de5 [Observation] Add property definite initialization support (#65984)
* [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
2023-06-09 15:15:39 -07:00
Philippe Hausler
ddbab22d88 [Observation] Member properties that have visibility attributes should rename using trailing trivia (#65812) 2023-05-18 11:36:47 -07:00
Philippe Hausler
d37b6bc074 [Observation] Reduce observation scope to only apply to tracking cases and re-work the macro to utilize more robust emissions (#65528) 2023-05-09 09:28:25 -07:00
Alex Hoppen
42cb41ded9 Adjustment for SwiftSyntax rename members -> memberBlock
Companion of https://github.com/apple/swift-syntax/pull/1524
2023-04-13 16:28:54 -07:00
Philippe Hausler
7fd2f52af8 [Observation] Refactor for state machine (and behavior robustness) and adjust protocol requirement names (#64414)
* [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.
2023-03-16 22:11:23 -07:00
Nate Cook
71a6c07b90 Update type name in Observable macro (#64067)
Switch macro-generated code to `TrackedProperties`.
2023-03-05 14:12:26 -08:00
Philippe Hausler
40c277b245 Observation and associated macros 2023-03-02 15:30:59 -08:00