We currently have a bunch of type-checker diagnostics that uses the word "accessor" instead of user-facing words such as "getter", "setter" or "observer". The word "accessor" is actually not used anywhere in user-facing documentation or TSPL.
It would be great to replace uses of "accessor" with words that the user is more likely to be familiar with, as mentioned above.
The text was updated successfully, but these errors were encountered:
Substitute uses of the word "accessor" in diagnostic text with "getter", "setter", "willSet observer" or "didSet observer". This can be done by using DescriptiveDeclKind, which provides user-facing and diagnostic-friendly names for declarations. Some of the diagnostic text might need to be reworded as part of this change so the new words fit properly with the rest of the text.
Here's an overview of what you need to do:
The compiler diagnostic files are located in the include/swift/AST folder. The one that needs to be updated is called DiagnosticsSema.def. Once updated, you will also need to mirror your changes in the localization file, which is located at swift/localization/diagnostics/en.yaml.
Find uses of the word "accessor" in diagnostic text and substitute it with a format specifier that maps to a DescriptiveDeclKind. There are some uses of "accessor" which should not be changed for now - you may find them attached with the words "modify" (or "_modify"), "read" (or "_read"), "addressor" and "mutableAddressor". These accessors are currently not meant for public use, so it's probably fine to leave diagnostic text for them unchanged.
Find uses of that diagnostic in code (using its identifier) and pass the DescriptiveDeclKind as argument (which can be obtained by calling getDescriptiveKind() on a declaration).
Run tests and update test files with new diagnostic text.