The checking of the accessors generated by a macro against the
documented set of accessors for the macro is slightly too strict and
produces misleading error messages. Make the check slightly looser in
the case where an observer-producing macro (such as
`@ObservationIgnored`) is applied to a computed property. Here, we
would diagnose that the observer did not in fact produce any
observers, even though it couldn't have: computed properties don't get
observers. Remove the diagnostic in this case.
While here, add some tests and improve the wording of diagnostics a
bit.
Fixes rdar://113710199.
The `hasStorage()` computation is used in many places to determine the
signatures of other declarations. It currently needs to expand accessor
macros, which causes a number of cyclic references. Provide a
simplified request to determine `hasStorage` without expanding or
resolving macros, breaking a common pattern of cycles when using
macros.
Fixes rdar://109668383.
Parse compound and special names in the macro role attributes
(`@freestanding` and `@attached`). This allows both compound names and
initializers, e.g., `init(coding:)`.
Fixes rdar://107967344.
The macro tests were all using "REQUIRES: OS=macosx" as a proxy for
"have the Swift Swift parser". There was an existing feature for this,
but it was just checking whether the path was passed through. Fix that
to use the same variable as in CMake.
Also remove all extraneous `-I` and `-L` to the host libs in the target
invocations.
SE-0382 allows macro parameters to have default arguments. Enable these
default arguments, with the normal type checking rules. One
significant quirk to this implementation is that the actual default
argument values don't make it to the macro implementation. This is a
previously-unconsidered design problem we'll need to address.
Tracked by rdar://104043987.
Macros are an experimental feature, as such are not available on
non-asserts compilers.
Adding requires asserts to remaining experimental macro tests.
- ModuleInterface/macros.swift
- Serialization/macros.swift