Skip to content

[PrintAsObjC] Handle generic parameters in extensions. #7818

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

Merged

Conversation

jrose-apple
Copy link
Contributor

Most of the time, "generics" means "cannot be exposed to Objective-C" and certainly "cannot be exposed in the generated header", but there is one exception: imported Objective-C parameterized types, and their extensions. We were previously dropping this on the floor and printing Foo</* BarType */> in the generated header, which is nonsense.

SR-3480

Most of the time, "generics" means "cannot be exposed to Objective-C"
and certainly "cannot be exposed in the generated header", but there
is one exception: imported Objective-C parameterized types, and their
extensions. We were previously dropping this on the floor and printing
`Foo</* BarType */>` in the generated header, which is nonsense.

https://bugs.swift.org/browse/SR-3480
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

"extensions with custom generic parameters?");
assert(extension->getGenericSignature()->getCanonicalSignature() ==
extendedClass->getGenericSignature()->getCanonicalSignature() &&
"constrained extensions or custom generic parameters?");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavapestov, do these assertions look good?

@jrose-apple jrose-apple merged commit 79b5ea0 into swiftlang:master Feb 28, 2017
@jrose-apple jrose-apple deleted the generic-extensions-of-objc-classes branch February 28, 2017 20:52
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth testing an extension of an ObjC generic class that has bounds on its type parameters. The bounds don't need to be printed, so things should work already, but...

@jrose-apple
Copy link
Contributor Author

Ah, PettableContainer is such a class.

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.

3 participants