Commit d7d3608
committed
Break cyclic dependency due to implicit initialization of optional values
The fundamental problem here is that we don't know a priori whether an
accessor macro will convert a stored property into a computed one.
That can only be determined after macro expansion, which depends on
having a determined type for the property.
Implicit initialization of optional-typed values (e.g., "var
birthDate: Date?") adds the initializer when there is storage,
triggering the cycle. Introduce a very narrow fix that assumes that
properties that have an accessor macro on them do not have storage.
We probably want to enforce this, so that the "does this variable have
storage?" query can be made cheaper.1 parent 5427191 commit d7d3608
File tree
2 files changed
+23
-2
lines changed- lib/Sema
- test/Macros
2 files changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
283 | 304 | | |
284 | 305 | | |
285 | 306 | | |
| |||
380 | 401 | | |
381 | 402 | | |
382 | 403 | | |
383 | | - | |
| 404 | + | |
384 | 405 | | |
385 | 406 | | |
386 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
0 commit comments