Commit Graph

13 Commits

Author SHA1 Message Date
Philippe Hausler
c6a2437a10 [Observation] Exclude generic class types from pre-caching their keypaths (#78790)
* [Observation] Exclude generic class types from pre-caching their keypaths

* Account for multiple nesting levels of generics for observation cached keypaths
2025-01-21 23:49:37 -08:00
Rintaro Ishizaki
1fb78394ce [Macros] Remove unused dependency to SwiftOperators
ObservationMacros and SwiftMacros don't use anything in SwiftOperators
2024-06-17 15:39:03 -07:00
Allan Shortlidge
28b274c6b3 Observation: Stop using deprecated SwiftSyntax APIs.
Addresses a few warnings about use of `as()`:

```
warning: 'as' is deprecated: This cast will always succeed
```
2024-03-13 10:16:49 -07: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
d239cac1a7 Merge pull request #67716 from ahoppen/ahoppen/swift-syntax-deprecations
[Macros/ASTGen] Fix deprecation warnings from SwiftSyntax
2023-08-04 20:47:21 -07:00
Alex Hoppen
62db3d5ad2 [Macros] Fix SwiftSyntax deprecation warnings 2023-08-03 10:44:09 -07:00
Alex Hoppen
10e7312b9f Remove a leftover print statement 2023-08-03 08:18:32 -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
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
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
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