Why StringProtocol.hasSuffix has argument `prefix`?

Why this protocol required method hasPrefix has argument prefix not suffix?

Because its default implementation's argument name is suffix, when I use this method with value of type String, it appears hasPrefix(_ suffix: String).

However, when I use value of type some StringProtocol, it's argument name is prefix because protocol requirement uses prefix.

Is there any reason? Or simply it is mistake of implementation?

2 Likes

Or simply it is mistake of implementation?

Yeah, that looks like a copy’n’paste bug, and I recommend that you file it as such. Please post your bug number, just for the record.

Well spotted btw!

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

Thank you!

I created a PR about this a while back, but I didn't file this. Should I assign it myself?

[EDIT] I did it.