Skip to content

Commit acfdf83

Browse files
committed
[nfc] improve some comments
1 parent dd0f90d commit acfdf83

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

lib/AST/Module.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ static ProtocolConformanceRef getBuiltinTupleTypeConformance(
13691369
return ProtocolConformanceRef(specialized);
13701370
}
13711371

1372-
/// For some known protocols like Sendable and Copyable, a tuple type
1372+
/// For some known protocols (KPs) like Sendable and Copyable, a tuple type
13731373
/// conforms to the protocol KP when all of their element types conform to KP.
13741374
if (protocol->isSpecificProtocol(KnownProtocolKind::Sendable) ||
13751375
protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
@@ -1458,8 +1458,8 @@ static ProtocolConformanceRef getBuiltinFunctionTypeConformance(
14581458
BuiltinConformanceKind::Synthesized));
14591459
}
14601460

1461-
// Functions cannot destroy move-only vars/lets that they capture, so it's
1462-
// safe to copy functions, as if they're classes.
1461+
// Functions cannot permanently destroy a move-only var/let
1462+
// that they capture, so it's safe to copy functions, like classes.
14631463
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable)) {
14641464
return ProtocolConformanceRef(
14651465
ctx.getBuiltinConformance(type, protocol, GenericSignature(), {},
@@ -1547,7 +1547,6 @@ LookupConformanceInModuleRequest::evaluate(
15471547
if (auto archetype = type->getAs<ArchetypeType>()) {
15481548

15491549
// All archetypes conform to Copyable since they represent a generic.
1550-
// FIXME: can't tell whether this is a hack.
15511550
if (protocol->isSpecificProtocol(KnownProtocolKind::Copyable))
15521551
return ProtocolConformanceRef(protocol);
15531552

lib/AST/ProtocolConformance.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,8 +1239,7 @@ static SmallVector<ProtocolConformance *, 2> findSynthesizedConformances(
12391239
// Concrete types may synthesize some conformances
12401240
if (!isa<ProtocolDecl>(nominal)) {
12411241
trySynthesize(KnownProtocolKind::Sendable);
1242-
trySynthesize(KnownProtocolKind::Copyable); // FIXME: we do it when the conformance table is generaetd
1243-
// so this is actually useless now.
1242+
trySynthesize(KnownProtocolKind::Copyable);
12441243
}
12451244

12461245
/// Distributed actors can synthesize Encodable/Decodable, so look for those

lib/Sema/ConstraintSystem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,10 @@ TypeVariableType *ConstraintSystem::openGenericParameter(
18101810
ProtocolDecl *copyable = TypeChecker::getProtocol(
18111811
getASTContext(), SourceLoc(), KnownProtocolKind::Copyable);
18121812

1813+
// FIXME(kavon): there's a dependency ordering issues here with the
1814+
// protocol being defined in the stdlib, because when trying to build
1815+
// the stdlib itself, or a Swift program with -parse-stdlib, we can't
1816+
// load the protocol to add this constraint. (rdar://104898230)
18131817
assert(copyable && "stdlib is missing _Copyable protocol!");
18141818
addConstraint(
18151819
ConstraintKind::ConformsTo, typeVar,

0 commit comments

Comments
 (0)