Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8118,15 +8118,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
getSILSynthesizeKind() == SILSynthesizeKind::DistributedActorFactory;
}

/// Return a vector of distributed requirements that this distributed method
/// is implementing.
///
/// If the method is witness to multiple requirements this is incorrect and
/// should be diagnosed during type-checking as it may make remoteCalls
/// ambiguous.
llvm::ArrayRef<ValueDecl *>
getDistributedMethodWitnessedProtocolRequirements() const;

/// Determines whether this function is a 'remoteCall' function,
/// which is used as ad-hoc protocol requirement by the
/// 'DistributedActorSystem' protocol.
Expand Down
21 changes: 0 additions & 21 deletions include/swift/AST/TypeCheckRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -1598,27 +1598,6 @@ class GetDistributedActorConcreteArgumentDecodingMethodRequest :
bool isCached() const { return true; }
};

/// Find out if a distributed method is implementing a distributed protocol
/// requirement.
class GetDistributedMethodWitnessedProtocolRequirements :
public SimpleRequest<GetDistributedMethodWitnessedProtocolRequirements,
llvm::ArrayRef<ValueDecl *> (AbstractFunctionDecl *),
RequestFlags::Cached> {
public:
using SimpleRequest::SimpleRequest;

private:
friend SimpleRequest;

llvm::ArrayRef<ValueDecl *> evaluate(
Evaluator &evaluator,
AbstractFunctionDecl *nominal) const;

public:
// Caching
bool isCached() const { return true; }
};

/// Retrieve the static "shared" property within a global actor that provides
/// the actor instance representing the global actor.
///
Expand Down
3 changes: 0 additions & 3 deletions include/swift/AST/TypeCheckerTypeIDZone.def
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ SWIFT_REQUEST(TypeChecker, GetDistributedActorSystemPropertyRequest,
SWIFT_REQUEST(TypeChecker, GetDistributedRemoteCallTargetInitFunctionRequest,
ConstructorDecl *(NominalTypeDecl *),
Cached, NoLocationInfo)
SWIFT_REQUEST(TypeChecker, GetDistributedMethodWitnessedProtocolRequirements,
ArrayRef<ValueDecl *> (AbstractFunctionDecl *),
Cached, NoLocationInfo)
SWIFT_REQUEST(TypeChecker, GetDistributedRemoteCallArgumentInitFunctionRequest,
ConstructorDecl *(NominalTypeDecl *),
Cached, NoLocationInfo)
Expand Down
15 changes: 0 additions & 15 deletions lib/AST/DistributedDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,21 +453,6 @@ bool swift::checkDistributedSerializationRequirementIsExactlyCodable(
std::count(protocols.begin(), protocols.end(), decodable) == 1;
}

// TODO(distributed): probably can be removed?
llvm::ArrayRef<ValueDecl *>
AbstractFunctionDecl::getDistributedMethodWitnessedProtocolRequirements() const {
auto mutableThis = const_cast<AbstractFunctionDecl *>(this);

// Only a 'distributed' decl can witness 'distributed' protocol
if (!isDistributed()) {
return llvm::ArrayRef<ValueDecl *>();
}

return evaluateOrDefault(
getASTContext().evaluator,
GetDistributedMethodWitnessedProtocolRequirements(mutableThis), {});
}

/******************************************************************************/
/********************* Ad-hoc protocol requirement checks *********************/
/******************************************************************************/
Expand Down
18 changes: 0 additions & 18 deletions lib/Sema/TypeCheckDistributed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,21 +945,3 @@ GetDistributedActorConcreteArgumentDecodingMethodRequest::evaluate(
/// witness
return nullptr;
}

llvm::ArrayRef<ValueDecl *>
GetDistributedMethodWitnessedProtocolRequirements::evaluate(
Evaluator &evaluator,
AbstractFunctionDecl *afd) const {
// Only a 'distributed' decl can witness 'distributed' protocol
assert(afd->isDistributed());
auto &C = afd->getASTContext();

auto result = llvm::SmallVector<ValueDecl *, 1>();
for (auto witnessedRequirement : afd->getSatisfiedProtocolRequirements()) {
if (witnessedRequirement->isDistributed()) {
result.push_back(witnessedRequirement);
}
}

return C.AllocateCopy(result);
}