mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Improve checking of macro-generated accessors against documented names
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.
This commit is contained in:
@@ -7228,10 +7228,13 @@ ERROR(invalid_macro_role_for_macro_syntax,none,
|
||||
(unsigned))
|
||||
ERROR(macro_cannot_introduce_names,none,
|
||||
"'%0' macros are not allowed to introduce names", (StringRef))
|
||||
ERROR(macro_accessor_missing_from_expansion,none,
|
||||
"expansion of macro %0 did not produce a %select{non-|}1observing "
|
||||
"accessor",
|
||||
(DeclName, bool))
|
||||
ERROR(macro_nonobserving_accessor_missing_from_expansion,none,
|
||||
"expansion of macro %0 did not produce a non-observing accessor "
|
||||
"(such as 'get') as expected",
|
||||
(DeclName))
|
||||
ERROR(macro_nonobserver_unexpected_in_expansion,none,
|
||||
"expansion of macro %0 produced an unexpected %1",
|
||||
(DeclName, DescriptiveDeclKind))
|
||||
ERROR(macro_init_accessor_not_documented,none,
|
||||
"expansion of macro %0 produced an unexpected 'init' accessor",
|
||||
(DeclName))
|
||||
|
||||
Reference in New Issue
Block a user