Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-5793] Regression: Generic parameter 'T' is not used in function signature #48363

Closed
lilyball mannequin opened this issue Aug 29, 2017 · 1 comment
Closed

[SR-5793] Regression: Generic parameter 'T' is not used in function signature #48363

lilyball mannequin opened this issue Aug 29, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Aug 29, 2017

Previous ID SR-5793
Radar None
Original Reporter @lilyball
Type Bug
Status Resolved
Resolution Won't Do
Environment

Xcode 9.0 (9M214v)
Apple Swift version 4.0 (swiftlang-900.0.63.10 clang-900.0.36)
Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.0Regression
Assignee None
Priority Medium

md5: 67b1c66ba2bafebf895d901eecbd66b1

Issue Description:

Swift 3.2 and later incorrectly claims that a generic parameter isn't used in the function signature if the signature uses the generic parameter's associated type.

Example:

protocol Foo {
  associatedtype Bar
}

func foo<T: Foo>(x: T.Bar) -> T.Bar {
  return x
}

Swift 3.1 happily accepts this. Swift 3.2 and later claims

error: generic parameter 'T' is not used in function signature

@belkadan
Copy link
Contributor

Swift 3.2 is right; there's not enough information to infer what type T is. Swift 3.1 would let you define this function but not call it.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0
Projects
None yet
Development

No branches or pull requests

2 participants