-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
…on map when computing necessary bindings of abstract cnditional requirements SR-12853
@swift-ci Please test |
lib/IRGen/GenProto.cpp
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: extra space
lib/IRGen/GenProto.cpp
Outdated
auto conformance = subMap.lookupConformance(ty, proto); | ||
auto *genericEnv = archetype->getGenericEnvironment(); | ||
auto conformance = | ||
genericEnv->getForwardingSubstitutionMap().lookupConformance(ty, proto); |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test linux |
@swift-ci Please clean test os x |
@swift-ci Please test |
Build failed |
Build failed |
SR-12853