You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generic Parameters can be specified to match conformance to a type (i.e. protocol) or protocol composition, or to exactly match another type. But there are no tests for anti-matching. For the equivalent C++ feature, an anti-match can be formed by putting the desired members in the generalization and leaving the specialization empty. But Swift, AFAIK, doesn't have this specialization model, so we're stuck.
My first guess to write these anti-matches is just sticking "!" in places:
Actually, it more that the anti-conformance requirement may not be workable. The anti-same-type requirement could still be useful, because that check can't be retroactively changed (AFAIK).
Additional Detail from JIRA
md5: 509a2a516b408ad50532ccf1b6d45295
Issue Description:
Generic Parameters can be specified to match conformance to a type (i.e. protocol) or protocol composition, or to exactly match another type. But there are no tests for anti-matching. For the equivalent C++ feature, an anti-match can be formed by putting the desired members in the generalization and leaving the specialization empty. But Swift, AFAIK, doesn't have this specialization model, so we're stuck.
My first guess to write these anti-matches is just sticking "!" in places:
generic-parameter-clause → < generic-parameter-list >
generic-parameter-list → generic-parameter | generic-parameter , generic-parameter-list
generic-parameter → type-name
generic-parameter → type-name : !opt type-identifier
generic-parameter → type-name : !opt protocol-composition-type
generic-where-clause → where requirement-list
requirement-list → requirement | requirement , requirement-list
requirement → conformance-requirement | same-type-requirement
conformance-requirement → type-identifier : !opt type-identifier
conformance-requirement → type-identifier : !opt protocol-composition-type
same-type-requirement → type-identifier == type
same-type-requirement → type-identifier != type
The text was updated successfully, but these errors were encountered: