File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -114,19 +114,21 @@ ProtocolConformanceRef::subst(Type origType,
114114
115115 auto *proto = getRequirement ();
116116
117+ // If the type is an existential, it must be self-conforming.
118+ if (substType->isExistentialType ()) {
119+ auto optConformance =
120+ proto->getModuleContext ()->lookupExistentialConformance (substType, proto);
121+ assert (optConformance && " existential type didn't self-conform" );
122+ return *optConformance;
123+ }
124+
117125 // Check the conformance map.
118126 if (auto result = conformances (origType->getCanonicalType (),
119127 substType, proto)) {
120128 return *result;
121129 }
122130
123- // The only remaining case is that the type is an existential that
124- // self-conforms.
125- assert (substType->isExistentialType ());
126- auto optConformance =
127- proto->getModuleContext ()->lookupExistentialConformance (substType, proto);
128- assert (optConformance && " existential type didn't self-conform" );
129- return *optConformance;
131+ llvm_unreachable (" Invalid conformance substitution" );
130132}
131133
132134Type
You can’t perform that action at this time.
0 commit comments