Skip to content

Support partial generic specialization of closures #7938

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
merged 4 commits into from
Mar 6, 2017

Conversation

swiftix
Copy link
Contributor

@swiftix swiftix commented Mar 6, 2017

Clean-up the code and fix a bug on the way.

@swiftix
Copy link
Contributor Author

swiftix commented Mar 6, 2017

@swift-ci please smoke test

@@ -130,10 +130,15 @@ bool ReabstractionInfo::prepareAndCheck(ApplySite Apply, SILFunction *Callee,
bool HasConcreteGenericParams = false;
bool HasNonArchetypeGenericParams = false;
HasUnboundGenericParams = false;
for (auto DT : CalleeGenericSig->getGenericParams()) {
auto *SM = Apply.getModule().getSwiftModule();
for (auto GP : CalleeGenericSig->getGenericParams()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead you can call GenericSignature::getSubstitutableParams(), which skips those that are concrete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, nice that we have this API now.

@@ -382,6 +388,12 @@ ReabstractionInfo::createSubstitutedType(SILFunction *OrigF,
Lowering::GenericContextScope GenericScope(M.Types,
CanSpecializedGenericSig);
FnTy = OrigF->getLoweredFunctionType()->substGenericArgs(M, SubstMap);
// Some of the added new requirements may not have been taken into account
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a FIXME here so that I can remember to remove this when I check in my fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You have a fix for this?

@slavapestov
Copy link
Contributor

Looks good, thanks!

@swiftix swiftix force-pushed the wip-partial-specialization-v77 branch from 235846c to d85013e Compare March 6, 2017 21:51
@swiftix
Copy link
Contributor Author

swiftix commented Mar 6, 2017

@swift-ci please smoke test

@swiftix swiftix merged commit c889026 into swiftlang:master Mar 6, 2017
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