@@ -1532,48 +1532,6 @@ class NominalOrBoundGenericNominalType : public AnyGenericType {
1532
1532
};
1533
1533
DEFINE_EMPTY_CAN_TYPE_WRAPPER (NominalOrBoundGenericNominalType, AnyGenericType)
1534
1534
1535
- // / InverseType represents the "inverse" of a ProtocolType as a constraint.
1536
- // / An inverse represents the _absence_ of an implicit constraint to the given
1537
- // / protocol.
1538
- // /
1539
- // / Otherwise, an inverse is not a real type! It's an annotation for other types
1540
- // / to signal whether an implicit requirement on that type should be omitted.
1541
- // / Because that annotation is expressed in the surface language as if it _were_
1542
- // / a type (that is, as a type constraint) we still model it as a Type through
1543
- // / typechecking.
1544
- class InverseType final : public TypeBase {
1545
- Type protocol;
1546
-
1547
- InverseType (Type type,
1548
- const ASTContext *canonicalContext,
1549
- RecursiveTypeProperties properties)
1550
- : TypeBase(TypeKind::Inverse, canonicalContext, properties),
1551
- protocol (type) {
1552
- assert (protocol->is <ProtocolType>());
1553
- }
1554
-
1555
- public:
1556
- // / Produce an inverse constraint type for the given protocol type.
1557
- static Type get (Type protocolType);
1558
-
1559
-
1560
- // / Obtain the underlying \c ProtocolType that was inverted.
1561
- Type getInvertedProtocol () const {
1562
- return protocol;
1563
- }
1564
-
1565
- // / Get known kind of inverse this type represents.
1566
- InvertibleProtocolKind getInverseKind () const ;
1567
-
1568
- // Implement isa/cast/dyncast/etc.
1569
- static bool classof (const TypeBase *T) {
1570
- return T->getKind () == TypeKind::Inverse;
1571
- }
1572
- };
1573
- BEGIN_CAN_TYPE_WRAPPER (InverseType, Type)
1574
- PROXY_CAN_TYPE_SIMPLE_GETTER(getInvertedProtocol)
1575
- END_CAN_TYPE_WRAPPER(InverseType, Type)
1576
-
1577
1535
// / ErrorType - Represents the type of an erroneously constructed declaration,
1578
1536
// / expression, or type. When creating ErrorTypes, an associated error
1579
1537
// / diagnostic should always be emitted. That way when later stages of
@@ -5813,6 +5771,9 @@ class ProtocolCompositionType final : public TypeBase,
5813
5771
// / Constructs a protocol composition corresponding to the `AnyObject` type.
5814
5772
static Type theAnyObjectType (const ASTContext &C);
5815
5773
5774
+ // / Constructs a protocol composition corresponding to the `~IP` type.
5775
+ static Type getInverseOf (const ASTContext &C, InvertibleProtocolKind IP);
5776
+
5816
5777
// / Canonical protocol composition types are minimized only to a certain
5817
5778
// / degree to preserve ABI compatibility. This routine enables performing
5818
5779
// / slower, but stricter minimization at need (e.g. redeclaration checking).
@@ -7296,8 +7257,7 @@ inline bool TypeBase::isConstraintType() const {
7296
7257
inline bool CanType::isConstraintTypeImpl (CanType type) {
7297
7258
return (isa<ProtocolType>(type) ||
7298
7259
isa<ProtocolCompositionType>(type) ||
7299
- isa<ParameterizedProtocolType>(type) ||
7300
- isa<InverseType>(type));
7260
+ isa<ParameterizedProtocolType>(type));
7301
7261
}
7302
7262
7303
7263
inline bool TypeBase::isExistentialType () {
@@ -7313,7 +7273,6 @@ inline bool CanType::isExistentialTypeImpl(CanType type) {
7313
7273
isa<ProtocolCompositionType>(type) ||
7314
7274
isa<ExistentialType>(type) ||
7315
7275
isa<ParameterizedProtocolType>(type);
7316
- // TODO(kavon): treat InverseType as an existential, etc?
7317
7276
}
7318
7277
7319
7278
inline bool CanType::isAnyExistentialTypeImpl (CanType type) {
0 commit comments