Echo
Echo copied to clipboard
consider reversing the meaning of `hasClassConstraint`
The hasClassConstraint
property of ProtocolDescriptor.Flags
returns true
if the corresponding bit is set in the protocol descriptor.
However, when the bit is set, it means that the protocol is not class-constrained. Here's how GenMeta.cpp
sets the bit:
flags.setClassConstraint(Proto->requiresClass()
? ProtocolClassConstraint::Class
: ProtocolClassConstraint::Any);
And here's how MetadataValues.h
defines ProtocolClassConstraint
:
/// Flag that indicates whether an existential type is class-constrained or not.
enum class ProtocolClassConstraint : bool {
/// The protocol is class-constrained, so only class types can conform to it.
///
/// This must be 0 for ABI compatibility with Objective-C protocol_t records.
Class = false,
/// Any type can conform to the protocol.
Any = true,
};
Given this, hasClassConstraint
would be more meaningful if it returned true
when the corresponding bit is not set.