Skip to content

Commit 19c6833

Browse files
committed
nfc: introduce TypeBase::isCopyable
The days of double-negative conditions is over.
1 parent b444a0b commit 19c6833

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/AST/Types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,9 @@ class alignas(1 << TypeAlignInBits) TypeBase
699699
/// Copyable.
700700
bool isNoncopyable();
701701

702+
/// Returns true if this contextual type satisfies a conformance to Copyable.
703+
bool isCopyable();
704+
702705
/// Returns true if this contextual type satisfies a conformance to Escapable.
703706
bool isEscapable();
704707

lib/AST/ConformanceLookup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,11 @@ bool TypeBase::isNoncopyable() {
946946
return !Bits.TypeBase.IsCopyable;
947947
}
948948

949+
/// \returns true iff this type conforms to Copyable.
950+
bool TypeBase::isCopyable() {
951+
return !isNoncopyable();
952+
}
953+
949954
/// \returns true iff this type conforms to Escaping.
950955
bool TypeBase::isEscapable() {
951956
if (!Bits.TypeBase.ComputedInvertibleConformances)

0 commit comments

Comments
 (0)