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(
5748
5748
Type conformingType, ProtocolDecl *proto) {
5749
5749
ASTContext &ctx = proto->getASTContext ();
5750
5750
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
+
5751
5771
// Figure out which arena this should go in.
5752
- RecursiveTypeProperties properties;
5753
- if (conformingType)
5754
- properties |= conformingType->getRecursiveProperties ();
5772
+ auto properties = conformingType->getRecursiveProperties ();
5755
5773
auto arena = getArena (properties);
5756
5774
5757
5775
// Profile the substitution map.
Original file line number Diff line number Diff line change @@ -312,10 +312,8 @@ bool ProtocolConformanceRef::isCanonical() const {
312
312
if (isPack ())
313
313
return getPack ()->isCanonical ();
314
314
315
- if (isAbstract ()) {
316
- Type conformingType = getType ();
317
- return !conformingType || conformingType->isCanonical ();
318
- }
315
+ if (isAbstract ())
316
+ return getType ()->isCanonical ();
319
317
320
318
return getConcrete ()->isCanonical ();
321
319
}
@@ -328,12 +326,8 @@ ProtocolConformanceRef::getCanonicalConformanceRef() const {
328
326
if (isPack ())
329
327
return ProtocolConformanceRef (getPack ()->getCanonicalConformance ());
330
328
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 ());
337
331
338
332
return ProtocolConformanceRef (getConcrete ()->getCanonicalConformance ());
339
333
}
You can’t perform that action at this time.
0 commit comments