swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.25k stars 10.32k forks source link

[SR-14254] Incorrect example #56614

Closed swift-ci closed 6 months ago

swift-ci commented 3 years ago
Previous ID SR-14254
Radar rdar://problem/74616580
Original Reporter mgrynychyn (JIRA User)
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug, Documentation | |Assignee | None | |Priority | Medium | md5: 3e617c9256c72de7cf760b3f09a50b85

Issue Description:

There is an incorrect example in "Generics" part of Documentation, section "Type Constraints/Type Constraints Syntax"

The hypothetical function

func someFunction<T: SomeClass, U: SomeProtocol>(someT: T, someU: U) {
  // function body goes here
}

is not a generic function.

You can write

func someFunction (someT: SomeClass, someU: SomeProtocol) {
  // function body goes here
}

with the same results.

typesanitizer commented 3 years ago

@swift-ci create

AbhishekSharma55 commented 6 months ago

Hi there,

I want to contribute to this project and take on this issue as my first task. Could you please assign it to me? I am excited to work towards resolving it and will keep the team updated on my progress.

Thanks

AnthonyLatsis commented 6 months ago

This is most certainly in reference to https://docs.swift.org/swift-book/documentation/the-swift-programming-language/generics#Type-Constraint-Syntax. I am not sure I understand what the issue was, but it looks to be fixed either way.

@xedin Please transfer this.