Skip to content

Commit 3bb8fa8

Browse files
committed
nfc: !isNoncopyable() -> isCopyable()
1 parent 19c6833 commit 3bb8fa8

File tree

14 files changed

+18
-18
lines changed

14 files changed

+18
-18
lines changed

include/swift/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6105,7 +6105,7 @@ class SILMoveOnlyWrappedType final : public TypeBase,
61056105
innerType(innerType) {
61066106
// If it has a type parameter, we can't check whether it's copyable.
61076107
assert(innerType->hasTypeParameter() ||
6108-
!innerType->isNoncopyable() && "Inner type must be copyable");
6108+
innerType->isCopyable() && "Inner type must be copyable");
61096109
}
61106110

61116111
public:

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8571,7 +8571,7 @@ LifetimeAnnotation ParamDecl::getLifetimeAnnotation() const {
85718571
auto specifier = getSpecifier();
85728572
// Copyable parameters which are consumed have eager-move semantics.
85738573
if (specifier == ParamDecl::Specifier::Consuming &&
8574-
!getTypeInContext()->isNoncopyable()) {
8574+
getTypeInContext()->isCopyable()) {
85758575
if (getAttrs().hasAttribute<NoEagerMoveAttr>())
85768576
return LifetimeAnnotation::Lexical;
85778577
return LifetimeAnnotation::EagerMove;
@@ -11429,7 +11429,7 @@ LifetimeAnnotation FuncDecl::getLifetimeAnnotation() const {
1142911429
// Copyable parameters which are consumed have eager-move semantics.
1143011430
if (getSelfAccessKind() == SelfAccessKind::Consuming) {
1143111431
auto *selfDecl = getImplicitSelfDecl();
11432-
if (selfDecl && !selfDecl->getTypeInContext()->isNoncopyable()) {
11432+
if (selfDecl && selfDecl->getTypeInContext()->isCopyable()) {
1143311433
if (getAttrs().hasAttribute<NoEagerMoveAttr>())
1143411434
return LifetimeAnnotation::Lexical;
1143511435
return LifetimeAnnotation::EagerMove;

lib/AST/Pattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ Pattern::getOwnership(
797797
case VarDecl::Introducer::Var:
798798
// If the subpattern type is copyable, then we can bind the variable
799799
// by copying without requiring more than a borrow of the original.
800-
if (!p->hasType() || !p->getType()->isNoncopyable()) {
800+
if (!p->hasType() || p->getType()->isCopyable()) {
801801
break;
802802
}
803803
// TODO: An explicit `consuming` binding kind consumes regardless of

lib/IRGen/GenType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3054,7 +3054,7 @@ IsABIAccessible_t irgen::isTypeABIAccessibleIfFixedSize(IRGenModule &IGM,
30543054
CanType ty) {
30553055

30563056
// Copyable types currently are always ABI-accessible if they're fixed size.
3057-
if (!ty->isNoncopyable())
3057+
if (ty->isCopyable())
30583058
return IsABIAccessible;
30593059

30603060
// Check for a deinit. If this type does not define a deinit it is ABI

lib/SIL/IR/SIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ getKeyPathSupportingGenericSignature(Type ty, GenericSignature contextSig) {
319319

320320
// If the type is already unconditionally Copyable and Escapable, we don't
321321
// need any further requirements.
322-
if (!ty->isNoncopyable() && ty->isEscapable()) {
322+
if (ty->isCopyable() && ty->isEscapable()) {
323323
return contextSig;
324324
}
325325

lib/SIL/IR/SILType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ SILType SILType::addingMoveOnlyWrapperToBoxedType(const SILFunction *fn) {
12391239
auto oldField = oldLayout->getFields()[0];
12401240
if (oldField.getLoweredType()->is<SILMoveOnlyWrappedType>())
12411241
return *this;
1242-
assert(!oldField.getLoweredType()->isNoncopyable() &&
1242+
assert(oldField.getLoweredType()->isCopyable() &&
12431243
"Cannot moveonlywrapped in a moveonly type");
12441244
auto newField =
12451245
SILField(SILMoveOnlyWrappedType::get(oldField.getLoweredType()),

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ CaptureKind TypeConverter::getDeclCaptureKind(CapturedValue capture,
128128
contextTy, TypeExpansionContext::noOpaqueTypeArchetypesSubstitution(
129129
expansion.getResilienceExpansion()));
130130

131-
assert(!contextTy->isNoncopyable() && "Not implemented");
131+
assert(contextTy->isCopyable() && "Not implemented");
132132
if (!props.isAddressOnly())
133133
return CaptureKind::Constant;
134134

lib/SILGen/SILGenDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ class LocalVariableInitialization : public SingleBufferInitialization {
561561

562562
// If our instance type is not already @moveOnly wrapped, and it's a
563563
// no-implicit-copy parameter, wrap it.
564-
if (!isNoImplicitCopy && !instanceType->isNoncopyable()) {
564+
if (!isNoImplicitCopy && instanceType->isCopyable()) {
565565
if (auto *pd = dyn_cast<ParamDecl>(decl)) {
566566
isNoImplicitCopy = pd->isNoImplicitCopy();
567567
isNoImplicitCopy |= pd->getSpecifier() == ParamSpecifier::Consuming;
@@ -577,7 +577,7 @@ class LocalVariableInitialization : public SingleBufferInitialization {
577577
}
578578
}
579579

580-
const bool isCopyable = isNoImplicitCopy || !instanceType->isNoncopyable();
580+
const bool isCopyable = isNoImplicitCopy || instanceType->isCopyable();
581581

582582
auto boxType = SGF.SGM.Types.getContextBoxTypeForCapture(
583583
decl, instanceType, SGF.F.getGenericEnvironment(),
@@ -1548,7 +1548,7 @@ SILGenFunction::emitInitializationForVarDecl(VarDecl *vd, bool forceImmutable,
15481548
// If this is a 'let' initialization for a copyable non-global, set up a let
15491549
// binding, which stores the initialization value into VarLocs directly.
15501550
if (forceImmutable && vd->getDeclContext()->isLocalContext() &&
1551-
!isa<ReferenceStorageType>(varType) && !varType->isNoncopyable())
1551+
!isa<ReferenceStorageType>(varType) && varType->isCopyable())
15521552
return InitializationPtr(new LetValueInitialization(vd, *this));
15531553

15541554
// If the variable has no initial value, emit a mark_uninitialized instruction

lib/SILGen/SILGenPattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ void PatternMatchEmission::bindIrrefutableBorrows(const ClauseRow &row,
13081308
// explicitly `borrowing`, then we can bind it as a normal copyable
13091309
// value.
13101310
if (named->getDecl()->getIntroducer() != VarDecl::Introducer::Borrowing
1311-
&& !named->getType()->isNoncopyable()) {
1311+
&& named->getType()->isCopyable()) {
13121312
bindVariable(pattern, named->getDecl(), args[i], forIrrefutableRow,
13131313
hasMultipleItems);
13141314
} else {

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static bool willHaveConfusingConsumption(Type type,
387387
ConstraintLocatorBuilder locator,
388388
ConstraintSystem &cs) {
389389
assert(type);
390-
if (!type->isNoncopyable())
390+
if (type->isCopyable())
391391
return false; /// If it's a copyable type, there's no confusion.
392392

393393
auto loc = cs.getConstraintLocator(locator);

0 commit comments

Comments
 (0)