File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -6050,6 +6050,10 @@ class ProtocolCompositionType final : public TypeBase,
6050
6050
return Bits.ProtocolCompositionType .HasExplicitAnyObject ;
6051
6051
}
6052
6052
6053
+ // / Produce a new type (potentially not be a protoocl composition)
6054
+ // / which drops all of the marker protocol types associated with this one.
6055
+ Type withoutMarkerProtocols () const ;
6056
+
6053
6057
// Implement isa/cast/dyncast/etc.
6054
6058
static bool classof (const TypeBase *T) {
6055
6059
return T->getKind () == TypeKind::ProtocolComposition;
Original file line number Diff line number Diff line change @@ -3704,6 +3704,20 @@ Type ProtocolCompositionType::getInverseOf(const ASTContext &C,
3704
3704
/* HasExplicitAnyObject=*/ false );
3705
3705
}
3706
3706
3707
+ Type ProtocolCompositionType::withoutMarkerProtocols () const {
3708
+ SmallVector<Type, 4 > newMembers;
3709
+ llvm::copy_if (getMembers (), std::back_inserter (newMembers), [](Type member) {
3710
+ auto *P = member->getAs <ProtocolType>();
3711
+ return !(P && P->getDecl ()->isMarkerProtocol ());
3712
+ });
3713
+
3714
+ if (newMembers.size () == getMembers ().size ())
3715
+ return Type (const_cast <ProtocolCompositionType *>(this ));
3716
+
3717
+ return ProtocolCompositionType::get (getASTContext (), newMembers,
3718
+ getInverses (), hasExplicitAnyObject ());
3719
+ }
3720
+
3707
3721
Type ProtocolCompositionType::get (const ASTContext &C,
3708
3722
ArrayRef<Type> Members,
3709
3723
InvertibleProtocolSet Inverses,
You can’t perform that action at this time.
0 commit comments