Skip to content

IRGen: Lookup the conformance of an archetype in the right substitution map when computing necessary bindings of abstract cnditional requirements #32277

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

aschwaighofer
Copy link
Contributor

…on map when computing necessary bindings of abstract cnditional requirements

SR-12853
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@@ -2749,9 +2749,12 @@ static void addAbstractConditionalRequirements(
auto *proto =
req.getSecondType()->castTo<ProtocolType>()->getDecl();
auto ty = req.getFirstType()->getCanonicalType();
if (!isa<ArchetypeType>(ty))
auto archetype = dyn_cast<ArchetypeType>(ty);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: extra space

auto conformance = subMap.lookupConformance(ty, proto);
auto *genericEnv = archetype->getGenericEnvironment();
auto conformance =
genericEnv->getForwardingSubstitutionMap().lookupConformance(ty, proto);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this ever not just an abstract conformance? Look at how the forwarding substitution map is constructed...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I replaced the check by an assert.

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 see if conformance.getAbstract() always equal to proto? If that always holds, you can simplify the code further (and get rid of the asserts since they're not really computing anything useful at this point).

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2b47815

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 2b47815

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please clean test os x

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 478e13b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 478e13b

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