File tree Expand file tree Collapse file tree 2 files changed +25
-13
lines changed Expand file tree Collapse file tree 2 files changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -5748,10 +5748,28 @@ ProtocolConformanceRef ProtocolConformanceRef::forAbstract(
57485748 Type conformingType, ProtocolDecl *proto) {
57495749 ASTContext &ctx = proto->getASTContext ();
57505750
5751+ auto kind = conformingType->getDesugaredType ()->getKind ();
5752+ switch (kind) {
5753+ case TypeKind::GenericTypeParam:
5754+ case TypeKind::TypeVariable:
5755+ case TypeKind::DependentMember:
5756+ case TypeKind::Unresolved:
5757+ case TypeKind::Placeholder:
5758+ case TypeKind::PrimaryArchetype:
5759+ case TypeKind::PackArchetype:
5760+ case TypeKind::OpaqueTypeArchetype:
5761+ case TypeKind::ExistentialArchetype:
5762+ case TypeKind::ElementArchetype:
5763+ break ;
5764+
5765+ default :
5766+ llvm::errs () << " Abstract conformance with bad subject type:\n " ;
5767+ conformingType->dump (llvm::errs ());
5768+ abort ();
5769+ }
5770+
57515771 // Figure out which arena this should go in.
5752- RecursiveTypeProperties properties;
5753- if (conformingType)
5754- properties |= conformingType->getRecursiveProperties ();
5772+ auto properties = conformingType->getRecursiveProperties ();
57555773 auto arena = getArena (properties);
57565774
57575775 // Profile the substitution map.
Original file line number Diff line number Diff line change @@ -312,10 +312,8 @@ bool ProtocolConformanceRef::isCanonical() const {
312312 if (isPack ())
313313 return getPack ()->isCanonical ();
314314
315- if (isAbstract ()) {
316- Type conformingType = getType ();
317- return !conformingType || conformingType->isCanonical ();
318- }
315+ if (isAbstract ())
316+ return getType ()->isCanonical ();
319317
320318 return getConcrete ()->isCanonical ();
321319}
@@ -328,12 +326,8 @@ ProtocolConformanceRef::getCanonicalConformanceRef() const {
328326 if (isPack ())
329327 return ProtocolConformanceRef (getPack ()->getCanonicalConformance ());
330328
331- if (isAbstract ()) {
332- Type conformingType = getType ();
333- if (conformingType)
334- conformingType = conformingType->getCanonicalType ();
335- return forAbstract (conformingType, getProtocol ());
336- }
329+ if (isAbstract ())
330+ return forAbstract (getType ()->getCanonicalType (), getProtocol ());
337331
338332 return ProtocolConformanceRef (getConcrete ()->getCanonicalConformance ());
339333}
You can’t perform that action at this time.
0 commit comments