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

Most upvoted comments

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.