Skip to content

[3.0] Relax overly conservative "uses generic params" errors in ObjC generic extensions. #4246

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

Conversation

jckarter
Copy link
Contributor

id-as-Any regressed some ObjC generic extensions, since going from a generic T to Any naively would require the type metadata of T. Since T is always class-constrained currently, we can avoid this by erasing the type to AnyObject and building an Any around it instead. There are also some cases where we unnecessarily raised the error on assignments and dynamic casts, preventing some workarounds for cases we don't yet support.

… runtime metadata.

Naively wrapping a T in an Any would require metadata for T, but we can go to AnyObject first and put the AnyObject in the Any without T's metadata. This fixes a regression in ObjC generic extension methods when they try to pass their generic parameters to id parameters as Any. rdar://problem/27526877
…ta of the parameters.

We can't check the generic parameters dynamically.
@jckarter
Copy link
Contributor Author

@swift-ci Please test OS X

@tkremenek tkremenek self-assigned this Aug 12, 2016
@tkremenek tkremenek merged commit f3c0c71 into swiftlang:swift-3.0-branch Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants