swift: Error message for obsoleted protocol composition syntax should say "types" instead of "protocols"
The following syntax error is emitted when the parser spots obsoleted protocol composition syntax:
typealias C = protocol<P, Q> // error: 'protocol<...>' composition syntax has been removed; join the protocols using '&'
The problem with this message is that “protocols” is not an accurate or prudent description of the components at this compilation stage:
- Protocol compositions are not limited to protocols.
- A component can be written in terms of a member type, such as a nested
typealias
. - The parser has no knowledge of whether the components are legal, namely, whether they really reference protocols or classes.
A more neutral “types” is preferable.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Fix Issue #62518 by changing 'protocols' to 'type constraints' for obsoleted error decomposition syntax error message — committed to Rajveer100/swift by deleted user a year ago
- Changed 'protocols' to 'type constraints' for obsoleted protocol composition syntax error Fixes #62518 — committed to Rajveer100/swift by deleted user a year ago
- Changed 'protocols' to 'type constraints' for obsoleted protocol composition syntax error Fixes #62518 — committed to Rajveer100/swift by deleted user a year ago
- Changed 'protocols' to 'type constraints' for obsoleted protocol composition syntax error Fixes #62518 — committed to Rajveer100/swift by deleted user a year ago
That means that your new branch branches off from the branch associated with the ongoing PR. You should set the new branch to track
main
instead and rebase.Good point, wording them as constraints (or type constraints per the language guide) sounds better.